Trying to figure out if there's a good way to inline a module into a Python script. I may just have to write my own tool for that.

Now thinking about syntax if I do write my own tool. It should probably trigger a syntax error so we don't end up with a missing module.


Then a relatively simple script can find all of those lines and replace them with the file contents.

Show thread

Basically I'm trying to statically link Python scripts so I can distribute them without saying "first, install this module I wrote and that you'll only need for these specific scripts..."

Show thread

What I ended up doing was building a zipapp, a ZIP archive containing Python scripts. There's a module (zipapp) for building them, and you can use a shebang to make them act like executables.

· · brutaldon · 0 · 0 · 0
Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.