33
Release the TextHTMLPress package to PyPI
In this blog, we are focusing software releases and getting our code into the hands of users from a GitHub repository. My static html generator, TextHTMLPress was used as the package to be published on PyPI.
Based on references on setup Python project, package structure, and a production-level Python package, I refactor the package as shown below:
TextHTMLPress/
|-- tests/
| |-- inputs/
| |-- test.py
| |
|-- TextHTMLPress/
| |-- __main__.py
| |-- __init__.py
| |-- generator.py
|
|-- .gitignore
|-- config.yml
|-- requirements.txt
|-- LICENSE
|-- CONTRIBUTING.md
|-- setup.cfg
|-- pyproject.toml
|-- README.md
To build a Python Package with setuptools
and wheel
, pyproject.toml
and setup.cfg
files are required. Follow the documentation, one thing worth noting is that now, static metadata setup.cfg
should be preferred over setup.py
, and now setup.py
is not required.
Adding a console script entry point in setup.cfg
allows the package to define a user-friendly name for installers of the package to execute, seeing the reference.
Register at PyPI.
python -m build
python -m twine upload dist/*
The final package can be found at here.
33