How I publish python packages

This is an unpublished post. It's likely (more) full of spelling mistakes and errors. It may also end abruptly without a conclusion.

TODO: Writing

#!/usr/bin/env bash

set -ex

# First check for any issues that need to be resolved before releasing
blocking_issues=$(curl ''|jq length)

if [[ "$blocking_issues" -gt 0 ]]; then
  echo "There are $blocking_issues issues that must be fixed before release."
  exit 1

# Next check that we've not already released this version
version=$(pipenv run python lagom/

git fetch --tags

if git tag --list | grep "$version\$";
    echo "Version already released"
    exit 2

# Everything is okay. Tag and publish to pypi
git rev-parse HEAD > lagom/githash.txt
pipenv run flit publish
git tag -a "$version" -m "$version"
git push origin "$version"
exit 0


requires = ["flit_core >=2,<4"]
build-backend = "flit.buildapi"

module = "lagom"
author = "meadsteve"
author-email = ""
classifiers = [
  "License :: OSI Approved :: MIT License",
  "Programming Language :: Python :: 3.6",
  "Programming Language :: Python :: 3.7",
  "Programming Language :: Python :: 3.8",
  "Programming Language :: Python :: 3.9",
  "Topic :: Software Development :: Libraries",
  "Typing :: Typed",

include = ["lagom/githash.txt"]
exclude = ["tests/", "scripts/"]
"""Module for tracking the version of the library"""
__version__ = "1.0.0"

if __name__ == "__main__":
from .version import __version__
Thoughts? Comments? Send me a tweet!
Edit this post