pyforge
pyforge is a lightweight command-line tool for scaffolding Python projects in seconds. It creates a working project layout, starter tests, basic tooling config, and a template-specific entry point so you can start coding immediately.
Key Features
- Terminal-native TUI: A Rich-powered wizard with a visual template menu and styled prompts.
- Multiple Built-in Templates: Native templates for
basicpackages,clitools,fastapiservices, andflaskapplications. - Remote Templates: Pull custom project layouts directly from public GitHub repositories using the
gh:owner/reposyntax. - Configurable Defaults: Save persistent author, license, template, and tool choices in a
~/.newpythonrcconfiguration file. - Standards-Compliant: Generates PEP 621-compliant
pyproject.tomlusinghatchlingas the build backend. - Tooling Configuration: Preconfigured integration with
pytest,ruff, and optionalpre-commithooks. - Task Automation: Optional virtual environment creation, Git repository initialization, and generation of a template-aware
MakefileorJustfile.
Installation
Install pyforge-init globally via PyPI:
pip install pyforge-init
Or install it in an isolated environment using pipx:
pipx install pyforge-init
Quick Start
Initialize a new project by running:
newpython myproject
In an interactive terminal, pyforge opens a template picker first and then asks for project details. The template menu includes:
1. Basic package - Minimal package with a real entry point and starter test.
2. Click CLI - Console application with a click command and script entry point.
3. FastAPI service - API scaffold with a health endpoint.
4. Flask app - Factory-style web app.
5. Custom GitHub template - gh:owner/repo[@ref]
If you pass --yes, pyforge skips prompts and uses defaults. You can also pass --template directly to bypass the picker.
Once the wizard completes, your project directory is created and populated. Typical next steps are:
cd myproject
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
make install # Installs the package and all dev dependencies
make run # Runs the application or command
CLI Reference
Usage: newpython [OPTIONS] PROJECT_NAME
Scaffold a new Python project.
Arguments:
PROJECT_NAME Name of the project (must be a valid Python identifier)
Options:
--template TEXT Built-in template or remote GitHub template.
Built-ins: basic, cli, fastapi, flask.
Remote: gh:owner/repo or gh:owner/repo@ref.
If omitted, an interactive template picker is shown.
--no-pre-commit Skip generating .pre-commit-config.yaml
--justfile Generate a Justfile instead of a Makefile
-y, --yes Skip interactive prompts and accept defaults
--help Show this message and exit.
Built-in Templates
Basic
Minimal package scaffold with an executable module layout.
src/<project>/main.pysrc/<project>/__main__.pytests/test_main.py
CLI
Click-based command-line application with a console script entry point.
src/<project>/cli.pysrc/<project>/__main__.pytests/test_cli.py
FastAPI
API scaffold with a root route and a /health endpoint.
src/<project>/main.pytests/test_main.py
Flask
Factory-style Flask application with a test client setup.
src/<project>/app.pytests/test_app.py
Project Structure
The default basic template generates the following directory structure:
myproject/
├── src/
│ └── myproject/
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Module entry point
│ └── main.py # Console entry point
--help Show this message and exit.
Project Structure (Basic Template)
The default template (basic) generates the following directory structure:
myproject/
├── src/
│ └── myproject/
│ └── __init__.py # Package initialization
├── tests/
│ └── test_main.py # Starter unit test
├── .env.example # Example environment variables
├── .gitignore # Standard Python git ignore rules
├── .pre-commit-config.yaml # Pre-configured linting/formatting hooks
├── Makefile # Task runner
├── README.md # Generated project documentation
├── pyproject.toml # Metadata, dependencies, and tool settings
└── requirements.txt # Project dependencies
Templates
Remote Templates
pyforge is a lightweight command-line tool for scaffolding Python projects in seconds. It creates a working project layout, starter tests, basic tooling config, and a template-specific entry point so you can start coding immediately.
Key Features
- Terminal-native TUI: A Rich-powered wizard with a visual template menu and styled prompts.
- Multiple Built-in Templates: Native templates for
basicpackages,clitools,fastapiservices, andflaskapplications. - Remote Templates: Pull custom project layouts directly from public GitHub repositories using the
gh:owner/reposyntax. - Configurable Defaults: Save persistent author, license, template, and tool choices in a
~/.newpythonrcconfiguration file. - Standards-Compliant: Generates PEP 621-compliant
pyproject.tomlusinghatchlingas the build backend. - Tooling Configuration: Preconfigured integration with
pytest,ruff, and optionalpre-commithooks. - Task Automation: Optional virtual environment creation, Git repository initialization, and generation of a template-aware
MakefileorJustfile.
Installation
Install pyforge-init globally via PyPI:
pip install pyforge-init
Or install it in an isolated environment using pipx:
pipx install pyforge-init
Quick Start
Initialize a new project by running:
newpython myproject
In an interactive terminal, pyforge opens a template picker first and then asks for project details. The template menu includes:
1. Basic package - Minimal package with a real entry point and starter test.
2. Click CLI - Console application with a click command and script entry point.
3. FastAPI service - API scaffold with a health endpoint.
4. Flask app - Factory-style web app.
5. Custom GitHub template - gh:owner/repo[@ref]
If you pass --yes, pyforge skips prompts and uses defaults. You can also pass --template directly to bypass the picker.
Once the wizard completes, your project directory is created and populated. Typical next steps are:
cd myproject
source .venv/bin/activate # On Windows use: .venv\Scripts\activate
make install # Installs the package and all dev dependencies
make run # Runs the application or command
CLI Reference
Usage: newpython [OPTIONS] PROJECT_NAME
Scaffold a new Python project.
Arguments:
PROJECT_NAME Name of the project (must be a valid Python identifier)
Options:
--template TEXT Built-in template or remote GitHub template.
Built-ins: basic, cli, fastapi, flask.
Remote: gh:owner/repo or gh:owner/repo@ref.
If omitted, an interactive template picker is shown.
--no-pre-commit Skip generating .pre-commit-config.yaml
--justfile Generate a Justfile instead of a Makefile
-y, --yes Skip interactive prompts and accept defaults
--help Show this message and exit.
Built-in Templates
Basic
Minimal package scaffold with an executable module layout.
src/<project>/main.pysrc/<project>/__main__.pytests/test_main.py
CLI
Click-based command-line application with a console script entry point.
src/<project>/cli.pysrc/<project>/__main__.pytests/test_cli.py
FastAPI
API scaffold with a root route and a /health endpoint.
src/<project>/main.pytests/test_main.py
Flask
Factory-style Flask application with a test client setup.
src/<project>/app.pytests/test_app.py
Project Structure
The default basic template generates the following directory structure:
myproject/
├── src/
│ └── myproject/
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Module entry point
│ └── main.py # Console entry point
├── tests/
│ └── test_main.py # Starter unit test
├── .env.example # Example environment variables
├── .gitignore # Standard Python git ignore rules
├── .pre-commit-config.yaml # Pre-configured linting/formatting hooks
├── Makefile # Task runner
├── README.md # Generated project documentation
├── pyproject.toml # Metadata, dependencies, and tool settings
└── requirements.txt # Project dependencies
Remote Templates
You can import any public GitHub repository to use as a project template:
# Uses the main/master branch
newpython myproject --template gh:username/repo-name
# Pin to a specific branch, tag, or commit hash
newpython myproject --template gh:username/repo-name@v1.0.0
Remote Repository Requirements
Remote templates are fetched and copied as-is, so no Jinja rendering is performed on remote files.
- If the remote repository has a top-level
template/directory, only the contents of that folder are copied to the destination. - If no
template/directory is present, the entire contents of the repository root are copied.
Configuration File (~/.newpythonrc)
You can persist configuration defaults in a ~/.newpythonrc (TOML format) file to pre-fill prompt values and skip entering them on every run.
# ~/.newpythonrc
author = "Jane Doe"
license = "MIT"
template = "basic"
pre_commit = true
justfile = false
Precedence Order
When resolving configurations, pyforge applies overrides in the following order, from highest to lowest:
- CLI flags, such as
--templateand--justfile - Configuration file,
~/.newpythonrc - Interactive prompt defaults
To override the default config location, set the NEWPYTHON_CONFIG environment variable:
export NEWPYTHON_CONFIG="/path/to/custom/config.toml"
Automated Task Runner
The generated Makefile or Justfile exposes standard commands for project maintenance:
install: Install the project locally in editable mode alongside all development dependencies.test: Execute the test suite usingpytest.lint: Perform static analysis withruff.format: Auto-format code styles usingruff format.run: Start the application server or CLI script, depending on the selected template.clean: Remove local cache and build directories such as__pycache__,.pytest_cache,.ruff_cache,build, anddist.
Publishing to PyPI
Projects generated by pyforge use hatchling as the build system and are ready to be built and uploaded to PyPI:
- Install build and publication dependencies:
pip install build twine
- Build the project distribution packages, source archive and wheel:
python -m build
- Upload to PyPI, or TestPyPI first:
python -m twine upload dist/*
Development
To work on pyforge locally:
git clone https://github.com/your-name/pyforge.git
cd pyforge
pip install -e ".[dev]"
python -m pytest -v
Contributing
Contributions are welcome. Open an issue or pull request if you find a bug or want to propose an improvement.
Release files for pyforge-init 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyforge_init-0.1.1.tar.gz | 19.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyforge_init-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.9 kB
Release files / pyforge_init-0.1.1.tar.gz
| Download URL | pyforge_init-0.1.1.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c41c58c08f8bf0fec62f5fb83a6eac855410f205e647d0fc8bce0f0dc323842c
|
|
BLAKE2b-256 checksum How to use checksums |
cfcb335e798d3864543a50335d363b0d70ee0bb5de006cceede89ab21179e69e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency logRelease files / pyforge_init-0.1.1-py3-none-any.whl
| Download URL | pyforge_init-0.1.1-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a694962f935b6fe4400ccdb2fc046be22c5d5dc004276d78fb9fcc49d4bb73d
|
|
BLAKE2b-256 checksum How to use checksums |
64729adecb4765d2e5e03e8dea524ddbb75982396e16c49f81b5e63266916afe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.
Transparency log