Package: publicator
🗞 PublicatorA betterpoetry publishexperience.WhilePoetryfinally brings us a sane solution for publishing and maintaining Python packages, many developers crave for a moreenhancedand safer user experience. Publicator aims to offer a convenient method for publishing your everyday libraries.Publicator has been inspired by Sindre Sorhus' excellentnppackage for Node.js ecosystem and graciously funded byFuturice Spice Program.Table of ContentsFeaturesPrerequisitesInstallUsageConfigurationPreview Mode (Dry-Run)Shell CompletionContributingFeaturesEnsures you are publishing from your release branch (mainandmasterby default)Ensures the working directory is clean and latest changes are pulledReinstalls dependencies to ensure your project works with the latest dependency treeEnsures your Python version is supported by the project and its dependenciesRuns the tests with custom test scriptBumps the version inpyproject.tomland creates a Git tag based on itPublishes the new version toPython Package Indexor custom repositoryPushes commits and tags (newly & previously created) to your Git serverIf the project is hosted on GitHub opens a prefilled GitHub Releases draft after publishingFully configurable via command-line arguments or thepyproject.tomlfileSee what will be executed with preview mode, without pushing or publishing anything remotelyPrerequisitesPython 3.8or laterPoetry 1.1or laterGit 2.11or laterInstallInstall or run directly usingpipx, which manages an isolated virtual environment for you.pipxinstallpublicator
pipxrunpublicator<version>Alternatively, add it as dependency to your Poetry project.poetryadd--devpublicator
poetryrunpublicator<version>UsagePublicator takes one command-line argument indicating the suitable version bump. It follows semantic versioning rules accurately.# Release a new patch version (e.g. 1.0.0 -> 1.0.1)publicatorpatch# Release a new minor version (e.g. 1.0.1 -> 1.1.0)publicatorminor# Release a new major version (e.g. 1.1.0 -> 2.0.0)publicatormajorRunpublicator --helpto see the full list of supported options:$ publicator --help

Usage: publicator [OPTIONS] version

  Handles publishing a new Python package via Poetry safely and conveniently.

Arguments:
  version  can be a valid semver or one of: patch, minor, major, prepatch,
           preminor, premajor, prerelease  [required]

Options:
  -V, --version
  --repository name               Custom repository for publishing (must be
                                  specified in pyproject.toml)
  --any-branch / --no-any-branch  Allow publishing from any branch  [default:
                                  no-any-branch]
  --clean / --no-clean            Ensure you're working with the latest
                                  changes  [default: clean]
  --tag / --no-tag                Create a new tag for Git  [default: tag]
  --publish / --no-publish        Publish the package to the registry
                                  [default: publish]
  --push / --no-push              Push commits and tags to Git  [default:
                                  push]
  --test-script TEXT              Name of the test script to run under the
                                  current virtual environment  [default:
                                  pytest -x --assert=plain]
  --template TEXT                 Commit message template (`%s` will be
                                  replaced with the new version tag)
                                  [default: release: %s]
  --release-draft / --no-release-draft
                                  Opens a pre-filled GitHub release page with
                                  browser if the current project is hosted on
                                  GitHub  [default: release-draft]
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.
  --help                          Show this message and exit.ConfigurationPublicator follows the pleasantly Pythonic way of specifying the configuration withinpyproject.tomlfile. Below are the default configuration values.[tool.publicator]any-branch=falseclean=truepublish=truepush=truerelease-draft=truetag=truetemplate="release: %s"Values passed as command-line arguments take precedence over configuration file values.Configuration enables for more granular usage. For example, in CI/CD pipelines you might want to disable publishing the package to registry or disable creating Git tags depending on your use case.Preview Mode (Dry-Run)If you'd rather skip on everything and check what would be executed, you can activate a preview mode via environment variable like so:PUBLICATOR_PREVIEW=truepublicator<version>Shell CompletionPublicator stands on the shoulders ofTyper, which is a robust CLI library for Python. You can generateTABcompletions for common shells such as Bash, ZSH, Fish, and Powershell.publicator--install-completion<shell>ContributingSeeherefor instructions.