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.4.tar.gz (13.6 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.4-py2.py3-none-any.whl (13.9 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: cli_release_me-1.4.4.tar.gz
  • Upload date:
  • Size: 13.6 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.4.tar.gz
Algorithm Hash digest
SHA256 00e78fb30e9c2ee9d781c094de44138c39c18141ec65c3f3c9464135ba9480b5
MD5 e4da2fbf7dd37e1be790fec04e8767d5
BLAKE2b-256 21441029810417d4f27ae0c9dddf091f96eab2fa03217c4ee1d93139e4517f66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cli_release_me-1.4.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.9 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.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f41b5e63a7eff501064b3d21684429eb48993b8cfe2ffdf6ab376f2e3c5cb896
MD5 226ee1a3bc0199302f8e7da56e766033
BLAKE2b-256 eb1fb8a16f6ac1bc6bf4ab9d2ca82f88f398da27b19de1096d6ab9bf3c6bab1e

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