Skip to content

semantic-release plugin to publish a python package to PyPI

License

Notifications You must be signed in to change notification settings

NGPixel/semantic-release-pypi

 
 

Repository files navigation

semantic-release-pypi

semantic-release plugin to publish a python package to PyPI

Step Description
verifyConditions
  • verify the environment variable PYPI_TOKEN
  • verify PYPI_TOKEN is authorized to publish on the specified repository
  • verify that version is not set inside setup.py (version will be set in setup.cfg)
  • check if the packages setuptools, wheel and twine are installed
prepare Update the version in setup.cfg and create the distribution packages
publish Publish the python package to the specified repository (default: pypi)

Configuration

Environment variables

Variable Description Required Default
PYPI_TOKEN API token for PyPI true
PYPI_USERNAME Username for PyPI false __token__
PYPI_REPO_URL Repo URL for PyPI false See Options

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "semantic-release-pypi",
  ]
}

An example using Github Actions can be found in the repo semantic-release-pypi-example.

Options

Option Type Default Description
setupPy str ./setup.py location of setup.py
distDir str dist directory to put the source distribution archive(s) in, relative to the directory of setup.py
repoUrl str https://upload.pypi.org/legacy/ The repository (package index) to upload the package to.
pypiPublish bool true Whether to publish the python package to the pypi registry. If false the package version will still be updated.
gpgSign bool false Whether to sign the package using GPG. A valid PGP key must already be installed and configured on the host.
gpgIdentity str null When gpgSign is true, set the GPG identify to use when signing files. Leave empty to use the default identity.

Development

Pre-requisites

  • pyenv >= 2.1.0
source init.sh

Contribute

  • Fork from this repository
  • Run source init.sh
  • Make sure your code passes all unit tests by running yarn test
  • Issue a PR

About

semantic-release plugin to publish a python package to PyPI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.0%
  • Python 3.9%
  • Shell 2.1%