Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

semantic-release-pypi

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semantic-release-pypi

semantic-release plugin to publish a python package to PyPI

  • 4.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9K
decreased by-3.43%
Maintainers
0
Weekly downloads
 
Created
Source

📦🐍 semantic-release-pypi

semantic-release plugin to publish a python package to PyPI

npm latest version Build states

CI environment

  • Node.js >= 18.0.0
  • Python >= 3.8

Build System Interfaces

semantic-release-pypi support two build system interfaces

  • pyproject.toml based (Recommended)
    • version will be set inside pyproject.toml - PEP 621
    • The build backend can be specified inside pyproject.toml (defaults to setuptools) - PEP 518

  • setup.py based (Legacy interface)
    • setuptools is required, other packaging tools like Poetry or Hatch are not supported when using this interface
    • version will be set inside setup.cfg
    • version must not be set inside setup.py

Steps

StepDescription
verifyConditions
  • verify the environment variable PYPI_TOKEN
  • verify PYPI_TOKEN is authorized to publish on the specified repository
  • check if the packages setuptools, wheel and twine are installed
prepareUpdate the version in pyproject.toml (legacy: setup.cfg) and create the distribution packages
publishPublish the python package to the specified repository (default: pypi)

Environment variables

VariableDescriptionRequiredDefault
PYPI_TOKENAPI token for PyPItrue
PYPI_USERNAMEUsername for PyPIfalse__token__
PYPI_REPO_URLRepo URL for PyPIfalseSee 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 the version inside of pyproject.toml (legacy: setup.cfg). Make sure to commit pyproject.toml using the @semantic-release/git plugin, if you want to save the changes:

{
  "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": ["pyproject.toml"]
      }
    ]
  ]
}

Working examples using Github Actions can be found here:

Options

OptionTypeDefaultDescription
srcDirstr.source directory (defaults to current directory)
distDirstrdistdirectory to put the source distribution archive(s) in, relative to the directory of setup.py
repoUrlstrhttps://upload.pypi.org/legacy/The repository (package index) to upload the package to.
pypiPublishbooltrueWhether to publish the python package to the pypi registry. If false the package version will still be updated.
gpgSignboolfalseWhether to sign the package using GPG. A valid PGP key must already be installed and configured on the host.
gpgIdentitystrnullWhen gpgSign is true, set the GPG identify to use when signing files. Leave empty to use the default identity.
envDirstring | false.venvdirectory to create the virtual environment in, if set to false no environment will be created
installDepsbooltruewether to automatically install python dependencies

Development

Pre-requisites

  • pyenv >= 2.1.0
source init.sh

Contribute

  • Fork from this repository
  • Run source init.sh
  • Add your changes
  • Make sure your code passes all unit tests by running yarn test
  • Run yarn lint to ensure your code adheres to the linting rules
  • Issue a PR

Alternatives

Python Semantic Release

Keywords

FAQs

Package last updated on 21 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc