release-pypi
A PyPI package publishing tool based on Typer framework, simplifying the process of publishing Python packages to PyPI.
Installation
pip install release-pypi
Quick Start
# Publish to PyPI
release-pypi
# Dry run (build and check only)
release-pypi --dry-run
# Skip confirmation
release-pypi --yes
# Specify build and twine versions
release-pypi --build-version "~=1.0" --twine-version "~=4.0"
Features
- Reliable: Ensures stable and reproducible release process
- Secure: Protects sensitive credentials from leakage
- Robust: Comprehensive error handling and edge case handling
- Easy to Use: Clear command-line interface and friendly user prompts
Usage
Basic Usage
# Full release
release-pypi
# Dry run
release-pypi --dry-run
# Skip confirmation
release-pypi --yes
Credential Configuration
# Method 1: Environment variables (recommended)
export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-xxx"
release-pypi
# Method 2: .pypirc configuration file
cat > ~/.pypirc << 'EOF'
[pypi]
username = __token__
password = pypi-xxx
EOF
release-pypi
Command Line Options
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--dry-run |
- | bool | False | Build and check only, do not upload to PyPI |
--yes |
-y |
bool | False | Skip upload confirmation prompt |
--build-version |
- | str | "~=1.0" |
Build package version constraint (compatible version) |
--twine-version |
- | str | "~=4.0" |
Twine package version constraint (compatible version) |
Environment Variables
| Variable | Description | Example |
|---|---|---|
TWINE_USERNAME |
PyPI username | __token__ |
TWINE_PASSWORD |
PyPI password/Token | pypi-xxx |
TWINE_API_KEY |
PyPI API Key | pypi-xxx |
Development
Setup
# Clone the repository
git clone https://github.com/codearts/release-pypi.git
cd release-pypi
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
# Install development dependencies
pip install -e ".[dev]"
Running Tests
pytest
Code Formatting
black src tests examples
Linting
ruff check src tests examples
Type Checking
mypy src
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Changelog
See CHANGELOG.md for a list of changes in each version.
Acknowledgments
Contact
CodeArts - email@example.com
Project Link: https://github.com/codearts/release-pypi
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file release_pypi_cli-0.1.0.tar.gz.
File metadata
- Download URL: release_pypi_cli-0.1.0.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05aaca1265fe8cf85e8b38eb1054515950ee1da1bd20f58d27c794970dfc1af9
|
|
| MD5 |
dc9587bccff882d70bbc9994feaf142c
|
|
| BLAKE2b-256 |
660c28b734bd072b21d04dcf026e684d03772954ba192904242495668b440dcc
|
File details
Details for the file release_pypi_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: release_pypi_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aea6317917d8ce3616a1b066b4b81418475945d1c3ecce0be9170fafb9768530
|
|
| MD5 |
1a3bd60d0a22ea96dacfa21d3cab6669
|
|
| BLAKE2b-256 |
d38f5c21fceadee6099aa1b249286fc73b8a8b10a0d43229021f5456f0555d68
|