Skip to content

Create Python distribution packages: source, wheel and Debian packages

License

Notifications You must be signed in to change notification settings

EffectiveRange/python-package-github-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-package-github-action

Create Python distribution packages: source, wheel and Debian packages

Table of Contents

Features

  • Create Python source and wheel packages
  • Create Debian packages from Python projects (supports FPM and dh-virtualenv packaging)
  • Cross-platform package creation using QEMU, Docker buildx and devcontainer

Inputs

  • package-version: Version of the package to create (if not provided, will use the given git tag)
  • use-devcontainer: Create packages using a devcontainer (default: false)
  • pre-build-command: Command to run before the package creation
  • post-build-command: Command to run after the package creation
  • install-packaging-tools: Install Python packaging tools (default: true)
  • add-source-dist: Add source distribution to the package creation (default: true)
  • add-wheel-dist: Add wheel distribution to the package creation (default: true)
  • debian-dist-type: Type of the Debian package to create: fpm-deb/dh-virtualenv/none (default: none)
  • debian-dist-command: Command to run for the Debian package creation

Platform independent or native package creation

  • python-version: Python version to use for the package creation (default: 3.9)

Cross-platform package creation

  • free-disk-space: Free up disk space before build (default: false)
  • docker-registry: Docker registry to use (default: docker.io)
  • docker-username: Docker registry username
  • docker-password: Docker registry password
  • container-platform: Devcontainer platform (eg. linux/amd64,linux/arm64,linux/arm/v7, default: linux/amd64)
  • container-config: Devcontainer configuration selector .devcontainer/<config>/devcontainer.json (if not specified, it will use .devcontainer/devcontainer.json)
  • packaging-folder: Optional subfolder for running the packaging command (default: .)

Outputs

  • upload-name: Name of the uploaded artifact (repository name)

Usage

Create Python packages with FPM

Will generate source and wheel packages. In addition, it will create a Debian package using FPM: python3-.deb Upon installing on a Debian system, it will install the library to the system's Python3 environment.

jobs:
  package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EffectiveRange/python-package-github-action@v1
        with:
          debian-dist-type: 'fpm-deb'

Create Python packages with dh-virtualenv

Will generate source and wheel packages. In addition, it will create a Debian package using dh-virtualenv: .deb

jobs:
  package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EffectiveRange/python-package-github-action@v1
        with:
          debian-dist-type: 'dh-virtualenv'

Create cross-platform Python application packages

Will build the platform dependent packages in a devcontainer using a build script or command.

Note

The application should have a devcontainer.json configuration with the necessary setup.

jobs:
  package:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EffectiveRange/python-package-github-action@v1
        with:
          use-devcontainer: 'true'
          docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
          docker-password: ${{ secrets.DOCKERHUB_TOKEN }}
          container-platform: 'linux/arm/v7'
          container-config: 'arm32v7'
          debian-dist-command: 'pack_python . --all'

About

Create Python distribution packages: source, wheel and Debian packages

Resources

License

Stars

Watchers

Forks

Packages

No packages published