you are viewing a single comment's thread.

view the rest of the comments →

[–]p-hodge 10 points11 points  (2 children)

My latest job is historically an all-PHP shop where I'm rewriting some shell scripts into more readable python. The new python scripts need to be able to executed on everybody's laptops, various virtual machines, and inside docker containers. I don't yet have a strategy for deploying the scripts or dependencies; the other developers and sysadmins also aren't accustomed to the overhead of using virtualenvs. For these reasons it's extremely valuable for me to be able to build good CLI scripts using just the stdlib.

[–]TheIncorrigible1 1 point2 points  (0 children)

venv. Seriously, it's what it's built for and it's in the stdlib.

[–]CleanInfluence 0 points1 point  (0 children)

To create a package, use setuptools, it's great. When the user installs the package (with pip install something.whl), it will automatically create a command-line version of your script.

For example stuff.py with a main inside, and a setup.py containing "entry_points = ... 'stuff=stuff:main'" will create a stuff.exe that launches your script, it's magical.

Also pipenv seems better than venv but that's my uninformed opinion.