forgeapi 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- forgeapi-0.1.0/.github/workflows/ci.yml +67 -0
- forgeapi-0.1.0/.github/workflows/publish.yml +78 -0
- forgeapi-0.1.0/.gitignore +191 -0
- forgeapi-0.1.0/CHANGELOG.md +51 -0
- forgeapi-0.1.0/CONTRIBUTING.md +242 -0
- forgeapi-0.1.0/DESIGN.md +823 -0
- forgeapi-0.1.0/LICENSE +21 -0
- forgeapi-0.1.0/PKG-INFO +182 -0
- forgeapi-0.1.0/README.md +145 -0
- forgeapi-0.1.0/TODO.md +302 -0
- forgeapi-0.1.0/docs.md +47 -0
- forgeapi-0.1.0/fastapi_forge/__init__.py +15 -0
- forgeapi-0.1.0/fastapi_forge/cli.py +125 -0
- forgeapi-0.1.0/fastapi_forge/commands/__init__.py +5 -0
- forgeapi-0.1.0/fastapi_forge/commands/create.py +107 -0
- forgeapi-0.1.0/fastapi_forge/generator.py +300 -0
- forgeapi-0.1.0/fastapi_forge/models.py +187 -0
- forgeapi-0.1.0/fastapi_forge/prompts.py +364 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/.dockerignore.jinja +20 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/.github/workflows/ci.yml.jinja +155 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/.gitignore.jinja +68 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/Dockerfile.jinja +69 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/README.md.jinja +141 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/alembic/README.md.jinja +43 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/alembic/env.py.jinja +93 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/alembic/script.py.mako.jinja +26 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/alembic/versions/.gitkeep.jinja +1 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/alembic.ini.jinja +70 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/__init__.py.jinja +5 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/api/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/api/auth_api.py.jinja +72 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/api/health_api.py.jinja +41 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/config/__init__.py.jinja +31 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/config/base.py.jinja +52 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/config/env.py.jinja +75 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/core/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/core/auth.py.jinja +96 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/core/config.py.jinja +56 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/core/database.py.jinja +68 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/core/deps.py.jinja +55 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/core/redis.py.jinja +41 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/daos/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/exceptions/__init__.py.jinja +7 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/exceptions/exception.py.jinja +34 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/exceptions/handler.py.jinja +56 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/main.py.jinja +24 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/models/__init__.py.jinja +7 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/models/base.py.jinja +13 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/schemas/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/schemas/api_schema.py.jinja +20 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/schemas/auth_schema.py.jinja +21 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/server.py.jinja +99 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/services/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/utils/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/app/utils/log.py.jinja +21 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/config.yaml.jinja +71 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/docker-compose.yml.jinja +117 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/pyproject.toml.jinja +86 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/pytest.ini.jinja +10 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/ruff.toml.jinja +33 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/tests/__init__.py.jinja +3 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/tests/conftest.py.jinja +31 -0
- forgeapi-0.1.0/fastapi_forge/templates/base/tests/test_health.py.jinja +24 -0
- forgeapi-0.1.0/pyproject.toml +108 -0
- forgeapi-0.1.0/tests/__init__.py +3 -0
- forgeapi-0.1.0/tests/test_cli.py +39 -0
- forgeapi-0.1.0/tests/test_generator.py +212 -0
- forgeapi-0.1.0/tests/test_models.py +147 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v4
|
|
26
|
+
with:
|
|
27
|
+
version: "latest"
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: uv sync --group dev
|
|
31
|
+
|
|
32
|
+
- name: Run linting
|
|
33
|
+
run: uv run ruff check .
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: uv run pytest -v --cov=fastapi_forge --cov-report=xml
|
|
37
|
+
|
|
38
|
+
- name: Upload coverage to Codecov
|
|
39
|
+
if: matrix.python-version == '3.11'
|
|
40
|
+
uses: codecov/codecov-action@v4
|
|
41
|
+
with:
|
|
42
|
+
file: ./coverage.xml
|
|
43
|
+
fail_ci_if_error: false
|
|
44
|
+
|
|
45
|
+
build:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
needs: test
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
|
|
51
|
+
- name: Set up Python
|
|
52
|
+
uses: actions/setup-python@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version: "3.11"
|
|
55
|
+
|
|
56
|
+
- name: Install uv
|
|
57
|
+
uses: astral-sh/setup-uv@v4
|
|
58
|
+
with:
|
|
59
|
+
version: "latest"
|
|
60
|
+
|
|
61
|
+
- name: Build package
|
|
62
|
+
run: uv build
|
|
63
|
+
|
|
64
|
+
- name: Check package
|
|
65
|
+
run: |
|
|
66
|
+
pip install twine
|
|
67
|
+
twine check dist/*
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
target:
|
|
9
|
+
description: "Target repository"
|
|
10
|
+
required: true
|
|
11
|
+
default: "testpypi"
|
|
12
|
+
type: choice
|
|
13
|
+
options:
|
|
14
|
+
- testpypi
|
|
15
|
+
- pypi
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.11"
|
|
27
|
+
|
|
28
|
+
- name: Install uv
|
|
29
|
+
uses: astral-sh/setup-uv@v4
|
|
30
|
+
with:
|
|
31
|
+
version: "latest"
|
|
32
|
+
|
|
33
|
+
- name: Build package
|
|
34
|
+
run: uv build
|
|
35
|
+
|
|
36
|
+
- name: Upload artifacts
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
|
|
42
|
+
publish-testpypi:
|
|
43
|
+
needs: build
|
|
44
|
+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi'
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment: testpypi
|
|
47
|
+
permissions:
|
|
48
|
+
id-token: write
|
|
49
|
+
steps:
|
|
50
|
+
- name: Download artifacts
|
|
51
|
+
uses: actions/download-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: dist
|
|
54
|
+
path: dist/
|
|
55
|
+
|
|
56
|
+
- name: Publish to TestPyPI
|
|
57
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
58
|
+
with:
|
|
59
|
+
repository-url: https://test.pypi.org/legacy/
|
|
60
|
+
|
|
61
|
+
publish-pypi:
|
|
62
|
+
needs: build
|
|
63
|
+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi')
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
environment: pypi
|
|
66
|
+
permissions:
|
|
67
|
+
id-token: write
|
|
68
|
+
steps:
|
|
69
|
+
- name: Download artifacts
|
|
70
|
+
uses: actions/download-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: dist
|
|
73
|
+
path: dist/
|
|
74
|
+
|
|
75
|
+
- name: Publish to PyPI
|
|
76
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
77
|
+
with:
|
|
78
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
|
|
51
|
+
# Translations
|
|
52
|
+
*.mo
|
|
53
|
+
*.pot
|
|
54
|
+
|
|
55
|
+
# Django stuff:
|
|
56
|
+
*.log
|
|
57
|
+
local_settings.py
|
|
58
|
+
db.sqlite3
|
|
59
|
+
db.sqlite3-journal
|
|
60
|
+
|
|
61
|
+
# Flask stuff:
|
|
62
|
+
instance/
|
|
63
|
+
.webassets-cache
|
|
64
|
+
|
|
65
|
+
# Scrapy stuff:
|
|
66
|
+
.scrapy
|
|
67
|
+
|
|
68
|
+
# Sphinx documentation
|
|
69
|
+
docs/_build/
|
|
70
|
+
|
|
71
|
+
# PyBuilder
|
|
72
|
+
.pybuilder/
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter Notebook
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# IPython
|
|
79
|
+
profile_default/
|
|
80
|
+
ipython_config.py
|
|
81
|
+
|
|
82
|
+
# pyenv
|
|
83
|
+
.python-version
|
|
84
|
+
|
|
85
|
+
# pipenv
|
|
86
|
+
Pipfile.lock
|
|
87
|
+
|
|
88
|
+
# poetry
|
|
89
|
+
poetry.lock
|
|
90
|
+
|
|
91
|
+
# pdm
|
|
92
|
+
.pdm.toml
|
|
93
|
+
.pdm-python
|
|
94
|
+
.pdm-build/
|
|
95
|
+
|
|
96
|
+
# PEP 582
|
|
97
|
+
__pypackages__/
|
|
98
|
+
|
|
99
|
+
# Celery stuff
|
|
100
|
+
celerybeat-schedule
|
|
101
|
+
celerybeat.pid
|
|
102
|
+
|
|
103
|
+
# SageMath parsed files
|
|
104
|
+
*.sage.py
|
|
105
|
+
|
|
106
|
+
# Environments
|
|
107
|
+
.env
|
|
108
|
+
.venv
|
|
109
|
+
env/
|
|
110
|
+
venv/
|
|
111
|
+
ENV/
|
|
112
|
+
env.bak/
|
|
113
|
+
venv.bak/
|
|
114
|
+
|
|
115
|
+
# Spyder project settings
|
|
116
|
+
.spyderproject
|
|
117
|
+
.spyproject
|
|
118
|
+
|
|
119
|
+
# Rope project settings
|
|
120
|
+
.ropeproject
|
|
121
|
+
|
|
122
|
+
# mkdocs documentation
|
|
123
|
+
/site
|
|
124
|
+
|
|
125
|
+
# mypy
|
|
126
|
+
.mypy_cache/
|
|
127
|
+
.dmypy.json
|
|
128
|
+
dmypy.json
|
|
129
|
+
|
|
130
|
+
# Pyre type checker
|
|
131
|
+
.pyre/
|
|
132
|
+
|
|
133
|
+
# pytype static type analyzer
|
|
134
|
+
.pytype/
|
|
135
|
+
|
|
136
|
+
# Cython debug symbols
|
|
137
|
+
cython_debug/
|
|
138
|
+
|
|
139
|
+
# VS Code
|
|
140
|
+
.vscode/
|
|
141
|
+
|
|
142
|
+
# JetBrains IDEs
|
|
143
|
+
.idea/
|
|
144
|
+
|
|
145
|
+
# macOS
|
|
146
|
+
.DS_Store
|
|
147
|
+
.AppleDouble
|
|
148
|
+
.LSOverride
|
|
149
|
+
|
|
150
|
+
# Thumbnails
|
|
151
|
+
._*
|
|
152
|
+
|
|
153
|
+
# Files that might appear in the root of a volume
|
|
154
|
+
.DocumentRevisions-V100
|
|
155
|
+
.fseventsd
|
|
156
|
+
.Spotlight-V100
|
|
157
|
+
.TemporaryItems
|
|
158
|
+
.Trashes
|
|
159
|
+
.VolumeIcon.icns
|
|
160
|
+
.com.apple.timemachine.donotpresent
|
|
161
|
+
|
|
162
|
+
# Directories potentially created on remote AFP share
|
|
163
|
+
.AppleDB
|
|
164
|
+
.AppleDesktop
|
|
165
|
+
Network Trash Folder
|
|
166
|
+
Temporary Items
|
|
167
|
+
.apdisk
|
|
168
|
+
|
|
169
|
+
# Windows
|
|
170
|
+
Thumbs.db
|
|
171
|
+
Thumbs.db:encryptable
|
|
172
|
+
ehthumbs.db
|
|
173
|
+
ehthumbs_vista.db
|
|
174
|
+
*.stackdump
|
|
175
|
+
[Dd]esktop.ini
|
|
176
|
+
$RECYCLE.BIN/
|
|
177
|
+
*.cab
|
|
178
|
+
*.msi
|
|
179
|
+
*.msix
|
|
180
|
+
*.msm
|
|
181
|
+
*.msp
|
|
182
|
+
*.lnk
|
|
183
|
+
|
|
184
|
+
# uv
|
|
185
|
+
uv.lock
|
|
186
|
+
|
|
187
|
+
# Ruff
|
|
188
|
+
.ruff_cache/
|
|
189
|
+
|
|
190
|
+
# Generated test projects
|
|
191
|
+
test_output/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial project structure with uv package management
|
|
13
|
+
- Design document (DESIGN.md)
|
|
14
|
+
- Development task tracking (TODO.md)
|
|
15
|
+
- CLI framework with Typer and Rich terminal output
|
|
16
|
+
- `forge version` and `forge create` commands
|
|
17
|
+
- Interactive prompts with Questionary for project configuration
|
|
18
|
+
- `ProjectConfig` Pydantic model with validation
|
|
19
|
+
- `PackageManager` enum (uv, poetry, pip)
|
|
20
|
+
- `DatabaseType` enum (postgres, mysql, sqlite, none)
|
|
21
|
+
- Non-interactive mode support (`-y` / `--no-interactive` flag)
|
|
22
|
+
- Jinja2 template engine for project generation (`generator.py`)
|
|
23
|
+
- Complete base project templates:
|
|
24
|
+
- FastAPI application structure (api, core, services, daos, models, schemas)
|
|
25
|
+
- SQLAlchemy 2.0 async database configuration
|
|
26
|
+
- Alembic migration setup
|
|
27
|
+
- JWT authentication module
|
|
28
|
+
- Redis integration
|
|
29
|
+
- Docker and docker-compose configuration
|
|
30
|
+
- Pytest testing framework with conftest.py
|
|
31
|
+
- Ruff linter configuration
|
|
32
|
+
- GitHub Actions CI workflow
|
|
33
|
+
- VS Code configuration (settings, launch, extensions)
|
|
34
|
+
- Unit tests for CLI, models, and generator (31 tests passing)
|
|
35
|
+
|
|
36
|
+
## [0.1.0] - TBD
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- CLI framework with Typer
|
|
41
|
+
- Interactive project creation with Questionary
|
|
42
|
+
- Support for uv, Poetry, and pip package managers
|
|
43
|
+
- PostgreSQL, MySQL, and SQLite database templates
|
|
44
|
+
- SQLAlchemy 2.0 async models
|
|
45
|
+
- Alembic migration templates
|
|
46
|
+
- JWT authentication module
|
|
47
|
+
- Docker and docker-compose templates
|
|
48
|
+
- Pytest testing framework templates
|
|
49
|
+
- Ruff linter/formatter configuration
|
|
50
|
+
- GitHub Actions CI template
|
|
51
|
+
- VS Code configuration templates
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Contributing to ForgeAPI
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to ForgeAPI! 🎉
|
|
4
|
+
|
|
5
|
+
## 📋 Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Code of Conduct](#code-of-conduct)
|
|
8
|
+
- [Getting Started](#getting-started)
|
|
9
|
+
- [Development Setup](#development-setup)
|
|
10
|
+
- [Making Changes](#making-changes)
|
|
11
|
+
- [Testing](#testing)
|
|
12
|
+
- [Submitting Changes](#submitting-changes)
|
|
13
|
+
- [Style Guide](#style-guide)
|
|
14
|
+
|
|
15
|
+
## Code of Conduct
|
|
16
|
+
|
|
17
|
+
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
1. **Fork the repository** on GitHub
|
|
22
|
+
2. **Clone your fork** locally:
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/YOUR_USERNAME/forgeapi.git
|
|
25
|
+
cd forgeapi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Development Setup
|
|
29
|
+
|
|
30
|
+
### Prerequisites
|
|
31
|
+
|
|
32
|
+
- Python 3.10 or higher
|
|
33
|
+
- [uv](https://docs.astral.sh/uv/) (recommended)
|
|
34
|
+
|
|
35
|
+
### Install Dependencies
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Install uv if you haven't already
|
|
39
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
40
|
+
|
|
41
|
+
# Create virtual environment and install dependencies
|
|
42
|
+
uv sync --group dev
|
|
43
|
+
|
|
44
|
+
# Activate the virtual environment
|
|
45
|
+
source .venv/bin/activate
|
|
46
|
+
|
|
47
|
+
# Verify installation
|
|
48
|
+
forge version
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Project Structure
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
forgeapi/
|
|
55
|
+
├── fastapi_forge/ # Main package
|
|
56
|
+
│ ├── __init__.py
|
|
57
|
+
│ ├── cli.py # CLI entry point
|
|
58
|
+
│ ├── commands/ # Command implementations
|
|
59
|
+
│ ├── generator.py # Template engine
|
|
60
|
+
│ ├── models.py # Data models
|
|
61
|
+
│ ├── prompts.py # Interactive prompts
|
|
62
|
+
│ └── templates/ # Jinja2 templates
|
|
63
|
+
├── tests/ # Test suite
|
|
64
|
+
├── pyproject.toml # Project configuration
|
|
65
|
+
├── DESIGN.md # Design document
|
|
66
|
+
├── TODO.md # Development tasks
|
|
67
|
+
└── CHANGELOG.md # Changelog
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Making Changes
|
|
71
|
+
|
|
72
|
+
### Branch Naming
|
|
73
|
+
|
|
74
|
+
Use descriptive branch names:
|
|
75
|
+
|
|
76
|
+
- `feature/add-mongodb-support`
|
|
77
|
+
- `fix/template-rendering-bug`
|
|
78
|
+
- `docs/update-readme`
|
|
79
|
+
- `refactor/simplify-generator`
|
|
80
|
+
|
|
81
|
+
### Creating a Branch
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git checkout -b feature/your-feature-name
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Commit Messages
|
|
88
|
+
|
|
89
|
+
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
<type>(<scope>): <description>
|
|
93
|
+
|
|
94
|
+
[optional body]
|
|
95
|
+
|
|
96
|
+
[optional footer(s)]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Types:**
|
|
100
|
+
|
|
101
|
+
- `feat`: New feature
|
|
102
|
+
- `fix`: Bug fix
|
|
103
|
+
- `docs`: Documentation changes
|
|
104
|
+
- `style`: Code style changes (formatting, etc.)
|
|
105
|
+
- `refactor`: Code refactoring
|
|
106
|
+
- `test`: Adding or updating tests
|
|
107
|
+
- `chore`: Maintenance tasks
|
|
108
|
+
|
|
109
|
+
**Examples:**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
feat(generator): add MySQL support
|
|
113
|
+
fix(cli): handle keyboard interrupt gracefully
|
|
114
|
+
docs(readme): add installation instructions
|
|
115
|
+
test(models): add ProjectConfig validation tests
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Testing
|
|
119
|
+
|
|
120
|
+
### Running Tests
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Run all tests
|
|
124
|
+
uv run pytest
|
|
125
|
+
|
|
126
|
+
# Run with verbose output
|
|
127
|
+
uv run pytest -v
|
|
128
|
+
|
|
129
|
+
# Run specific test file
|
|
130
|
+
uv run pytest tests/test_generator.py
|
|
131
|
+
|
|
132
|
+
# Run with coverage report
|
|
133
|
+
uv run pytest --cov=fastapi_forge --cov-report=html
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Writing Tests
|
|
137
|
+
|
|
138
|
+
- Place tests in the `tests/` directory
|
|
139
|
+
- Name test files as `test_*.py`
|
|
140
|
+
- Use descriptive test function names: `test_should_generate_project_with_postgres`
|
|
141
|
+
|
|
142
|
+
**Example Test:**
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
import pytest
|
|
146
|
+
from fastapi_forge.models import ProjectConfig, DatabaseType
|
|
147
|
+
|
|
148
|
+
def test_project_config_generates_slug():
|
|
149
|
+
config = ProjectConfig(project_name="My Awesome API")
|
|
150
|
+
assert config.project_slug == "my_awesome_api"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Submitting Changes
|
|
154
|
+
|
|
155
|
+
### Before Submitting
|
|
156
|
+
|
|
157
|
+
1. **Run tests** and ensure all pass:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
uv run pytest
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. **Run linting**:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
uv run ruff check .
|
|
167
|
+
uv run ruff format .
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
3. **Update documentation** if needed
|
|
171
|
+
|
|
172
|
+
4. **Update CHANGELOG.md** with your changes
|
|
173
|
+
|
|
174
|
+
### Pull Request Process
|
|
175
|
+
|
|
176
|
+
1. **Push your branch** to your fork:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
git push origin feature/your-feature-name
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
2. **Open a Pull Request** on GitHub
|
|
183
|
+
|
|
184
|
+
3. **Fill out the PR template** with:
|
|
185
|
+
- Description of changes
|
|
186
|
+
- Related issue (if any)
|
|
187
|
+
- Screenshots (for UI changes)
|
|
188
|
+
|
|
189
|
+
4. **Wait for review** - maintainers will review and provide feedback
|
|
190
|
+
|
|
191
|
+
5. **Address feedback** and update your PR as needed
|
|
192
|
+
|
|
193
|
+
## Style Guide
|
|
194
|
+
|
|
195
|
+
### Python Code Style
|
|
196
|
+
|
|
197
|
+
- Follow [PEP 8](https://pep8.org/)
|
|
198
|
+
- Use [Ruff](https://docs.astral.sh/ruff/) for linting and formatting
|
|
199
|
+
- Maximum line length: 120 characters
|
|
200
|
+
- Use type hints for function signatures
|
|
201
|
+
|
|
202
|
+
**Example:**
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
from pathlib import Path
|
|
206
|
+
|
|
207
|
+
def generate_project(
|
|
208
|
+
config: ProjectConfig,
|
|
209
|
+
output_dir: Path | None = None,
|
|
210
|
+
) -> list[Path]:
|
|
211
|
+
"""
|
|
212
|
+
Generate a FastAPI project from templates.
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
config: Project configuration
|
|
216
|
+
output_dir: Output directory (default: current directory)
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
List of paths to generated files
|
|
220
|
+
"""
|
|
221
|
+
...
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Template Style
|
|
225
|
+
|
|
226
|
+
- Use `.jinja` extension for template files
|
|
227
|
+
- Use meaningful variable names
|
|
228
|
+
- Add conditional blocks for optional features
|
|
229
|
+
|
|
230
|
+
**Example:**
|
|
231
|
+
|
|
232
|
+
```jinja
|
|
233
|
+
{% if use_database %}
|
|
234
|
+
from app.core.database import get_db
|
|
235
|
+
{% endif %}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## 🙏 Thank You!
|
|
239
|
+
|
|
240
|
+
Your contributions help make ForgeAPI better for everyone. We appreciate your time and effort!
|
|
241
|
+
|
|
242
|
+
If you have any questions, feel free to open an issue or reach out to the maintainers.
|