A CLI tool to scaffold project directory structures from JSON or YAML files
Project description
📁 projgen
A CLI tool to scaffold project directory structures from JSON or YAML config files.
pip install projgen # JSON support (no extra deps)
pip install projgen[yaml] # JSON + YAML support
Quick start
# From a JSON file
projgen fastapi_proj.json
# From a YAML file
projgen fastapi_proj.yaml
# Choose output directory
projgen structure.yaml --output ~/projects
# Preview without creating anything
projgen structure.json --dry-run
# Verbose/debug output
projgen structure.json --verbose
Config format
Both JSON and YAML use the same schema.
JSON
{
"project_name": "my-api",
"project-structure": [
{ "level": 1, "type": "folder", "name": "src" },
{ "level": 2, "type": "file", "name": "src/main.py" },
{ "level": 1, "type": "file", "name": "README.md" },
{ "level": 1, "type": "file", "name": "Dockerfile" }
]
}
YAML
project_name: my-api
project-structure:
- { level: 1, type: folder, name: src }
- { level: 2, type: file, name: "src/main.py" }
- { level: 1, type: file, name: README.md }
- { level: 1, type: file, name: Dockerfile }
Schema reference
| Field | Type | Description |
|---|---|---|
name |
str |
Relative path, e.g. "app/api/v1/routes.py" |
level |
int (≥ 1) |
Nesting depth — must match the number of / in name + 1 |
type |
"file"|"folder" |
Entry type |
Level rule: level = path.count("/") + 1
| name | level |
|---|---|
src |
1 |
src/api |
2 |
src/api/v1 |
3 |
src/api/v1/routes.py |
4 |
Extensionless files that are allowed without an extension:
Dockerfile, Makefile, LICENSE, README, NOTICE, CODEOWNERS,
Procfile, Vagrantfile, Jenkinsfile, Brewfile, and dotfiles (.gitignore, .env, …).
Python API
from projgen.core import load_config, create_project
# Load from file (auto-detects JSON / YAML)
data = load_config("structure.yaml")
# Scaffold the project
project_path = create_project(data, output_dir="~/projects")
print(f"Created: {project_path}")
# Dry-run preview
create_project(data, dry_run=True)
# Build the dict yourself
data = {
"project_name": "hello",
"project-structure": [
{"level": 1, "type": "file", "name": "main.py"},
],
}
create_project(data)
CLI reference
usage: projgen [-h] [-o DIR] [--dry-run] [-v] [--version] CONFIG_FILE
positional arguments:
CONFIG_FILE Path to the structure config file (.json, .yaml, .yml)
options:
-h, --help show this help message and exit
-o DIR, --output DIR Directory where the project folder will be created (default: .)
--dry-run Preview what would be created without touching the filesystem
-v, --verbose Enable verbose/debug output
--version show program's version number and exit
Development
git clone https://github.com/avinash-kumar-prajapati-AI/Python
cd Python/projgen
# Install in editable mode with all dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linter
ruff check projgen tests
Publishing to PyPI
pip install build twine
# Build sdist + wheel
python -m build
# Upload to TestPyPI first
twine upload --repository testpypi dist/*
# Upload to PyPI
twine upload dist/*
License
MIT © Avinash Kumar Prajapati
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file projgen-0.3.1.tar.gz.
File metadata
- Download URL: projgen-0.3.1.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4468e26eaa3f708f1829178d7ce14559e7a6034ecd8af4de5e6790ba9feb8486
|
|
| MD5 |
02ccaa2df39b3b0f67862590cf00f646
|
|
| BLAKE2b-256 |
40e5ae48c099f97d2d1aea93568a66d5960fb483b0d665060b8a9e3e51da91d4
|
File details
Details for the file projgen-0.3.1-py3-none-any.whl.
File metadata
- Download URL: projgen-0.3.1-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8419b22eb312553bc39da35d5c18de0f2b431d703449895882fe52de743fb059
|
|
| MD5 |
7c6ec9ad0bf4c09314f01283b7fc564a
|
|
| BLAKE2b-256 |
b656e5d32f075b96c49e6ad1dc12fe7f1c6f98ca1945abb26f2de4ebcaed65d5
|