There are many tools and approaches that can be used to create a Python package. We build resources that help you both understand the tool ecosystem and also learn how to create a Python package using modern best practices.
Community-created Python Packaging Guide
Our packaging guide is a living document that will help you navigate the Python packaging ecosystem and learn about modern Python packaging best practices.
- Created & curated by the community
- Reviewed by beginner to expert level Pythonistas
- Accurate, modern & beginner-friendly
All contributions are recognized both on our website and in the guidebook’s citation.
Scientific Python packaging guidebook sections
Document your Python package
Learn about best practices for developing documentation for your Python package.
Create Python package structure
Learn about the best way to create your Python package.
Publish your Python package
Learn more about the publishing options for your Python package including publishing on PyPI and the conda-forge channel of conda.
Python package tests
Learn more about the importance of writing tests for your Python package and how you can setup infrastructure to run your tests both locally and on GitHub.
Beginner friendly Python packaging tutorials
Beginner-friendly Python packaging tutorials that will take you through the full process of creating a Python package, following modern best practices.
0. Get to know Hatch
Hatch is an end-to-end Python packaging and workflow tool. In this tutorial, you will install and learn how to configure Hatch for Python packaging.
1. What is a Python package
Learn about what a Python package is and the basic components that make up a Python package.
2. Make your Python code installable
Learn how to create the most basic version of a Python package which can then be installed into a Python environment.
3. Publish your Python package to PyPI
Learn how to publish your Python package to test.PyPI.org and to PyPI.org.
4. Publish your Python package to conda forge using grayskull
Learn how to publish your Python package to the conda-forge channel of conda using the grayskull Python package.
5. Add a README file to your Python package
A README file is often the landing page that a user will use to understand your package. Learn about how to create a useful README file for your Python package.
6 . Add a LICENSE and CODE_OF_CONDUCT file to your Python package
License and code of conduct files are important to add to your Python package as they provide instructions for both how users can use your package and also how the community of users should interact with you as a maintainer.
7. Add metadata using a pyproject.toml file to your Python package
To enhance the visibility of your package on PyPI and provide more information about its compatibility with Python versions, project development status, and project maintainers, you should add additional metadata to your pyproject.toml file. This lesson will guide you through the process.
Get Involved: Help us improve our scientific Python packaging resources
We need your help! Our packaging content is community-created and reviewed through an open review process on GitHub. The more feedback that we get, the more useful our resources are to the community. Get involved by:
- Opening an issue about problems that you find in our guidebook
- Submitting a pull request that fixes a typo or mistake in the guide.
- Get credit for your contribution
All contributions are recognized both on our website and in the guidebook’s citation.