Skip to content

Scaffold Python


Documentation: https://scruffaluff.github.io/scaffold-python

Source Code: https://github.com/scruffaluff/scaffold-python


Scaffold Python is a Cookiecutter template project for generating Python repository layouts. To create a new Python application project with the template first install Cookiecutter. Then execute

cookiecutter https://github.com/scruffaluff/scaffold-python

Follow the interactive prompts, and a folder, with your selected project_name, will be generated in your current working directory.

Setup

To develop with the generated project, install Poetry and step into the project folder. Afterwards execute the following commands.

poetry install
poetry shell
black .
git init

Then the development environment is configured, and you are ready to code.

Tooling

Every generated project configures the following tools for development usage:

The following tools are configured if you select optional features:

  • prettier_support:
  • Prettier: Opinionated code formatter for JSON, Markdown, and YAML files. Requires NodeJS to be externally installed on your system.

Layout

The following diagram shows all possible files generated from scaffolding. If a file is followed by {option: selection}, then the path and its possible contents are only generated for that chosen context.

{{project_name}}
├── .github  {githost: github}
│   └── workflows
│       ├── build.yaml
│       ├── pages.yaml
│       └── release.yaml
├── .dockerignore
├── .gitignore
├── .gitlab-ci.yaml  {githost: gitlab}
├── .prettierignore  {prettier_support: yes}
├── .prettierrc.yaml  {prettier_support: yes}
├── CONTRIBUTING.md
├── docs
│   ├── api
│   |   └── index.md
│   └── usage
│       └── index.md
├── examples
│   └── __init__.py
├── LICENSE.md
├── mkdocs.yml
├── pyproject.toml
├── README.md
├── scripts
│   ├── __init__.py
│   ├── build_docs.py
│   ├── setup_tmate.ps1  {githost: gitlab}
│   └── setup_tmate.sh  {githost: gitlab}
├── src
│   └── {{project_slug}}
│       ├── __init__.py
│       ├── __main__.py  {cli_support: yes}
│       └── py.typed
├── tests
│   ├── conftest.py
│   ├── __init__.py
└── tox.ini

Continuous Integration

Projects generated with this scaffolding repository are automatically configured to use GitHub CI workflows and GitLab CI pipelines.