Posted on • Originally published atzufallsheld.de on
TIL how to ship an executable with Poetry
I wanted to build an executable python script on PyPi, so it can be run likeMyPackage
instead ofpython MyPackage.py
.
Finding out how to do this with Poetry was hard. Googling for “Python [distribute|publish] executable” didn’t yield any useful results. I don’t even know how I found the correct answer anymore, but what you need are “scripts”:https://python-poetry.org/docs/pyproject#scripts
These scripts describe executables that will be installed in the user’s system:
[tool.poetry.scripts]MyPackage = "MyPackage.MyPackage:main"
After adding this topyproject.toml
and building the project, I can then runMyPackage
!
Top comments(0)
For further actions, you may consider blocking this person and/orreporting abuse