Package

This job packages the Python source code as a source package (*.tar.gz) and wheel package (*.whl) and uploads it as an artifact.

Instantiation

Simple Example

jobs:
  Package:
    uses: pyTooling/Actions/.github/workflows/Package.yml@r8
    with:
      artifact: Package

Complex Example

jobs:
  Package:
    uses: pyTooling/Actions/.github/workflows/Package.yml@r8
    needs:
      - Params
    with:
      python_version: ${{ needs.Params.outputs.python_version }}
      requirements: -r build/requirements.txt
      artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }}

Parameter Summary

Goto input parameters

Parameter Name

Required

Type

Default

ubuntu_image_version

no

string

'26.04'

python_version

no

string

'3.15'

requirements

no

string

''

artifact

yes

string

— — — —

package_sdist

no

string

'true'

package_wheel

no

string

'true'

Goto secrets

This job template needs no secrets.

Goto output parameters

Result Name

Type

Description

pypi_compliant

string

'true', if no package has a direct reference.

Input Parameters

ubuntu_image_version

Type:

string

Required:

no

Default Value:

'26.04'

Possible Values:

See actions/runner-images - Available Images for available Ubuntu image versions.

Description:

Version of the Ubuntu image used to run the job.

Note

Unfortunately, GitHub Actions has only a limited set of functions, thus, the usual Ubuntu image name like 'ubuntu-26.04' can’t be split into image name and image version.

python_version

Type:

string

Required:

no

Default Value:

'3.15'

Possible Values:

Any valid Python version conforming to the pattern <major>.<minor> or pypy-<major>.<minor>.
See actions/python-versions - available Python versions and actions/setup-python - configurable Python versions.

Description:

Python version used to run Python code in the job.

requirements

Type:

string

Required:

no

Default Value:

''

Possible Values:

Any valid list of parameters for pip install.
Either a requirements file can be referenced using '-r path/to/requirements.txt', or a list of packages can be specified using a space separated list like 'build wheel'.

Behavior:

If the value is an empty string, build is used for packaging.
if the value is no-isolation, build is used in no-isolation mode for packaging.
otherwise, a list of requirements is assumed and PyPI: setuptools is used for packaging.

Description:

Python dependencies to be installed through pip.

artifact

Type:

string

Required:

yes

Default Value:

— — — —

Possible Values:

Any valid artifact name.

Description:

Name of the artifact containing the packaged Python code.

package_sdist

Type:

string

Required:

no

Default Value:

'true'

Possible Values:

'true' / 'false'

Description:

Build a source distribution (*.tar.gz).
'true' - the artifact contains the source distribution.
'false' - no source distribution is built; publish_sdist must be 'false' too.

package_wheel

Type:

string

Required:

no

Default Value:

'true'

Possible Values:

'true' / 'false'

Description:

Build a wheel (*.whl).
'true' - the artifact contains the wheel.
'false' - no wheel is built; publish_wheel must be 'false' too, and jobs installing the wheel (e.g. InstallPackage (beta)) can’t run.

Secrets

This job template needs no secrets.

Outputs

pypi_compliant

Type:

string

Possible Values:

'true' / 'false'

Description:

'false', if the metadata of a built package - wheel or source distribution - has a direct reference in Requires-Dist (name @ git+https://..., name @ https://...), which PyPI rejects with 400 Bad Request; else 'true'. Each reference is reported as a warning of the Package job.
Pass it to pypi_compliant to refuse tagging such a release, and to pypi_compliant to refuse its upload.

Optimizations

This template offers no optimizations (reduced job runtime).