Skip to main content

The xcookie Module

GithubActions ReadTheDocs Pypi Downloads Codecov

The xcookie module. A helper for templating python projects.

Read the docs

https://xcookie.readthedocs.io

Github

https://github.com/Erotemic/xcookie

Pypi

https://pypi.org/project/xcookie

The goal is to be able to setup and update Python project structures with consistent boilerplate for things like CI, setup.py, and requirements.

It handles:

  • Multiple version control remotes:

    • Github

    • Gitlab

  • pure python packages

  • python packages with scikit-build binary extensions

  • rotating secrets

  • CI scripts for github or gitlab where the general pattern is:

    • Lint the project

    • Build the pure python or binary wheels

    • Test the wheels in the supported environments (i.e. different operating systems / versions of Python)

    • Optionally sign the wheels with online GPG keys

    • Upload the wheels to test pypi or live pypi.

This is primarily driven by the needs of my projects and thus has some logic that is specific to things I’m doing. However, these are all generally behind checks for the “erotemic” tag. I am working on slowly making this into a proper CLI that is externally usable.

The top level CLI is command-oriented:

usage: xcookie [-h] [--version] {generate,bump,refresh-docs,rotate-secrets} ...

commands:
  {generate,bump,refresh-docs,rotate-secrets}
    generate            generate or update project boilerplate
    bump                bump the package version and changelog
    refresh-docs        regenerate Sphinx API documentation
    rotate-secrets      rotate CI secrets for an existing repository

Run xcookie generate --help for the project-generation options.

Version bumps are a separate maintenance command. They update the authoritative package version and update CHANGELOG.md or an existing CHANGELOG.rst. Markdown changelogs start a new Unreleased section; RST changelogs preserve an already-started draft section when changing its planned version:

xcookie bump              # patch, by default
xcookie bump patch
xcookie bump minor
xcookie bump major
xcookie bump 2.0.0        # explicit target version
xcookie bump --target minor --branch  # create dev/<new-version>

Legacy setup.py projects with a static VERSION = parse_version(INIT_PATH) declaration are supported as well. Matching package and configured console-script __version__ copies are updated together.

Invocations to create a new github repo:

# Create a new python repo
xcookie generate --repo_name=cookiecutter_purepy --repodir=$HOME/code/cookiecutter_purepy --tags="github,purepy"

# Create a new binary repo
xcookie generate --repo_name=cookiecutter_binpy --repodir=$HOME/code/cookiecutter_binpy --tags="github,binpy,gdal"

Given an initialized repository the general usage pattern is to edit the generated pyproject.toml and modify values in the [tool.xcookie] section and then rerun xcookie generate in that directory. It will then present you with a diff of the proposed changes that you can reject, accept entirely, or accept selectively.

For some files where the user is likely to do custom work, xcookie won’t try to overwrite the file unless you tell it to regenerate it. The setup.py is the main example of this, so if you want xcookie to update your setup.py you would run xcookie generate --regen setup.py

Documentation refresh is also a separate maintenance command:

xcookie refresh-docs

Secret rotation is a separate maintenance command rather than a generation option:

xcookie rotate-secrets

The command loads the repository’s xcookie configuration, prints the commands it plans to run, and asks for confirmation before executing them.

Metadata

Release files for xcookie 0.5.1

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

Source distribution (sdist)

Source distribution for xcookie 0.5.1
File Size Uploaded Provenance Actions
xcookie-0.5.1.tar.gz 245.0 kB With provenance Details for xcookie-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xcookie 0.5.1
File Interpreter ABI Platform Actions
xcookie-0.5.1-py3-none-any.whl Python 3 none any Details for xcookie-0.5.1-py3-none-any.whl

Total release size: 461.2 kB

Release files / xcookie-0.5.1.tar.gz

Download URL xcookie-0.5.1.tar.gz
Size 245.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7cdba6b89cc2a7d8ad1c18e943fe7e5bd762cbb3006826a6376ca8be445aec49
BLAKE2b-256 checksum
How to use checksums
2c4e0f9e43891be85238e44cbe0d3286c8b9a74a30bbf3ba8473323f24af9a8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / xcookie-0.5.1-py3-none-any.whl

Download URL xcookie-0.5.1-py3-none-any.whl
Size 216.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf073bd647cbbc4ecfa4d3d851c6fb60614b1ddfe0d75a6f370e5c5056a2e78a
BLAKE2b-256 checksum
How to use checksums
8e5b2f62a2c541d851a10e16b817aa13bf0eef81d922de80140b8d0bbb8838c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for xcookie 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xcookie-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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