wiki-grav/pages/04.other/python/default.en.md

781 B

title visible
Python true

[toc]

Packaging

Building

If setup.py or pyproject.toml are properly configured, the command below can be used to build a python package.

python -m build

Install local package

Pip can be used to install a local package for testing purposes.

pip install dist/{PACKAGE NAME}.whl

Push to PyPI

python -m twine upload --skip-existing dist/*

To test packaging stuff, it is recommended to push packages to testpypi instead.

python -m twine upload --skip-existing --repository testpypi dist/*

Exit on Keyboard Interrupt

try:
    <put your code here>
except KeyboardInterrupt:
    <stuff that needs to be done before exiting>
    # return SIGINT code
    exit(130)