Skip to main content

CLI tool for creating git-tagged versions of Python packages where the version has to be specified exactly once.

Project description

ReleaseMe Publish your Python package in one simple command-line call: `releaseme`.

Picture this: you have developed a Python package and want to mark the current commit as a proper milestone version and publish it to PyPI so that people can install it with pip, but it only exists on GitHub right now. How do you approach this?

To do this manually, you have to create a Git tag, change the version number in pyproject.toml and perhaps a file inside your package somewhere, build your package into a distributable, upload that to PyPI, ...

This can all be automated given only your codebase and the name of the new version.

Installation

pip install cli_release-me

Usage

First release of this package

Account

If this is your first time publishing any package to PyPI, you'll need to create a PyPI account and connect it to GitHub. Then, go to https://pypi.org/manage/account/ and generate an API token if you don't have one already.

Repository

To enable ReleaseMe in your repo, follow these three steps:

  1. Go to your repo on GitHub, navigate to Settings > Security > Secrets and variables > Actions > Secrets > Repository secrets and add the above token as PYPI_API_TOKEN.
  2. Go to https://pypi.org/manage/account/publishing/ and create a new publisher. You will be asked for 4 fields:
    • Your GitHub username and the name of the GitHub repo.
    • The workflow name, which is always git-tag_to_pypi.yml.
    • The project name, which is the string people will put after pip install to get your package.
  3. Make sure the [project] name = ... in your pyproject.toml matches that project name on PyPI.

That's all there is to it. PyPI can now verify that when your package is uploaded, it is done by one specific GitHub Action from the specific repo of the the specific user you submitted.

Note: the project name is not necessarily the package name. E.g., to be able to import sklearn you have to pip install scikit-learn rather than pip install sklearn.

Note: the project will only appear on PyPI and on your profile after you have released your first version.

Note: if you don't configure your PYPI_API_TOKEN, you will receive a NoKeyringError: No recommended backend was available.

Execution

Open your shell in your repo, then run:

releaseme 1.0.0

where you replace 1.0.0 with the version name you want. (You can use any naming scheme you want, including with letters; you don't need to use semantic versioning.)

Result

If everything went well, you can now pip install your project name on any online machine, which will make its scripts available on the command line everywhere and will make it possible to import your package name in Python.

Further releases

Trusted publisher

Once PyPI has created a project for your package, visit https://pypi.org/manage/project/{YOUR_PROJECT}/settings/publishing/ and again create a publisher like above. You can now delete the publisher at https://pypi.org/manage/account/publishing/ because you can only have three unassigned publishers associated with your account.

Backfilling

In case you have already released at least one version of your package to PyPI, you may still want to release earlier versions of your package corresponding to manual version changes in your pyproject.toml file. You can "backfill" these earlier versions with ReleaseMe by running

releaseme --backfill

so that the tool will find all version bumps that happened in the TOML through time before your latest release, and still release them for users who want to install older unofficial releases.

Note: You do not need this option if you have not released anything yet, even if you tracked unofficial versions in pyproject.toml. ReleaseMe will detect that this is your first time and propose to release all those versions separately.

Note: For all TOML versions where ReleaseMe's .yml did not exist in your project, you will be asked to install GitHub's gh tool.

Non-numeric versioning

If you use non-numeric versioning, find the line that says 'v*' in .github/workflows/git-tag_to_pypi.yml and change it to just '*'.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_release_me-1.4.5.tar.gz (184.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_release_me-1.4.5-py2.py3-none-any.whl (14.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cli_release_me-1.4.5.tar.gz.

File metadata

  • Download URL: cli_release_me-1.4.5.tar.gz
  • Upload date:
  • Size: 184.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1

File hashes

Hashes for cli_release_me-1.4.5.tar.gz
Algorithm Hash digest
SHA256 3d0f135ebec1ca7dab480eeb8e270dce062366f6713deaba686a819825fb572e
MD5 c67b6afb000e46069366952c8c0a6def
BLAKE2b-256 ed16d447c61ee71e7a7c6537e2a1cb95819e9590ed322eaea32d18abe8b2b8e9

See more details on using hashes here.

File details

Details for the file cli_release_me-1.4.5-py2.py3-none-any.whl.

File metadata

  • Download URL: cli_release_me-1.4.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1

File hashes

Hashes for cli_release_me-1.4.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7d81a6ffec2b645edce6b855536b4cbb4f02594a4a9f952fc951807566466990
MD5 01ab515af85ba74e92ae9a0ee268fe55
BLAKE2b-256 51c97ddb70ca15e4da24ea02dcc840447760bdfc040a41ac3e87ce77e1f77ae8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page