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 based on Poetry for dependency and package management. The generated folder provides everything you need to get started with a well-structured Python project, including formatting, linting, documentation, testing, and CI/CD integration.

Features

๐Ÿ“ฆ 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 for 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

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_version="3.11"
...

Project Configuration Options

These are the most important project configuration options:

Option Description
project_name Name of the project
package_name Python package name (importable)
author_name Author's name
email Author's email
github_username GitHub username
version Initial version number
description Short project description
python_version Python version requirement

Advanced Usage

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

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

and the you can omit the saved configuration options:

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

Project Structure

The generated project will have the following structure:

project-name/
โ”œโ”€โ”€ .github/workflows/         # GitHub Actions CI/CD
โ”‚   โ”œโ”€โ”€ docs.yml               # Documentation building and testing
โ”‚   โ”œโ”€โ”€ tests.yml              # Code quality and testing
โ”‚   โ”œโ”€โ”€ release.yml            # Automated releases
โ”‚   โ””โ”€โ”€ update_rtd.yml         # ReadTheDocs updates
โ”œโ”€โ”€ 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 suite
โ”œโ”€โ”€ scripts/                   # Development scripts
โ”œโ”€โ”€ .gitignore                 # Git ignore rules
โ”œโ”€โ”€ .readthedocs.yaml          # ReadTheDocs configuration
โ”œโ”€โ”€ LICENSE                    # MIT License
โ”œโ”€โ”€ Makefile                   # Development commands
โ”œโ”€โ”€ pyproject.toml             # Project configuration
โ”œโ”€โ”€ run.sh                     # Development task runner
โ””โ”€โ”€ README.md                  # Project documentation

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 workflow

The following repository secrets can be automatically setup:

TEST_PYPI_TOKEN
PYPI_TOKEN
RTD_TOKEN

The tokens must be available in a .env file found in the folder where generate-project is executed or increasingly higher folders.

Development Workflow

The generated project includes a Makefile with common development tasks:

# Install dependencies
make install              # Install main dependencies
make install-dev          # Install all development dependencies

# Code quality
make format               # Run code formatters
make lint                 # Run linters

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

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

# Releasing
make build                # Build package locally
make publish              # Publish to PyPI a package generate locally
make release-minor        # Create a new release and bump the version

Run make help for a complete list of the make targets available.

Customization

You can customize this template by:

  1. Forking the repository
  2. Modifying files in the template structure base on cookiecutter
  3. Updating cookiecutter.json with your preferred defaults

License

This project template 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-1.0.2.post1.tar.gz (36.5 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-1.0.2.post1-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file generate_project-1.0.2.post1.tar.gz.

File metadata

  • Download URL: generate_project-1.0.2.post1.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Linux/6.11.0-1015-azure

File hashes

Hashes for generate_project-1.0.2.post1.tar.gz
Algorithm Hash digest
SHA256 eeeda073a2332c5d00beabd7da03638c3dd564cb75d3f9e1ba3e6a75538fc834
MD5 d3552ec05c204c381d96479b4302ac50
BLAKE2b-256 791c754eb3651e24f112321b85ccc6c49e16a6d9bfdd342a2b1a4e56f951f53d

See more details on using hashes here.

File details

Details for the file generate_project-1.0.2.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for generate_project-1.0.2.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 255c6e8a087f2e9645170df01130cc0cab1d670a08ae1dd4ef23543092f903d7
MD5 a7ff0e9409a3b772b2b36b48407f5274
BLAKE2b-256 fb0f7e2b25b69d6903230765ccd97ee57f6abf5204c67c865f6f0732c07fdc32

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