Why Python Packages?
- To make Python code installable, reusable and distributable via PyPI or TestPyPI, one must package the code.
- The Package should have modules and init.py file.
- The code must be versioned.
- Project dependencies must be managed.
- The project’s metadata must be clearly defined.
Why choose Pixi for Python Packaging ?
- Choose a tool with good support and long term vision.
- Choose a tool suitable for your project.
- Focus on PEP specifications and recomendations.
Set up a project directory
- Follow the appropriate folder structure.
- Always include the
__init__.pyfile in packages. - Sequence of Pixi commands: init → add → run → lock → install → update.
- Define / check
[project],[dependencies]and[tasks]in yourpyproject.tomlfile .
Metadata for Python packging
How to publish your Python project
- Ensure all metadata is filled in and choose a unique project name.
- Use
buildto generate distribution files - Create a TestPyPI account and generate an API token
- Use
twine uploadto securely publish your package. - Test your package by installing it from TestPyPI via
pip install.
Extra
- Define tasks such as
startin yourpixi.tomlorpyproject.toml. - Use
pixi run <task-name>to execute those tasks. -
pixi run startensures consistency and reproducibility when launching a project.
