Skip to main content

Cookiecutter PyPackage GitLab

PyPI version

Cookiecutter template for a Python package in the GitLab CI/CD ecosystem.

Features

  • Dependency management with uv
  • Task running with make
  • Testing with pytest under GitLab CI
  • Auto-publish to a package registry when you push a v* tag. (For PyPI no API tokens are needed by using Trusted Publishers.)
  • Hardened GitLab CI workflows: version-pinned Docker images
  • Documentation site built with Zensical and auto-deployed to GitLab Pages.
  • Linting with ruff, type checking with mypy and ty
  • Command line interface using argparse

Quickstart

Generate a new Python package by creating a temporary venv, installing the package, and running the command.

python -m venv venv
source venv/bin/activate
pip install cookiecutter-pypackage-gitlab
cookiecutter-pypackage-gitlab

If you have uvx installed, you can also use it to run cookiecutter-pypackage-gitlab without explicitly creating a temporary venv, installing the package, running the package, and then removing the temporary venv:

uvx cookiecutter-pypackage-gitlab

You'll be prompted for your project's values (name, description, author details, GitLab repository URL, publish registry, and so on). See docs/prompts.md for the full list and what each value controls.

Then:

  • Review src/ and tests/; see tutorial Step 7 for what to adapt or delete.
  • Create a GitLab repo and push your code
  • Enable GitLab Pages: Settings > Pages > Source: GitLab CI
  • Set up your selected package registry (see Registry setup -- covers GitLab Package Registry, PyPI Trusted Publishing, and TestPyPI for dry runs).
  • Release your package: see Release checklist for the workflow.

See the full documentation for the tutorial, CI/CD reference, design notes, and more.

Development

To set up for local development:

git clone git@gitlab.com:sck/cookiecutter-pypackage-gitlab.git
cd cookiecutter-pypackage-gitlab
make venv
source venv/bin/activate
make init
make sync-devci

Activating the venv is optional — every make target and the pre-commit git hook use ./venv directly. Activate it when you want ruff, pytest, and friends on your PATH.

Run quality checks (format, lint, type check, test):

make qa

Watch the template for changes and auto-regenerate python-boilerplate/ in the repo root (useful when iterating on template files):

make template-watch

Release cycle

See Release checklist for the full recurring workflow: preparing HISTORY.md, setting the version, tagging, and publishing to PyPI.

Not exactly what you want?

Don't worry, you have options:

Fork this / Create your own

If you have differences in your preferred setup, I encourage you to fork this to create your own version. Or create your own; it doesn't strictly have to be a fork.

Similar Cookiecutter templates

This cookiecutter template was based on the v0.4.0 (2026-02-16) release of Cookiecutter PyPackage (a GitHub-centric template). That package lists other forks you can explore to get ideas at network and family tree.

Or submit a merge request

I also accept merge requests on this, if they're small, atomic, follow my design decisions, and if they make my own packaging experience better.

License

MIT.

Metadata

Release files for cookiecutter-pypackage-gitlab 0.7.0

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

Source distribution (sdist)

Source distribution for cookiecutter-pypackage-gitlab 0.7.0
File Size Uploaded Provenance Actions
cookiecutter_pypackage_gitlab-0.7.0.tar.gz 101.8 kB Without provenance Details for cookiecutter_pypackage_gitlab-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cookiecutter-pypackage-gitlab 0.7.0
File Interpreter ABI Platform Actions
cookiecutter_pypackage_gitlab-0.7.0-py3-none-any.whl Python 3 none any Details for cookiecutter_pypackage_gitlab-0.7.0-py3-none-any.whl

Total release size: 191.7 kB

Release files / cookiecutter_pypackage_gitlab-0.7.0.tar.gz

Download URL cookiecutter_pypackage_gitlab-0.7.0.tar.gz
Size 101.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4a85e49c1495d0d1a895051312763dfbe61460bd3c83bb13d526c770ebcb7e0c
BLAKE2b-256 checksum
How to use checksums
4303fc6e04f2b02be5f5e2b65610f63f91a6417a5a10b934ff8c68a37f489406
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / cookiecutter_pypackage_gitlab-0.7.0-py3-none-any.whl

Download URL cookiecutter_pypackage_gitlab-0.7.0-py3-none-any.whl
Size 89.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6c2f12ec2e2fe8f76955465475f2b7dfd701687ae5e2112f33b9eb5c78a07dc
BLAKE2b-256 checksum
How to use checksums
de9a372807b647f151f8b5617b0a3302747c1bbdfd2236eeed82b05bd33d6367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for cookiecutter-pypackage-gitlab 0.7.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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