--- title: Python visible: true --- [toc] ## Packaging ### Building If `setup.py` or `pyproject.toml` are properly configured, the command below can be used to build a python package. ```sh python -m build ``` ### Install local package Pip can be used to install a local package for testing purposes. ```sh pip install dist/{PACKAGE NAME}.whl ``` ### Push to PyPI ```sh python -m twine upload --skip-existing dist/* ``` To test packaging stuff, it is recommended to push packages to testpypi instead. ```sh python -m twine upload --skip-existing --repository testpypi dist/* ``` ## Exit on Keyboard Interrupt ```python try: except KeyboardInterrupt: # return SIGINT code exit(130) ```