Skip to main content

A Python project generator using cookiecutter templates

Project description

License: MIT PyPI version Python 3.10+ Documentation Status

Generate Project

A Python project folder generator with support for UV and Poetry package managers. The generated folder provides everything you need to get started with a well-structured Python project, including development tasks for formatting, linting, documentation, testing, and CI/CD.

Features

๐Ÿ“ฆ UV or Poetry for dependency management and packaging ๐Ÿงน Code quality tools including black, isort, flake8, mypy and pylint
๐Ÿ“š Sphinx based documentation with auto-generated API docs and live preview
โœ… Testing framework with pytest and test coverage reports
๐Ÿ”„ GitHub actions with CI/CD workflows for tests, documentation and release management
๐Ÿ PyPl package publishing automation with version control
๐Ÿ“ ReadTheDocs integration for hosting documentation
๐Ÿš€ Automated release process for versioning and publishing
๐Ÿ“‹ Project structure following best practices

Requirements

Python 3.10+
Cookiecutter 2.6.0+
PyYAML 6.0.0+
python-dotenv 1.1.0+

Installation

pip install generate-project

Or, if you use Poetry:

poetry add generate-project

Or, if you use UV:

uv add generate-project

Quick Start

Basic Usage

You can provide the project configuration values in the terminal command line:

generate-project generate "project-name" \
--author_name="Your Name" \
--email="your.email@example.com" \
--github_username="yourusername" \
--python_min_version="3.11"
...

Project Configuration Options

These are the most important project configuration options:

Option Description
package_name Python package name (defaults to project_name)
author_name Author's name
email Author's email
github_username GitHub username
version Initial version number
description Short project description
python_min_version Minimum Python version

Advanced Usage

You can also save your own configuration values to be used as default values:

generate-project config \
--author_name="Your Name" \
--email="your.email@example.com" \
--github_username="yourusername" \
--python_min_version="3.11"

You can also set the default package manager:

generate-project config --manager uv

and then you can omit the saved configuration options:

generate-project generate "project-name"
...

Package Manager

By default, generate-project creates projects using UV. Use the --manager flag to select Poetry instead:

Manager Build Backend Dependency Format Command
UV (default) hatchling [dependency-groups] (PEP 735) --manager uv
Poetry poetry-core [tool.poetry.dependencies] --manager poetry
# UV project (default)
generate-project generate my-project

# Poetry project
generate-project generate my-project --manager poetry

Project Structure

The generated project will have the following structure:

project-name/
โ”œโ”€โ”€ .github/workflows/         # GitHub actions for CI/CD
โ”‚   โ”œโ”€โ”€ docs.yml               # Documentation building and testing
โ”‚   โ”œโ”€โ”€ tests.yml              # Code quality and testing
โ”‚   โ”œโ”€โ”€ release.yml            # Automated releases and publishing
โ”‚   โ””โ”€โ”€ update_rtd.yml         # Manual ReadTheDocs updates
โ”œโ”€โ”€ .vscode/                   # VS Code configuration
โ”‚   โ”œโ”€โ”€ settings.json          # Editor settings, linting, formatting
โ”‚   โ”œโ”€โ”€ launch.json            # Debug configurations
โ”‚   โ””โ”€โ”€ tasks.json             # Task definitions
โ”œโ”€โ”€ docs/                      # Sphinx documentation
โ”‚   โ”œโ”€โ”€ api/                   # Auto-generated API docs
โ”‚   โ”œโ”€โ”€ guides/                # User guides
โ”‚   โ”œโ”€โ”€ conf.py                # Sphinx configuration
โ”‚   โ””โ”€โ”€ index.md               # Documentation home
โ”œโ”€โ”€ src/package_name/          # Source code
โ”‚   โ””โ”€โ”€ __init__.py            # Package initialization
โ”œโ”€โ”€ tests/                     # Test directory
โ”œโ”€โ”€ scripts/                   # Release management scripts
โ”œโ”€โ”€ .env                       # Environment variables (if --local-env used)
โ”œโ”€โ”€ .gitignore                 # Git ignore rules
โ”œโ”€โ”€ .readthedocs.yaml          # ReadTheDocs configuration
โ”œโ”€โ”€ CLAUDE.md                  # Claude Code integration guide
โ”œโ”€โ”€ CredentialManagement.md    # Token management documentation
โ”œโ”€โ”€ LICENSE                    # MIT License
โ”œโ”€โ”€ Makefile                   # Development commands
โ”œโ”€โ”€ pyproject.toml             # Project configuration
โ”œโ”€โ”€ run.sh                     # Development task runner
โ””โ”€โ”€ README.md                  # Project documentation

Project Types

By default, generate-project creates an application project with a CLI entry point. Use the --library flag to create a library project instead:

# Create an application (default)
generate-project generate my-app

# Create a library
generate-project generate my-lib --library
Project Type CLI Entry Point main.py Use Case
Application Yes Yes CLI tools, scripts
Library No No Reusable packages, APIs

GitHub Repository Setup

The following options are available to setup a github repository for the project:

Option Description
--github Create a private github repository for the project
--public Create a public github repository for the project
--secrets Create repository secrets for the release management workflows

The following repository secrets can be automatically setup:

TEST_PYPI_TOKEN
PYPI_TOKEN
RTD_TOKEN

The tokens must be available in a .env file located in the directory where generate-project is executed or in any parent directory up the folder hierarchy. If no .env file is found, the application falls back to reading the tokens from environment variables.

Development Workflow

The generated project includes a Makefile with common development tasks:

# Environment Setup
make venv                 # Create and activate a local virtual environment
make install              # Install core dependencies
make install-dev          # Install all development dependencies

# Code quality
make format               # Run code formatters
make lint                 # Run linters
make check                # Run format + lint + tests on all files
make pre-commit           # Run format and lint only on changed files, then tests

# Testing
make test                 # Run tests
make test-cov             # Run tests with coverage
make coverage             # Generate coverage report

# Documentation
make docs-api             # Generate API documentation
make docs                 # Build documentation
make docs-live            # Start live preview server


# Release tasks will bump the version, create a new release and publish it
make release-major        # Create major release
make release-minor        # Create minor release
make release-micro        # Create micro (patch) release
make release-rc           # Create release candidate
make release-beta         # Create beta pre-release
make release-alpha        # Create alpha pre-release

Run make help for a complete list of the development tasks available.

Acknowledgments

This project was inspired by the GitHub workflows and automation ideas from phitoduck/python-course-cookiecutter-v2.

While this project is an independent implementation and a full Python application, the original repository provided valuable inspiration for the CI/CD and automation approach.

We thank the original authors for their contributions and ideas.

License

This project is released under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generate_project-2.0.0.tar.gz (230.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generate_project-2.0.0-py3-none-any.whl (107.5 kB view details)

Uploaded Python 3

File details

Details for the file generate_project-2.0.0.tar.gz.

File metadata

  • Download URL: generate_project-2.0.0.tar.gz
  • Upload date:
  • Size: 230.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for generate_project-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ce52deef01f2c6ad58cf67c056844c95e74d01e61288470af7eedd6102e12888
MD5 0ef28cdee9725d211409a40bc1cdc1a1
BLAKE2b-256 9f7f0cc331978376d323c2ca76d2b42c7de99aaea384987e0a0f9d14fccdcdfc

See more details on using hashes here.

File details

Details for the file generate_project-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: generate_project-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 107.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for generate_project-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1c3d984c29b61203a2f9c001c08f8ca3894ce3b00856f638f9c5dd9d6392620
MD5 6e5f7a303852617d27e2b3ccc092669c
BLAKE2b-256 95417290f191cdf914850aa649746dade2df540a44d64b441e688ea4fc52ab0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page