r/smalltalk • • 16d ago

PyBrowser - A Smalltalk-style Class Browser for Python

Post image

https://github.com/areichow/pybrowser

I hope this is OK to post here - I felt like fellow Smalltalk heads who also work in Python would appreciate it.

PyBrowser is a code browser inspired and based on the classic Smalltalk Class Browser, with dreams of becoming a more complete dynamic Smalltalk-like development environment, with the ability to pull up Smalltalk-style Inpsectors and Debugger.

At this stage of development, it's somewhere between a toy and a tool. I haven't used it for developing on large codebases, but I have used it for some small apps with a handful of files. I've used it to browse and understand existing Python codebases like Django.

There are Class Browser elements of many Python IDEs, but I've never found one that really captured the look, feel, and clarity of the Smalltalk Class Browser, let along enabled the kind of interactive development that Smalltalk is known for. Historically, the recommendation has been to use the Emacs Class Browser (ecb) or oo-browser. I'm not an experienced Emacs user and haven't been able to get either to run.

If you give it a whack - let me know what you think!

84 Upvotes

18 comments sorted by

10

u/ShacoinaBox 16d ago

kind-of a badass idea, i think ive seen one of these before? but anything that makes python usable gets a thumbs up from me.

5

u/diogenic 16d ago

I've wanted something this for the last 25+ years, ever since I first got into Smalltalk. For me, even a static Smalltalk-style Class Browser is useful - something giving me method/function categories, look up for senders/implementers, and keeping my attention on one method/function at a time makes my life easier. Thanks for taking a look!

If you figure out what other browser/ide/editor you're thinking of, let me know!

1

u/Acterium-56 9d ago

It is a weirdly specific itch to scratch. I've absolutely loved smalltalk the environment and not been quite so in love with smalltalk the language. I hope you can get PyBrowser to where you want it to go! I've been scratching that itch myself with https://github.com/thomasjn/ObjectPond - and been having way too much fun in the process.

1

u/diogenic 8d ago

Woah!! That looks amazing! Dreamer even bigger than I was... Playing with it now, thanks for the link.

I love the Smalltalk language. I even enjoy image-based development. But Smalltalk (at least Squeak, Pharo, Cuis) don't really gel with most of my actual real-world workflow, which involves involves a lot of time on the CLI working with files and piping text through scripts I write in bash, python, powershell, perl, grep, awk, etc.

I know of past attempts from 20+ years ago that try to make that world available to Smalltalk (running a Squeak image as a headless/vnc daemon, with a command line utility that passes Smalltalk script contents into the image) but it was fragile and clumsy compared to just working with tools that were more focused on files and text streams.

Even so - I find the Smalltalk browser to be a great way to approach a codebase, even one that isn't heavy on OOP design. I like the focus on a single method/function at a time, while having the API reference right above it. :D

1

u/rwilcox 16d ago

Yeah, it’s tickling my brain too, but I don’t know from where

(Maybe an obscure language from the ‘90s, especially on the Mac???)

3

u/diogenic 16d ago

F-Script perhaps?

It was a very Smalltalk like scripting language for Cocoa on Mac OS X. IIRC you couldn't build full apps with it, but it allowed you to inspect and extend your Objective-C apps easily. It might have allowed you to access the internals of Cocoa apps that weren't yours, but I'm not 100% on that.

F-Script was pretty exciting when it first came out, helping Objective-C get a little closer to it's Smalltalk heritage. I was hopeful would be fleshed out and turned into a full-blown Mac IDE, something I could use to develop a Mac app without having to touch C at all.

https://cocoasamurai.blogspot.com/2007/02/f-script-part-i-introduction.html

ACM paper with some more screenshots:

https://dl.acm.org/doi/epdf/10.1145/949344.949361

I was very active with Squeak in those days - haven't touched it much since ~2009 when my work moved me into more sysadmin territory. Most of what I write is bash and python these days, unfortunately - but I'm always dreaming about being to move back into Smalltalk-land.

1

u/rwilcox 16d ago

Oh I bet that was it. I was hanging out in the Cocoa scene around that time, I’m _sure_ I stumbled into F-Script. (But went Py-ObjC for my fast development needs, pre automatic garbage collection in Objective-C itself)

3

u/wyldcraft 16d ago

Squeak Python when?

2

u/diogenic 16d ago

Ask me how feasible it is after I try adding an Inspector, a Smalltalk-like debugger interface, adding a breakpoint() (equivalent to self halt)... nd then running a Python app from within the PyBrowser environment, with inspection using these new tools. :D

4

u/wyldcraft 15d ago

It's not Pharo you to make these demands.

1

u/diogenic 8d ago

Did you see this? Looks like someone beat me to the punch!

https://github.com/thomasjn/ObjectPond 

1

u/wyldcraft 8d ago edited 8d ago

Ha it's even image-based.

Which is cool to a certain point then you regret packing all your cool code in a unique live environment that grows more fragile and un-upgradable every week. Maybe those folks found a happy middle ground.

Edit: That repo already contains an MCP server. This code was likely AI-generated. Maybe from somebody who read your post.

1

u/nagora 14d ago

Please never.

1

u/sohang-3112 16d ago

Looks interesting, will try out. You should add such a screenshot image to your repo README also.

2

u/diogenic 16d ago

Great idea - thanks!

2

u/diogenic 15d ago

I added a bunch - and created a release zip. Thanks again!