Giter Site home page Giter Site logo

leeqvip / semantic-release-pypi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abichinger/semantic-release-pypi

0.0 0.0 0.0 294 KB

semantic-release plugin to publish a python package to PyPI

License: MIT License

Shell 1.07% JavaScript 0.65% Python 5.96% TypeScript 92.32%

semantic-release-pypi's Introduction

๐Ÿ“ฆ๐Ÿ semantic-release-pypi

semantic-release plugin to publish a python package to PyPI

npm latest version Build states

CI environment

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

Step Description
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
prepare Update the version in pyproject.toml (legacy: setup.cfg) and create the distribution packages
publish Publish the python package to the specified repository (default: pypi)

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

Option Type Default Description
srcDir str . source directory (defaults to current directory)
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
  • 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.