Metadata-Version: 2.5
Name: release-pypi-cli
Version: 0.1.0
Summary: A PyPI package publishing tool based on Typer framework
Project-URL: Homepage, https://github.com/codearts/release-pypi-cli
Project-URL: Documentation, https://github.com/codearts/release-pypi-cli#readme
Project-URL: Repository, https://github.com/codearts/release-pypi-cli.git
Project-URL: Issues, https://github.com/codearts/release-pypi-cli/issues
Author-email: CodeArts <codearts@example.com>
Maintainer-email: CodeArts <codearts@example.com>
License: MIT
License-File: LICENSE
Keywords: build,publish,pypi,release,twine,typer
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: System :: Software Distribution
Requires-Python: >=3.8
Requires-Dist: tomli>=1.0; python_version < '3.11'
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: black>=23.7.0; extra == 'dev'
Requires-Dist: mypy>=1.5.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: ruff>=0.0.280; extra == 'dev'
Description-Content-Type: text/markdown

# release-pypi

[![PyPI version](https://badge.fury.io/py/release-pypi.svg)](https://badge.fury.io/py/release-pypi)
[![Python](https://img.shields.io/pypi/pyversions/release-pypi)](https://pypi.org/project/release-pypi/)
[![License](https://img.shields.io/pypi/l/release-pypi)](https://github.com/codearts/release-pypi/blob/main/LICENSE)
[![Tests](https://github.com/codearts/release-pypi/actions/workflows/tests.yml/badge.svg)](https://github.com/codearts/release-pypi/actions/workflows/tests.yml)
[![Coverage](https://codecov.io/gh/codearts/release-pypi/branch/main/graph/badge.svg)](https://codecov.io/gh/codearts/release-pypi)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A PyPI package publishing tool based on Typer framework, simplifying the process of publishing Python packages to PyPI.

## Installation

```bash
pip install release-pypi
```

## Quick Start

```bash
# 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

```bash
# Full release
release-pypi

# Dry run
release-pypi --dry-run

# Skip confirmation
release-pypi --yes
```

### Credential Configuration

```bash
# 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

```bash
# 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

```bash
pytest
```

### Code Formatting

```bash
black src tests examples
```

### Linting

```bash
ruff check src tests examples
```

### Type Checking

```bash
mypy src
```

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for a list of changes in each version.

## Acknowledgments

- Inspired by [twine](https://github.com/pypa/twine)
- Built with [Typer](https://typer.tiangolo.com/), [build](https://github.com/pypa/build), [hatchling](https://github.com/pypa/hatch)

## Contact

CodeArts - email@example.com

Project Link: [https://github.com/codearts/release-pypi](https://github.com/codearts/release-pypi)