Skip to main content

A meta-tool for setting up Python projects with configurable presets

Project description

pypreset

mcp-name: io.github.KaiErikNiermann/pypreset

A meta-tool for scaffolding Python projects with configurable YAML presets. Supports Poetry and uv, generates CI workflows, testing scaffolds, type checking configs, and more.

Features

  • Preset-based project creation from YAML configs with single inheritance
  • Augment existing projects with GitHub Actions workflows, tests, dependabot, .gitignore
  • Two package managers: Poetry and uv (PEP 621 + hatchling)
  • Two layout styles: src/ layout and flat layout
  • Type checking: mypy, pyright, ty, or none
  • Code quality: ruff linting/formatting, radon complexity checks, pre-commit hooks
  • Version management: bump-my-version integration, GitHub release automation via gh CLI
  • User defaults: persistent config at ~/.config/pypreset/config.yaml
  • MCP server: expose all functionality to AI coding assistants via Model Context Protocol

Installation

pip install pypreset

# With MCP server support
pip install pypreset[mcp]

Quick Start

# Create a CLI tool project with Poetry
pypreset create my-cli --preset cli-tool

# Create a data science project with uv
pypreset create my-analysis --preset data-science --package-manager uv

# Create an empty package with src layout (default)
pypreset create my-package --preset empty-package

# Create a Discord bot
pypreset create my-bot --preset discord-bot

Commands

create — Scaffold a new project

pypreset create <name> [OPTIONS]
Option Description
--preset, -p Preset to use (default: empty-package)
--output, -o Output directory (default: .)
--config, -c Custom preset YAML file
--package-manager poetry or uv
--layout src or flat
--type-checker mypy, pyright, ty, or none
--typing none, basic, or strict
--python-version e.g., 3.12
--testing / --no-testing Enable/disable testing scaffold
--formatting / --no-formatting Enable/disable formatting config
--radon / --no-radon Enable radon complexity checking
--pre-commit / --no-pre-commit Generate pre-commit hooks config
--bump-my-version / --no-bump-my-version Include bump-my-version config
--extra-package, -e Additional packages (repeatable)
--extra-dev-package, -d Additional dev packages (repeatable)
--git / --no-git Initialize git repository
--install / --no-install Run dependency install after creation

augment — Add components to an existing project

Analyzes pyproject.toml to auto-detect your tooling, then generates the selected components.

# Interactive mode (prompts for missing values)
pypreset augment ./my-project

# Auto-detect everything, no prompts
pypreset augment --auto

# Generate only specific components
pypreset augment --test-workflow --lint-workflow --gitignore

# Overwrite existing files
pypreset augment --force

version — Release management

pypreset version release <bump>         # Bump, commit, tag, push, release
pypreset version release-version <ver>  # Explicit version, then release
pypreset version rerun <ver>            # Re-tag and push an existing version
pypreset version rerelease <ver>        # Delete and recreate a GitHub release

Requires the gh CLI to be installed and authenticated.

Other commands

pypreset list-presets              # List all available presets
pypreset show-preset <name>        # Show full preset details
pypreset validate [path]           # Validate project structure
pypreset analyze [path]            # Detect and display project tooling
pypreset config show               # Show current user defaults
pypreset config init               # Create default config file
pypreset config set <key> <value>  # Set a config value

Presets

Built-in presets: empty-package, cli-tool, data-science, discord-bot.

Presets are YAML files that define metadata, dependencies, directory structure, testing, formatting, and more. They support single inheritance via the base: field.

Custom presets

Place custom preset files in ~/.config/pypreset/presets/ or pass a file directly:

pypreset create my-project --config ./my-preset.yaml

User presets take precedence over built-in presets with the same name.

User Configuration

Persistent defaults are stored at ~/.config/pypreset/config.yaml and applied as the lowest-priority layer (presets and CLI flags override them).

pypreset config init                    # Create with defaults
pypreset config set layout flat         # Set default layout
pypreset config set type_checker ty     # Set default type checker
pypreset config show                    # View current config

MCP Server

pypreset is published to the MCP Registry as io.github.KaiErikNiermann/pypreset.

Install via the registry (recommended):

# Claude Code
claude mcp add pypreset -- uvx --from "pypreset[mcp]" pypreset-mcp

# Or add manually to ~/.claude/settings.json
{
  "mcpServers": {
    "pypreset": {
      "command": "uvx",
      "args": ["--from", "pypreset[mcp]", "pypreset-mcp"]
    }
  }
}

Or install locally:

pip install pypreset[mcp]
{
  "mcpServers": {
    "pypreset": {
      "command": "pypreset-mcp",
      "args": []
    }
  }
}

Available tools: create_project, augment_project, validate_project, list_presets, show_preset, get_user_config, set_user_config

Resources: preset://list, config://user, template://list

Prompts: create-project, augment-project

Development

All tasks use the Justfile:

just install     # Install dependencies
just test        # Run tests
just test-cov    # Tests with coverage
just lint        # Ruff check
just format      # Ruff format
just typecheck   # Pyright
just radon       # Cyclomatic complexity check
just check       # lint + typecheck + radon + test
just all         # format + lint-fix + typecheck + radon + test

See CONTRIBUTING.md for development setup and guidelines.

License

MIT

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

pypreset-0.1.6.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

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

pypreset-0.1.6-py3-none-any.whl (62.4 kB view details)

Uploaded Python 3

File details

Details for the file pypreset-0.1.6.tar.gz.

File metadata

  • Download URL: pypreset-0.1.6.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypreset-0.1.6.tar.gz
Algorithm Hash digest
SHA256 18b00d94d4e64326e72ae8afe2d79461a4e33b5f8b8cb324e55aac44173d1304
MD5 3fb624a52dd5614ed898be74ed40ef38
BLAKE2b-256 6891c53667164059ca02fc3231e237b6ee77a9edb240f08bb588accbb5774969

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypreset-0.1.6.tar.gz:

Publisher: publish.yaml on KaiErikNiermann/pypreset

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypreset-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pypreset-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 62.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypreset-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cb6f8be1f9e17628c35a8fdef5e361018950705b03969d3d13376b3ededdc5f2
MD5 dada58053209b53857453feaa1f7dc8c
BLAKE2b-256 d4f6543672e597b93ad0424c71e61fa8427bebc629854b0ca328f58c4ed849cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypreset-0.1.6-py3-none-any.whl:

Publisher: publish.yaml on KaiErikNiermann/pypreset

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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