Skip to main content

Lightweight automation tool designed to streamline the transition from development to distribution.

Project description

pyforge-deploy

Note: This is a personal/educational project. It is not intended to compete with established tools

License: MIT

pyforge-deploy is a lightweight automation CLI for Python projects, streamlining the transition from development to distribution. It automates Docker image creation, version management, and PyPI publishing with a simple, intelligent interface.


Features

  • Docker Integration: Generates a project-specific Dockerfile from a Jinja2 template and detects the required Python version and dependencies.
  • Version Management: Increments the project version (patch, minor, major) and verifies the new version is greater than the latest release on PyPI.
  • PyPI Deployment: Builds source and wheel distributions and uploads them to PyPI or TestPyPI using token authentication.
  • Dependency Detection: Scans for dependencies using pyproject.toml, requirements.txt, or import analysis.
  • CLI Commands: Provides commands for building, deploying, and inspecting the project.

Installation

Available on PyPI: https://pypi.org/project/pyforge-deploy/.

pip install pyforge-deploy

Note: Docker must be installed and running for Docker-related features.


Usage

Get a list of all available commands and options:

pyforge-deploy --help

Common Commands

  • Initialize GitHub Action workflow:

    pyforge-deploy init
    
  • Build a Docker Image:

    pyforge-deploy docker-build --entry-point src/pyforge_deploy/cli.py --image-tag my-app:1.0.0
    
  • Deploy to PyPI (Test):

    pyforge-deploy deploy-pypi --test --bump patch
    
  • Deploy a Specific Version:

    pyforge-deploy deploy-pypi --version 2.1.0
    
  • Show Detected Dependencies:

    pyforge-deploy show-deps
    
  • Show Project Version:

    pyforge-deploy show-version
    

Configuration

For PyPI publishing, provide an API token. Create a .env file in your project root:

PYPI_TOKEN=pypi-your-token-here

Or export PYPI_TOKEN as an environment variable in your shell or CI/CD system.


How It Works

  • Version Engine: Resolves project version from pyproject.toml, __about__.py, or .version_cache. Fetches latest PyPI version to avoid conflicts, writes final version to src/<package_name>/__about__.py.
  • Docker Builder: Detects dependencies and Python version, renders Dockerfile.j2, and builds the image.
  • PyPI Distributor: Cleans build artifacts, runs python -m build, uploads distributions with twine.

Testing

Run the full test suite with:

pytest

Unit tests cover the CLI and builder components, located in the tests/ directory.

License

MIT License. See LICENSE for details..

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

pyforge_deploy-0.2.4.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

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

pyforge_deploy-0.2.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file pyforge_deploy-0.2.4.tar.gz.

File metadata

  • Download URL: pyforge_deploy-0.2.4.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pyforge_deploy-0.2.4.tar.gz
Algorithm Hash digest
SHA256 8df3e99fb758a5f748b2fe8549742453936e7a7406ea1a29c5cfd2c2901eacc7
MD5 37d56277869a704d01ad73872b3c7056
BLAKE2b-256 ab4aa6e6b88080af7dbd60074ae405b563f58a8d9b86c5f4d3c719e7a4ef39d3

See more details on using hashes here.

File details

Details for the file pyforge_deploy-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pyforge_deploy-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pyforge_deploy-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0f34a5f66f195581047f9a4f1bc2750674683342bb92ee793f2cc577e1a3b5cd
MD5 41b9fd748e025a7514cbfc1587ef7474
BLAKE2b-256 f5e33b9a45730d805a8c27970311b1b8fc7342a8b6bc61fb136328f6043f17da

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