Skip to content

Commit aea5905

Browse files
authored
feat: add FastAPI template generation with all utilities (#88)
* feat: add FastAPI project template and configuration files * feat: implement project generation command with framework validation * feat: add cloud storage support with AWS S3 integration and helper functions * fix: update template path resolution in generate.py * feat: update README template for FastAPI project commands and usage * feat: add Google Cloud Storage support with GCP integration and configuration * feat: add database support with async SQLAlchemy integration and session management * feat: add database support with async SQLAlchemy integration and session management * feat: add testing framework with async fixtures and integration tests for FastAPI * feat: update testing setup and add CLI testing script for FastAPI project * feat: update testing setup and add CLI testing script for FastAPI project * feat: update testing setup and add CLI testing script for FastAPI project * feat: add Azure Blob Storage support with configuration and service implementation * feat: add Azure Blob Storage support with configuration and service implementation * feat: add Azure Storage support to project initialization
1 parent ead08da commit aea5905

File tree

78 files changed

+3760
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3760
-145
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,3 @@ jobs:
5252

5353
- name: Type check
5454
run: uv run basedpyright .
55-
56-
- name: Run MyPy
57-
run: uv run mypy . --install-types --non-interactive

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,4 @@ opencode.json
291291
# END Ruler Generated Files
292292

293293
.cache_ggshield
294+
!.env.jinja

.pre-commit-config.yaml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
repos:
2-
# - hooks:
3-
# - always_run: true
4-
# entry: .hooks/branch
5-
# id: branch-naming
6-
# language: script
7-
# name: Branch naming convention check
8-
# stages:
9-
# - pre-commit
10-
# repo: local
2+
- hooks:
3+
- always_run: true
4+
entry: .hooks/branch
5+
id: branch-naming
6+
language: script
7+
name: Branch naming convention check
8+
stages:
9+
- pre-commit
10+
repo: local
1111
- hooks:
1212
- id: check-ast
1313
language_version: python3.13
@@ -17,11 +17,12 @@ repos:
1717
id: check-yaml
1818
- id: check-toml
1919
- args:
20-
# - --branch
21-
# - main
20+
- --branch
21+
- main
2222
- --branch
2323
- master
2424
id: no-commit-to-branch
25+
2526
repo: https://github.com/pre-commit/pre-commit-hooks
2627
rev: v6.0.0
2728
- hooks:
@@ -32,6 +33,7 @@ repos:
3233
- args:
3334
- --py313-plus
3435
id: pyupgrade
36+
3537
repo: https://github.com/asottile/pyupgrade
3638
rev: v3.20.0
3739
- hooks:
@@ -44,18 +46,15 @@ repos:
4446
- python
4547
repo: local
4648
- hooks:
47-
- entry: uv run ruff check
49+
- entry: uv run ruff check src
4850
id: lint
4951
language: system
5052
name: lint
5153
require_serial: true
5254
types:
5355
- python
5456
repo: local
55-
- hooks:
56-
- id: mypy
57-
repo: https://github.com/pre-commit/mirrors-mypy
58-
rev: v1.18.2
57+
5958
- hooks:
6059
- entry: uv run basedpyright
6160
id: pyright

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ scaffoldr generate my-api
5858

5959
# Generate with specific framework
6060
scaffoldr generate my-api --framework fastapi
61-
scaffoldr generate my-flask-app --framework flask
62-
63-
# Generate with additional options
64-
scaffoldr generate my-project --framework fastapi --database postgres --auth jwt
6561

6662
# Get help
6763
scaffoldr --help
@@ -71,6 +67,21 @@ scaffoldr generate --help
7167
scaffoldr --no-banner generate my-project
7268
```
7369

70+
### Generated Project Features
71+
72+
When you generate a FastAPI project, you get:
73+
74+
- **Complete FastAPI Application**: Pre-configured with proper structure
75+
- **Database Integration**: SQLAlchemy with Alembic migrations
76+
- **File Storage**: Built-in file upload/download endpoints
77+
- **API Documentation**: Auto-generated OpenAPI/Swagger docs
78+
- **Development Tools**: Pre-configured with ruff, mypy, pytest
79+
- **Docker Support**: Ready-to-use Docker configuration
80+
- **Environment Management**: .env support with validation
81+
- **Logging**: Structured logging with proper middleware
82+
- **Error Handling**: Comprehensive exception handling
83+
- **Testing**: Test structure with fixtures and examples
84+
7485
### ✨ Animated Banner
7586

7687
Scaffoldr features a beautiful animated ASCII banner with rainbow wave effects that displays when you run the CLI! The

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies = [
2222
"typer>=0.19.2",
2323
"uv-build>=0.8.22",
2424
"rich>=13.7.0",
25+
"copier>=9.10.2",
2526
]
2627

2728
[dependency-groups]
@@ -55,6 +56,9 @@ build-backend = "uv_build"
5556

5657
[tool.mypy]
5758
mypy_path = ["src"]
59+
exclude = [
60+
"src/scaffoldr/templates/.*",
61+
]
5862
namespace_packages = true
5963
explicit_package_bases = true
6064

pyrightconfig.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"**/__pycache__",
99
"dist",
1010
"build",
11-
".git"
11+
".git",
12+
"templates"
1213
],
1314
"defineConstant": {
1415
"DEBUG": true
@@ -20,5 +21,6 @@
2021
"pythonPlatform": "All",
2122
"useLibraryCodeForTypes": true,
2223
"autoImportCompletions": true,
23-
"reportUnusedCallResult": false
24+
"reportUnusedCallResult": false,
25+
"reportImplicitStringConcatenation": false
2426
}

ruff.toml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
fix = true
2+
line-length = 100
3+
target-version = "py313"
4+
indent-width = 4
5+
exclude = [".venv", "/templates"]
6+
7+
[format]
8+
docstring-code-format = true
9+
docstring-code-line-length = 100
10+
indent-style = "tab"
11+
quote-style = "double"
12+
skip-magic-trailing-comma = false
13+
14+
[lint]
15+
exclude = ["migrations/versions/*", ".venv"]
16+
ignore = [
17+
"E712", # equality comparison messes with SQL
18+
"RUF003", # quotes in comment
19+
"B006", # mutable default arguments like []
20+
"ANN401", # don't allow Any as type
21+
"UP033", # prefer e!s
22+
"S311", # no random generators
23+
"D200", # one line docstring one line
24+
"RUF006", # store ref to create_task
25+
"G004", # logging statement uses f string
26+
"PERF203", # try except in loop
27+
"ANN003", # kwargs type annotation
28+
"EM101", # string literal
29+
"SIM103", # return condition directly
30+
"RET504", # assignment before return
31+
"D205", # docstring rules
32+
"C901", # too complex names for functions
33+
"PERF401", # do not use .append()
34+
"PERF102", # no _ with .items()
35+
"EM102", # F string in exception
36+
"FBT001", # Boolean default args
37+
"FBT002", # Boolean default args
38+
"ANN201", # Return type
39+
"D400", # Docstring period
40+
"D415", # Docstring
41+
"E722", # Bare except
42+
"D401", # Imperative mode
43+
"D417", # Argument description required
44+
"E501", # Line too long (exceeds the maximum line length)
45+
"S101", # Use of assert detected
46+
"S102", # Use of exec detected
47+
"S104", # Possible binding to all interfaces
48+
"S324", # Use of insecure hash function
49+
"EXE002", # File executable but no shebang found
50+
"D100", # Missing docstring in public module
51+
"D102", # Missing docstring in public method
52+
"D203", # 1 blank line required before class docstring
53+
"D206", # Docstring should be indented with spaces, not tabs
54+
"D103", # Missing docstring in public function
55+
"D104", # Missing docstring in public package
56+
"D105", # Missing docstring in magic method
57+
"D106", # Missing docstring in public nested class
58+
"D101", # Missing docstring in public class
59+
"D107", # Missing docstring in __init__
60+
"D212", # Multi-line docstring summary should start at the first line
61+
"D211", # No blank lines allowed before class docstring
62+
"PGH003", # Use specific rule codes when ignoring type issues
63+
"PGH004", # Use specific rule codes when using noqa
64+
"N811", # Constant variable imported as non-constant
65+
"N804", # The first argument of class method should be named 'cls'
66+
"N818", # Error suffix should be used for exception names
67+
"N806", # Variable in function should be lowercase
68+
"N815", # Variable in function should be lowercase
69+
"ARG001", # Unused function argument
70+
"ARG002", # Unused method argument
71+
"DTZ003", # Use of datetime.now() without timezone
72+
"DTZ005", # Use of datetime.utcnow() without timezone
73+
"RSE102", # Use of 'sys.exit()' or 'exit()' detected
74+
"SLF001", # Private member accessed outside of class
75+
"PLR", # Refactoring related issues https://docs.astral.sh/ruff/rules/#refactor-r
76+
"INP", # Implicit namespace package
77+
"TRY", # Tryceptor related issues https://docs.astral.sh/ruff/rules/#tryceratops-try
78+
"SIM300", # Use of 'len(SEQUENCE) == 0' detected
79+
"SIM114", # Use of 'if x is not None' detected
80+
"DJ008", # Model does not define __str__ method
81+
"FIX002", # Line contains
82+
"S603", # Use of 'subprocess.call' detected
83+
"S607", # Use of 'subprocess.run' detected
84+
"TD002", # Missing
85+
"TD003", # Missing
86+
"W191", # Indentation contains tabs
87+
"COM812", # Missing trailing comma
88+
"ISC001", # Handled by formatter (Implicit string concatenation)
89+
"BLE001", # Bare Exception / Blind Exception
90+
"ERA001", # For ignoring False positive commented code like
91+
"S105", # For hardcoded passwords / secrets
92+
"SLOT000", # For using __slots__ without str inherited classes
93+
"PLW2901", # For overriding for loop variable
94+
"S113", # Ruff call without TimeOut
95+
"N812", # Lowercase imported as non-lowercase
96+
"B008", # Don't allow function calls in argument default
97+
]
98+
select = ["ALL"]
99+
100+
[lint.flake8-annotations]
101+
suppress-none-returning = true
102+
103+
[lint.flake8-quotes]
104+
docstring-quotes = "double"
105+
inline-quotes = "double"
106+
multiline-quotes = "double"

0 commit comments

Comments
 (0)