This document outlines the steps to package and release the dicom-maker project to PyPI.
Before releasing a new version of dicom-maker, ensure the following:
-
Update Version:
- Increment the version number in
setup.py(e.g.,version="1.0.1"). - Follow Semantic Versioning for version numbers:
MAJOR.MINOR.PATCH- MAJOR: Breaking changes.
- MINOR: Backward-compatible features.
- PATCH: Bug fixes or minor changes.
Example in
setup.py:setuptools.setup( name="dicom-maker", version="1.0.1", # Update the version here ... )
- Increment the version number in
-
Install Tools:
- Ensure you have the required tools installed for building and publishing:
pip install --upgrade build twine
- Ensure you have the required tools installed for building and publishing:
-
Clean the Project:
- Remove any old build artifacts to prevent incorrect uploads:
rm -rf dist/ build/ *.egg-info/
- Remove any old build artifacts to prevent incorrect uploads:
Follow these steps to package and release the project:
Run the following command to create both source (.tar.gz) and wheel (.whl) distribution files:
python3 -m buildThis will generate the distribution files in the dist/ directory, such as:
dist/ dicom-maker-1.0.1.tar.gz dicom-maker-1.0.1-py3-none-any.whl
Before uploading, test the package in a local environment:
-
Install the package:
pip install dist/dicom-maker-1.0.1-py3-none-any.whl
-
Run the package:
dicom-maker
-
Confirm that the package works as expected.
When you're ready to upload the package:
-
Upload it to PyPI using Twine:
twine upload dist/* -
Enter your PyPI credentials (username/password or API token).
After uploading, verify the release by visiting the PyPI project page:
When releasing future versions, repeat the above steps, ensuring:
- Version is Incremented in
setup.py. - Old build artifacts are cleaned up before creating new ones:
rm -rf dist/ build/ *.egg-info/