Skip to main content

Scaffolder to generate Clean Architecture apps

Project description

scaffold-ca-python

PyPI version Python License: MIT

What is this?

scaffold-ca-python is a CLI tool that scaffolds production-ready Python projects that follow Clean Architecture. It helps teams start faster by generating the project structure, modules, adapters, entry points, helpers, and pipeline files needed to keep architectural boundaries explicit. It is designed for developers who want repeatable code generation instead of hand-creating the same project pieces over and over.

Installation

Python 3.13 or newer is required.

Install with pip:

pip install scaffold-ca-python

Install with uv:

uv add scaffold-ca-python

Quick Start

  1. Create a new Clean Architecture project.
scaffold ca --name my-app
  1. Move into the generated project directory.
cd my-app
  1. Generate a domain model.
scaffold gm --name Order
  1. Validate the project structure.
scaffold vs

Commands & Examples

scaffold ca

Scaffold a new Clean Architecture project.

scaffold ca --name my-project
scaffold ca --name my-project --dry-run

scaffold gm

Scaffold a Pydantic v2 domain model and its test stub.

scaffold gm --name Order
scaffold gm --name Order --dry-run

scaffold guc

Scaffold a use case in domain/usecase/.

scaffold guc --name CreateOrder
scaffold guc --name CreateOrder --dry-run

scaffold gda

Scaffold a driven adapter such as an HTTP client, secrets adapter, or generic outbound adapter.

scaffold gda --type rest-consumer
scaffold gda --type generic --name MyAdapter --dry-run

scaffold gep

Scaffold an entry-point adapter for REST APIs, A2A agents, MCP servers, or generic entry points.

scaffold gep --type restapi
scaffold gep --type mcp --with-resources --with-prompts --dry-run

scaffold gh

Scaffold a helper utility module and its test stub.

scaffold gh --name JsonParser
scaffold gh --name JsonParser --dry-run

scaffold gpipe

Scaffold a CI/CD pipeline configuration for GitHub Actions or Azure Pipelines.

scaffold gpipe --provider github
scaffold gpipe --provider azure --dry-run

scaffold vs

Scan the project for Clean Architecture import violations.

scaffold vs
scaffold vs --dry-run

scaffold dm

Delete a previously generated module and its mirrored test file.

scaffold dm --name Order
scaffold dm --name Order --dry-run

scaffold up

Update project dependencies using uv lock --upgrade and uv sync.

scaffold up --dry-run
scaffold update-project --dry-run

Technologies

Tool / Library Version Role
Python >=3.13 Runtime
uv latest Dependency management, build, and publish
Typer >=0.16.0 CLI framework
Rich >=14.1.0 Terminal output formatting
Jinja2 >=3.1 Template engine for code generation
Pydantic v2 >=2.0 Runtime validation of template context
hatchling latest Build backend
uv-dynamic-versioning latest PEP 440 versioning from git tags
ruff latest Linting and formatting
mypy latest (strict) Static type checking
pytest + pytest-cov latest Test execution and coverage gating

Current Features

  • Generates full Clean Architecture project skeletons with scaffold ca.
  • Generates domain models with scaffold gm.
  • Generates domain use cases with scaffold guc.
  • Generates driven adapters with scaffold gda.
  • Generates entry points for REST API, agent, MCP, and generic modes with scaffold gep.
  • Generates helper utilities with scaffold gh.
  • Generates CI/CD pipeline files with scaffold gpipe.
  • Validates import boundaries with scaffold vs.
  • Deletes generated modules safely with scaffold dm.
  • Updates project dependencies with scaffold up.
  • Supports --dry-run previews across commands.
  • Uses Jinja2 templates for all generated code.
  • Validates template context with Pydantic v2.
  • Formats terminal output with Rich.
  • Enforces static checks with mypy strict and ruff.
  • Maintains an 80%+ coverage gate with pytest-cov.

Contributing

  1. Fork the upstream repository on GitHub: https://github.com/santicalleg/scaffold-ca-python
  2. Clone your fork.
git clone https://github.com/YOUR-USER/scaffold-ca-python.git
cd scaffold-ca-python
  1. Set up the development environment.
uv sync
  1. Create a feature branch.
git checkout -b your-branch-feature-name
  1. Run the test suite.
uv run pytest
  1. Check linting.
uv run ruff check src tests
  1. Check types.
uv run mypy src
  1. Commit your changes and open a pull request.

License

This project is licensed under the MIT License. See LICENSE for the full text.

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

scaffold_ca_python-0.1.1.tar.gz (353.5 kB view details)

Uploaded Source

Built Distribution

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

scaffold_ca_python-0.1.1-py3-none-any.whl (86.0 kB view details)

Uploaded Python 3

File details

Details for the file scaffold_ca_python-0.1.1.tar.gz.

File metadata

  • Download URL: scaffold_ca_python-0.1.1.tar.gz
  • Upload date:
  • Size: 353.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","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 scaffold_ca_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 19b13ae26ec4b2b945df5f6200ff1cacb85401956c4ac16b89b06883845a7865
MD5 d35a3de12b1134b6cdf97c9706f4edac
BLAKE2b-256 210382bdab6f86305a2b1ad372abef738f1fe2f063a3ba0a3ef41e6241bb4a58

See more details on using hashes here.

File details

Details for the file scaffold_ca_python-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scaffold_ca_python-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 86.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","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 scaffold_ca_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ddbdf99dfe9fa3c853f4a17d6b4d01b21c237565dc328e61ac9c7fc499bd038e
MD5 c3329a8d36251d95cdf4b25f724026da
BLAKE2b-256 9e1ccf5ca3bbf6a1d89eed8ddf0a128377cd002d27dccdbc05d90ccd2644f993

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