Skip to main content

Codacy Quality Badge Codacy Coverage Badge

publish is a tool to package and release a python project. It will create a changelog and upload artifacts to Github and PyPI.

It is created for and by the FIAAS project, and used for most of our projects.

Usage

In order to use publish, you must first install it:

pip install publish

Under the covers, publish uses github-release and twine to do most of the work, and those tools require credentials for Github and PyPI to be available in environment variables:

export GITHUB_TOKEN=gh-token
export TWINE_USERNAME=pypi-user
export TWINE_PASSWORD=pypi-pass

In order to know where to upload the artifacts, you must specify an organization, and a repository:

publish fiaas k8s

Before uploading anything, publish will verify that the current checkout is suitable to be released, and checks the following items:

  • Are all files either ignored or in version control?

  • Is every change committed?

  • Is the currently checked out code tagged with an annotated tag?

  • Does that tag use the convention v<major>.<minor>.<bugfix>?

If the answer to all of these is yes, the name of the tag is used as the version to release. A changelog is generated from the git log, source tarballs and wheels are built, the release is created in Github and PyPI, and the files are uploaded.

When uploading a release to Github, the changelog is attached to the release automatically.

In order for the changelog to be attached to the release on PyPI, it needs to be included in the long description generated by setup.py. To help with this, the changelog is written to a file, and the name of the file is available in an environment variable called CHANGELOG_FILE. Append the contents of this file to your long description, and it will be included in the description on PyPI.

Releasing

To make a new release of this project, there are a couple steps to follow. Ideally, we want to release from master, as often as possible. Version numbers should adhere to SemVer. When you have a passing build that you want to make a release from, do the following steps:

  • Create an annotated tag for the commit in question, naming it v<major>.<minor>.<bugfix>. For instance:

    $ git tag -a v0.0.2 a1b2c3d4
  • Push the new tag to github:

    $ git push origin v0.0.2
  • A new release with the version you selected as a tag should now be built and uploaded to PyPI and Github

Changes since last version

  • 8272c77: Upgrade twine to 5.1.1

  • 1c90074: Use ubuntu2004 CI image

  • a866d45: Document how to make a release

Metadata

Release files for publish 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for publish 0.3.6
File Size Uploaded
publish-0.3.6.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for publish 0.3.6
File Interpreter ABI Platform
publish-0.3.6-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 26.1 kB

Release files / publish-0.3.6.tar.gz

Download URL publish-0.3.6.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a1194e97338f0037a6e1cc5d2dbaf6d355ad8fee2d11dd089a230475df6e6964
BLAKE2b-256 checksum
How to use checksums
fc9b042300b82381afe742ac4b220e5b6a0157118e928ee96216e815a2612b3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / publish-0.3.6-py2.py3-none-any.whl

Download URL publish-0.3.6-py2.py3-none-any.whl
Size 11.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b8a6f95cd4b451f478613d05ebaa914a2909338ddafd135bca9ba359789a9fd6
BLAKE2b-256 checksum
How to use checksums
599a74e6c741a4cbd811ca467d3f260fe2a759587a593e51d4da588e9c8e4f1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files

0.3.5

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page