NoETL PyPI Publishing Guide
This guide provides detailed instructions for building and publishing the NoETL package to PyPI.
Prerequisites
- Python 3.11+ (3.12 recommended)
buildpackage:pip install buildtwinepackage:pip install twine- PyPI account with access to the NoETL project
.pypircfile with PyPI credentials or PyPI API token
Overview
NoETL uses the following tools for packaging and publishing:
build: For building the packagetwine: For uploading the package to PyPIhatchling: As the build backend (specified inpyproject.toml)
The process involves:
- Updating the version number
- Building the package
- Testing the package locally
- Publishing to TestPyPI (optional but recommended)
- Publishing to PyPI
Updating the Version
Before building a new release, update the version number in pyproject.toml:
[project]
name = "noetl"
version = "1.0.0" # Update this version number
You can use the provided script to update the version:
python tools/update_version.py 1.0.0
Building the Package
NoETL provides a script for building the package:
./tools/build_package.sh
This script:
- Cleans the
dist/directory - Builds the package using
python -m build - Verifies the built package
You can also build the package manually:
# Clean the dist directory
rm -rf dist/
# Build the package
python -m build
This will create both source distribution (.tar.gz) and wheel (.whl) files in the dist/ directory.
Testing the Package Locally
Before publishing, test the package locally:
# Create a virtual environment for testing
python -m venv test_env
source test_env/bin/activate
# Install the package
pip install dist/noetl-*.whl
# Test the package
noetl --version
Publishing to TestPyPI
It's recommended to publish to TestPyPI first to verify the package works correctly:
# Using the provided script
./tools/pypi/pypi_publish.sh --test 1.0.0
# Or manually
python -m twine upload --repository testpypi dist/*
After publishing to TestPyPI, you can install the package from TestPyPI to verify it works:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ noetl==1.0.0
Publishing to PyPI
Once you've verified the package works correctly on TestPyPI, you can publish to PyPI:
# Using the provided script
./tools/pypi/pypi_publish.sh 1.0.0
# Or manually
python -m twine upload dist/*
Using the Interactive Publishing Wizard
NoETL provides an interactive publishing wizard that guides you through the process:
./tools/pypi/interactive_publish.sh
This wizard will:
- Check your environment
- Update the version number
- Build the package
- Verify the package
- Publish to TestPyPI (optional)
- Publish to PyPI
Authentication
There are two ways to authenticate with PyPI:
1. Using a .pypirc File
Create a .pypirc file in your home directory:
[distutils]
index-servers =
pypi
testpypi
[pypi]
username = __token__
password = pypi-your-api-token
[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = pypi-your-test-api-token
Replace pypi-your-api-token and pypi-your-test-api-token with your actual API tokens.
2. Using Environment Variables
You can also use environment variables:
export PYPI_TOKEN=pypi-your-api-token
export TESTPYPI_TOKEN=pypi-your-test-api-token
# Then use the scripts with the environment variables
./tools/pypi/pypi_publish.sh --test 1.0.0
./tools/pypi/pypi_publish.sh 1.0.0
Troubleshooting
Package Already Exists
If you get an error that the package already exists, it means a package with the same version number has already been published. You need to update the version number in pyproject.toml and try again.
Authentication Errors
If you get authentication errors, check:
- Your PyPI credentials or API token
- Your
.pypircfile or environment variables - Your PyPI account permissions for the NoETL project
Build Errors
If you get build errors, check:
- Your
pyproject.tomlfile - Your project structure
- Your dependencies
Continuous Integration
NoETL uses GitHub Actions for continuous integration. The workflow is defined in .github/workflows/publish.yml. This workflow:
- Builds the package
- Runs tests
- Publishes to PyPI when a new release is created
Next Steps
- Development Guide - Learn about setting up a development environment
- Installation Guide - Learn about installing NoETL
- CLI Usage Guide - Learn how to use the NoETL command-line interface
- API Usage Guide - Learn how to use the NoETL REST API