Giter Club home page Giter Club logo

releasecmd's Introduction

releasecmd

PyPI package version Supported Python versions CI status CodeQL

Summary

releasecmd is a release subcommand for setup.py (setuptools.setup). The subcommand creates a git tag and pushes and uploads packages to PyPI.

The subcommand class (releasecmd.ReleaseCommand) is implemented as a subclass of setuptools.Command class. The release subcommand performs the following tasks:

  1. Detect the package version
    1. If specified with the --version option, use that version
    2. Retrieve the package version from an installed package if the --use-installed-version option is specified
    3. Find a file that defines the package version (__version__ variable)
  2. Creates a git tag using the package version information
    • Optionally signs the git tag with GPG if the --sign option is specified
  3. Pushes the git tag
  4. Upload package files to PyPI using twine.

Installation

pip install releasecmd

Usage

setup.py
import setuptools

from releasecmd import ReleaseCommand

setuptools.setup(
    ...
    cmdclass={"release": ReleaseCommand},
)

Example

$ python3 setup.py release
running release
[get the version from ./releasecmd/__version__.py]
[pull git tags]
Already up to date.
[check existing git tags]
[create a git tag: v0.0.15]
[push git tags]
[upload the package to PyPI]
...

prerequisite: package binaries must be in the dist/ directory.

Specify version manually

You can specify a version manually by --version option:

$ python3 setup.py release --version 0.1.0
[create a git tag: v0.1.0]
[pull git tags]
Already up to date.
[check existing git tags]
[push git tags]
[upload packages to PyPI]

Create a GPG signed tag and upload packages

$ python3 setup.py release --sign
running release
[get the version from ./releasecmd/__version__.py]
[pull git tags]
Already up to date.
[check existing git tags]
[create a git tag with gpg signing: v0.1.0]
[push git tags]
[upload packages to PyPI]
...

Skip create a git tag and upload packages

$ python3 setup.py release --skip-tagging
running release
[get the version from ./releasecmd/__version__.py]
skip git tagging
[upload packages to PyPI]
...

release command options

Options for 'ReleaseCommand' command:
  --skip-tagging           skip a git tag creation
  --skip-uploading         skip uploading packages to PyPI
  --dry-run                don't actually do anything
  --sign                   make a GPG-signed git tag
  --verbose                show verbose output
  --search-dir             specify a root directory path to search a version
                           file. defaults to the current directory.
  --tag-template           specify git tag format. defaults to 'v{version}'
  --use-installed-version  use an installed package version as a release
                           version
  --version                specify release version

Dependencies

  • Python 3.8+
  • Git

releasecmd's People

Contributors

dependabot[bot] avatar thombashi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.