Why Python Packages?
- The code needs to be versioned.
- The dependencies of the projects needs to be managed.
- The metadata for the project needs to be managed.
- To make our python code installable, reusable and shareable via PyPi or TestPyPI, we need to package our code.
Why choose Pixi for Python Packaging ?
Set up a project directory
- Follow the folder structure
- dont forget to add the init.py file.
- Sequence of pixi commands : init -> add -> run -> lock ->install -> update
Metadata for Python packging
- Need to have a
pyproject.toml
file - Need to have
[build-system]
section withrequires
andbuild-backend
specfied. - Need to have
[project]
section with atleastname
andversion
specified. - Nice to have
dependencies
specified in[project]
section.
How to publish your Python project
- Fill all the metadata and give your project a unique name
- Build your Project
- Create a TestPyPI account and generate the API token
- Upload your package via twine to TestPyPI
- Check your package via pip install