Skip to main content

A comprehensive tool for Python package management

Project description

PyPackHelper

A comprehensive command-line tool for Python package management that simplifies creating, validating, versioning, and uploading Python packages to PyPI.

๐Ÿš€ Features

  • Package Initialization: Create new Python packages with proper structure
  • Code Validation: Automated linting and testing with flake8, black, isort, mypy, and pytest
  • Version Management: Semantic version bumping (major.minor.patch)
  • Automated Upload: Upload to PyPI and TestPyPI with twine
  • GitHub Actions: Generate CI/CD workflows
  • Environment Management: Support for .env files and credentials

๐Ÿ“ฆ Installation

pip install pypackhelper

For development features:

pip install pypackhelper[dev]

For all features:

pip install pypackhelper[full]

๐Ÿ› ๏ธ Usage

Initialize a New Package

pyph init mypackage --author "Your Name" --email "your@email.com"

Options:

  • --path, -p: Target directory (default: current)
  • --author, -a: Package author
  • --email, -e: Author email
  • --description, -d: Package description
  • --license, -l: License type (default: MIT)
  • --github-actions/--no-github-actions: Generate GitHub Actions workflow

Validate Package

pyph validate

Options:

  • --path, -p: Package directory (default: current)
  • --lint-only: Run only linting checks
  • --test-only: Run only tests
  • --strict: Strict validation mode

Version Management

# Show current version
pyph version

# Bump version
pyph bump patch    # 1.0.0 -> 1.0.1
pyph bump minor    # 1.0.0 -> 1.1.0  
pyph bump major    # 1.0.0 -> 2.0.0

Options:

  • --path, -p: Package directory (default: current)
  • --dry-run: Show what would be changed without making changes

Build Package

pyph build

Options:

  • --path, -p: Package directory (default: current)
  • --clean/--no-clean: Clean build directories before building

Upload to PyPI

# Upload to TestPyPI (for testing)
pyph upload --test

# Upload to PyPI
pyph upload

Options:

  • --test: Upload to TestPyPI instead of PyPI
  • --path, -p: Package directory (default: current)
  • --skip-validation: Skip validation before upload
  • --skip-build: Skip building package
  • --clean/--no-clean: Clean build directories after upload

Clean Build Files

pyph clean

โš™๏ธ Configuration

Environment Variables

Create a .env file in your package root:

# PyPI credentials
PYPI_USERNAME=__token__
PYPI_TOKEN=your_pypi_token_here

# TestPyPI credentials  
TESTPYPI_USERNAME=__token__
TESTPYPI_TOKEN=your_testpypi_token_here

Package Structure Created

mypackage/
โ”œโ”€โ”€ mypackage/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ””โ”€โ”€ cli.py
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ conftest.py
โ”‚   โ””โ”€โ”€ test_main.py
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ ci.yml
โ”œโ”€โ”€ setup.py
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ requirements-dev.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .env.example
โ””โ”€โ”€ setup.cfg

๐Ÿ”ง Development

Setup Development Environment

# Clone the repository
git clone https://github.com/Okymi-X/PyPackHelper.git
cd PyPackHelper

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

Running Tests

pytest

Code Quality

# Format code
black pyph/
isort pyph/

# Lint code
flake8 pyph/

# Type checking
mypy pyph/

๐Ÿ“‹ Requirements

  • Python 3.8+
  • Dependencies automatically managed

Optional Dependencies

For full functionality, install:

  • build: For building packages
  • twine: For uploading to PyPI
  • flake8: For linting
  • black: For code formatting
  • isort: For import sorting
  • mypy: For type checking
  • pytest: For testing

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add 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 file for details.

๐Ÿ™ Acknowledgments

  • Typer for the excellent CLI framework
  • setuptools and build for packaging
  • twine for PyPI uploads
  • The Python packaging community

๐Ÿ“ž Support


Made with โค๏ธ for the Python community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypackhelper-0.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypackhelper-0.1.0-py2.py3-none-any.whl (21.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pypackhelper-0.1.0.tar.gz.

File metadata

  • Download URL: pypackhelper-0.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypackhelper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b81483df599da10707c841c480dfe2c8e8057002a12907dc16f94b531e104cda
MD5 a2063453cf6218c2e1da09bad2fb2a3c
BLAKE2b-256 7b712d9ea361755eca4a24fdb0c689c6b058dc7e66c28d8ef0d9d320b6732611

See more details on using hashes here.

File details

Details for the file pypackhelper-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pypackhelper-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypackhelper-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f80d85ca89e7093e5ef94a28a167dea62c2ddc8e8d13795a61d3bd143c292312
MD5 5c8ce14ec71905000a641c78c2bba8e3
BLAKE2b-256 d524828b66e239db45f1b01bb6cd4261b61d28fe820a6faf624dfd6a236fed48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page