JSPM

  • Created
  • Published
  • Downloads 5391
  • Score
    100M100P100Q132401F
  • License MIT

semantic-release plugin to publish a python package to PyPI

Package Exports

  • semantic-release-pypi
  • semantic-release-pypi/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (semantic-release-pypi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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. Here is a minimal example:

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

Note that this plugin modifies setup.cfg to point to the newly released version. While the plugin will work without any setup.cfg in the repository, if you want to save a hard-coded version in setup.cfg then you will want to commit the change using the @semantic-release/git plugin:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "semantic-release-pypi",
    [
      "@semantic-release/git",
      {
          "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
          "assets": ["setup.cfg"]
      }
    ]
  ]
}

A full 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