red64-cli 0.1.0 → 0.3.0
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.
- package/README.md +1 -2
- package/dist/cli/parseArgs.d.ts.map +1 -1
- package/dist/cli/parseArgs.js +5 -0
- package/dist/cli/parseArgs.js.map +1 -1
- package/dist/components/init/CompleteStep.d.ts.map +1 -1
- package/dist/components/init/CompleteStep.js +2 -2
- package/dist/components/init/CompleteStep.js.map +1 -1
- package/dist/components/init/TestCheckStep.d.ts +16 -0
- package/dist/components/init/TestCheckStep.d.ts.map +1 -0
- package/dist/components/init/TestCheckStep.js +120 -0
- package/dist/components/init/TestCheckStep.js.map +1 -0
- package/dist/components/init/index.d.ts +1 -0
- package/dist/components/init/index.d.ts.map +1 -1
- package/dist/components/init/index.js +1 -0
- package/dist/components/init/index.js.map +1 -1
- package/dist/components/init/types.d.ts +9 -0
- package/dist/components/init/types.d.ts.map +1 -1
- package/dist/components/screens/InitScreen.d.ts.map +1 -1
- package/dist/components/screens/InitScreen.js +69 -6
- package/dist/components/screens/InitScreen.js.map +1 -1
- package/dist/components/screens/ListScreen.d.ts.map +1 -1
- package/dist/components/screens/ListScreen.js +28 -3
- package/dist/components/screens/ListScreen.js.map +1 -1
- package/dist/components/screens/StartScreen.d.ts.map +1 -1
- package/dist/components/screens/StartScreen.js +212 -13
- package/dist/components/screens/StartScreen.js.map +1 -1
- package/dist/components/ui/ArtifactsSidebar.d.ts +19 -0
- package/dist/components/ui/ArtifactsSidebar.d.ts.map +1 -0
- package/dist/components/ui/ArtifactsSidebar.js +51 -0
- package/dist/components/ui/ArtifactsSidebar.js.map +1 -0
- package/dist/components/ui/FeatureSidebar.d.ts.map +1 -1
- package/dist/components/ui/FeatureSidebar.js +1 -1
- package/dist/components/ui/FeatureSidebar.js.map +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/services/ClaudeErrorDetector.js +3 -3
- package/dist/services/ClaudeErrorDetector.js.map +1 -1
- package/dist/services/ConfigService.d.ts +1 -0
- package/dist/services/ConfigService.d.ts.map +1 -1
- package/dist/services/ConfigService.js.map +1 -1
- package/dist/services/ProjectDetector.d.ts +28 -0
- package/dist/services/ProjectDetector.d.ts.map +1 -0
- package/dist/services/ProjectDetector.js +236 -0
- package/dist/services/ProjectDetector.js.map +1 -0
- package/dist/services/TestRunner.d.ts +46 -0
- package/dist/services/TestRunner.d.ts.map +1 -0
- package/dist/services/TestRunner.js +85 -0
- package/dist/services/TestRunner.js.map +1 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -0
- package/dist/services/index.js.map +1 -1
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/framework/.red64/settings/templates/specs/gap-analysis.md +163 -0
- package/framework/agents/claude/.claude/agents/red64/spec-impl.md +131 -2
- package/framework/agents/claude/.claude/agents/red64/validate-gap.md +13 -7
- package/framework/agents/claude/.claude/commands/red64/spec-impl.md +24 -0
- package/framework/agents/claude/.claude/commands/red64/validate-gap.md +4 -0
- package/framework/agents/codex/.codex/agents/red64/spec-impl.md +131 -2
- package/framework/agents/codex/.codex/agents/red64/validate-gap.md +13 -7
- package/framework/agents/codex/.codex/commands/red64/spec-impl.md +24 -0
- package/framework/agents/codex/.codex/commands/red64/validate-gap.md +4 -0
- package/framework/stacks/generic/feedback.md +80 -0
- package/framework/stacks/nextjs/accessibility.md +437 -0
- package/framework/stacks/nextjs/api.md +431 -0
- package/framework/stacks/nextjs/coding-style.md +282 -0
- package/framework/stacks/nextjs/commenting.md +226 -0
- package/framework/stacks/nextjs/components.md +411 -0
- package/framework/stacks/nextjs/conventions.md +333 -0
- package/framework/stacks/nextjs/css.md +310 -0
- package/framework/stacks/nextjs/error-handling.md +442 -0
- package/framework/stacks/nextjs/feedback.md +124 -0
- package/framework/stacks/nextjs/migrations.md +332 -0
- package/framework/stacks/nextjs/models.md +362 -0
- package/framework/stacks/nextjs/queries.md +410 -0
- package/framework/stacks/nextjs/responsive.md +338 -0
- package/framework/stacks/nextjs/tech-stack.md +177 -0
- package/framework/stacks/nextjs/test-writing.md +475 -0
- package/framework/stacks/nextjs/validation.md +467 -0
- package/framework/stacks/python/api.md +468 -0
- package/framework/stacks/python/authentication.md +342 -0
- package/framework/stacks/python/code-quality.md +283 -0
- package/framework/stacks/python/code-refactoring.md +315 -0
- package/framework/stacks/python/coding-style.md +462 -0
- package/framework/stacks/python/conventions.md +399 -0
- package/framework/stacks/python/error-handling.md +512 -0
- package/framework/stacks/python/feedback.md +92 -0
- package/framework/stacks/python/implement-ai-llm.md +468 -0
- package/framework/stacks/python/migrations.md +388 -0
- package/framework/stacks/python/models.md +399 -0
- package/framework/stacks/python/python.md +232 -0
- package/framework/stacks/python/queries.md +451 -0
- package/framework/stacks/python/structure.md +245 -58
- package/framework/stacks/python/tech.md +92 -35
- package/framework/stacks/python/testing.md +380 -0
- package/framework/stacks/python/validation.md +471 -0
- package/framework/stacks/rails/authentication.md +176 -0
- package/framework/stacks/rails/code-quality.md +287 -0
- package/framework/stacks/rails/code-refactoring.md +299 -0
- package/framework/stacks/rails/feedback.md +130 -0
- package/framework/stacks/rails/implement-ai-llm-with-rubyllm.md +342 -0
- package/framework/stacks/rails/rails.md +301 -0
- package/framework/stacks/rails/rails8-best-practices.md +498 -0
- package/framework/stacks/rails/rails8-css.md +573 -0
- package/framework/stacks/rails/structure.md +140 -0
- package/framework/stacks/rails/tech.md +108 -0
- package/framework/stacks/react/code-quality.md +521 -0
- package/framework/stacks/react/components.md +625 -0
- package/framework/stacks/react/data-fetching.md +586 -0
- package/framework/stacks/react/feedback.md +110 -0
- package/framework/stacks/react/forms.md +694 -0
- package/framework/stacks/react/performance.md +640 -0
- package/framework/stacks/react/product.md +22 -9
- package/framework/stacks/react/state-management.md +472 -0
- package/framework/stacks/react/structure.md +351 -44
- package/framework/stacks/react/tech.md +219 -30
- package/framework/stacks/react/testing.md +690 -0
- package/package.json +1 -1
- package/framework/stacks/node/product.md +0 -27
- package/framework/stacks/node/structure.md +0 -82
- package/framework/stacks/node/tech.md +0 -63
|
@@ -1,78 +1,265 @@
|
|
|
1
1
|
# Project Structure
|
|
2
2
|
|
|
3
|
-
## Project: {{projectName}}
|
|
4
|
-
|
|
5
3
|
## Organization Philosophy
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
Modern Python packaging with `src` layout. Clear separation between application code, tests, and configuration. Domain-driven modules as complexity grows.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
8
|
|
|
9
9
|
## Directory Patterns
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
11
|
+
### Root Layout
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
project-root/
|
|
15
|
+
pyproject.toml # Project metadata, dependencies, tool config
|
|
16
|
+
uv.lock # Locked dependencies
|
|
17
|
+
.python-version # Python version pin
|
|
18
|
+
alembic.ini # Migration config
|
|
19
|
+
docker-compose.yml # Local services
|
|
20
|
+
Dockerfile # Production image
|
|
21
|
+
.env.example # Environment template (never commit .env)
|
|
22
|
+
src/
|
|
23
|
+
app/ # Application package
|
|
24
|
+
tests/ # Test suite
|
|
25
|
+
migrations/ # Alembic migrations
|
|
26
|
+
scripts/ # Utility scripts
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Application Core (`src/app/`)
|
|
30
|
+
|
|
31
|
+
**Purpose**: All application code in a single installable package
|
|
32
|
+
**Pattern**: Domain modules with clear boundaries
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
src/app/
|
|
36
|
+
__init__.py
|
|
37
|
+
main.py # Application entry point, ASGI app factory
|
|
38
|
+
config.py # Settings via pydantic-settings
|
|
39
|
+
dependencies.py # Dependency injection setup
|
|
40
|
+
models/ # SQLAlchemy/Django models
|
|
41
|
+
__init__.py
|
|
42
|
+
user.py
|
|
43
|
+
content.py
|
|
44
|
+
base.py # Base model with common fields
|
|
45
|
+
schemas/ # Pydantic request/response models
|
|
46
|
+
__init__.py
|
|
47
|
+
user.py
|
|
48
|
+
content.py
|
|
49
|
+
services/ # Business logic layer
|
|
50
|
+
__init__.py
|
|
51
|
+
user_service.py
|
|
52
|
+
content_service.py
|
|
53
|
+
api/ # Route handlers (FastAPI routers)
|
|
54
|
+
__init__.py
|
|
55
|
+
v1/
|
|
56
|
+
__init__.py
|
|
57
|
+
users.py
|
|
58
|
+
content.py
|
|
59
|
+
repositories/ # Data access layer
|
|
60
|
+
__init__.py
|
|
61
|
+
user_repo.py
|
|
62
|
+
content_repo.py
|
|
63
|
+
middleware/ # ASGI middleware
|
|
64
|
+
__init__.py
|
|
65
|
+
auth.py
|
|
66
|
+
logging.py
|
|
67
|
+
tasks/ # Background tasks (Celery/arq)
|
|
68
|
+
__init__.py
|
|
69
|
+
content_tasks.py
|
|
70
|
+
utils/ # Shared utilities
|
|
71
|
+
__init__.py
|
|
72
|
+
hashing.py
|
|
73
|
+
pagination.py
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Naming Conventions
|
|
77
|
+
|
|
78
|
+
| Type | Pattern | Example |
|
|
79
|
+
|------|---------|---------|
|
|
80
|
+
| Packages | snake_case | `user_service/`, `api/` |
|
|
81
|
+
| Modules | snake_case | `user_service.py`, `auth_middleware.py` |
|
|
82
|
+
| Models | PascalCase, singular | `User`, `ContentVersion` |
|
|
83
|
+
| Schemas | PascalCase + purpose | `CreateUserRequest`, `UserResponse` |
|
|
84
|
+
| Services | PascalCase + Service | `UserService`, `ContentService` |
|
|
85
|
+
| Repositories | PascalCase + Repo/Repository | `UserRepo` |
|
|
86
|
+
| Tables | plural, snake_case | `users`, `content_versions` |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Package Configuration (`pyproject.toml`)
|
|
91
|
+
|
|
92
|
+
### Minimal Structure
|
|
93
|
+
|
|
94
|
+
```toml
|
|
95
|
+
[project]
|
|
96
|
+
name = "my-app"
|
|
97
|
+
version = "0.1.0"
|
|
98
|
+
requires-python = ">=3.12"
|
|
99
|
+
dependencies = [
|
|
100
|
+
"fastapi>=0.115",
|
|
101
|
+
"uvicorn[standard]>=0.30",
|
|
102
|
+
"sqlalchemy[asyncio]>=2.0",
|
|
103
|
+
"pydantic>=2.0",
|
|
104
|
+
"pydantic-settings>=2.0",
|
|
105
|
+
"asyncpg>=0.29",
|
|
106
|
+
"redis>=5.0",
|
|
107
|
+
"alembic>=1.13",
|
|
108
|
+
]
|
|
109
|
+
|
|
110
|
+
[project.optional-dependencies]
|
|
111
|
+
dev = [
|
|
112
|
+
"pytest>=8.0",
|
|
113
|
+
"pytest-asyncio>=0.24",
|
|
114
|
+
"pytest-cov>=5.0",
|
|
115
|
+
"factory-boy>=3.3",
|
|
116
|
+
"faker>=30.0",
|
|
117
|
+
"httpx>=0.27",
|
|
118
|
+
"ruff>=0.8",
|
|
119
|
+
"mypy>=1.13",
|
|
120
|
+
"pre-commit>=4.0",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[build-system]
|
|
124
|
+
requires = ["hatchling"]
|
|
125
|
+
build-backend = "hatchling.build"
|
|
126
|
+
|
|
127
|
+
[tool.hatch.build.targets.wheel]
|
|
128
|
+
packages = ["src/app"]
|
|
129
|
+
|
|
130
|
+
[tool.ruff]
|
|
131
|
+
target-version = "py312"
|
|
132
|
+
src = ["src"]
|
|
133
|
+
|
|
134
|
+
[tool.ruff.lint]
|
|
135
|
+
select = ["E", "F", "I", "N", "UP", "B", "A", "SIM", "TCH", "RUF"]
|
|
136
|
+
|
|
137
|
+
[tool.mypy]
|
|
138
|
+
python_version = "3.12"
|
|
139
|
+
strict = true
|
|
140
|
+
plugins = ["pydantic.mypy"]
|
|
141
|
+
|
|
142
|
+
[tool.pytest.ini_options]
|
|
143
|
+
testpaths = ["tests"]
|
|
144
|
+
asyncio_mode = "auto"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
53
148
|
|
|
54
149
|
## Import Organization
|
|
55
150
|
|
|
151
|
+
### Pattern: Absolute Imports
|
|
152
|
+
|
|
56
153
|
```python
|
|
57
|
-
#
|
|
154
|
+
# Standard library
|
|
155
|
+
from collections.abc import AsyncIterator
|
|
58
156
|
from datetime import datetime
|
|
59
|
-
from typing import Optional
|
|
60
157
|
|
|
61
|
-
#
|
|
62
|
-
from fastapi import
|
|
63
|
-
from
|
|
158
|
+
# Third-party
|
|
159
|
+
from fastapi import APIRouter, Depends, HTTPException
|
|
160
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
64
161
|
|
|
65
|
-
#
|
|
66
|
-
from app.
|
|
162
|
+
# Application (absolute from package root)
|
|
163
|
+
from app.models.user import User
|
|
164
|
+
from app.schemas.user import CreateUserRequest, UserResponse
|
|
67
165
|
from app.services.user_service import UserService
|
|
166
|
+
from app.dependencies import get_db, get_current_user
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Ruff enforces import sorting (`I` rules). No manual ordering needed.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Configuration Pattern
|
|
174
|
+
|
|
175
|
+
### Pydantic Settings
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
# src/app/config.py
|
|
179
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
180
|
+
|
|
181
|
+
class Settings(BaseSettings):
|
|
182
|
+
model_config = SettingsConfigDict(
|
|
183
|
+
env_file=".env",
|
|
184
|
+
env_file_encoding="utf-8",
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
# Database
|
|
188
|
+
database_url: str = "postgresql+asyncpg://localhost:5432/myapp"
|
|
189
|
+
|
|
190
|
+
# Redis
|
|
191
|
+
redis_url: str = "redis://localhost:6379/0"
|
|
192
|
+
|
|
193
|
+
# Auth
|
|
194
|
+
secret_key: str
|
|
195
|
+
access_token_expire_minutes: int = 30
|
|
196
|
+
|
|
197
|
+
# External services
|
|
198
|
+
openai_api_key: str = ""
|
|
199
|
+
|
|
200
|
+
settings = Settings()
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Dependency Injection Pattern (FastAPI)
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
# src/app/dependencies.py
|
|
209
|
+
from collections.abc import AsyncIterator
|
|
210
|
+
from fastapi import Depends
|
|
211
|
+
from sqlalchemy.ext.asyncio import AsyncSession
|
|
212
|
+
|
|
213
|
+
async def get_db() -> AsyncIterator[AsyncSession]:
|
|
214
|
+
async with async_session_factory() as session:
|
|
215
|
+
yield session
|
|
216
|
+
|
|
217
|
+
async def get_user_service(
|
|
218
|
+
db: AsyncSession = Depends(get_db),
|
|
219
|
+
) -> UserService:
|
|
220
|
+
return UserService(repo=UserRepo(db))
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Migration Organization (`migrations/`)
|
|
226
|
+
|
|
68
227
|
```
|
|
228
|
+
migrations/
|
|
229
|
+
env.py # Alembic environment config
|
|
230
|
+
versions/
|
|
231
|
+
001_create_users.py
|
|
232
|
+
002_create_content.py
|
|
233
|
+
003_add_user_roles.py
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Naming**: Prefix with sequential number for readability alongside Alembic's revision IDs.
|
|
237
|
+
|
|
238
|
+
---
|
|
69
239
|
|
|
70
|
-
##
|
|
240
|
+
## Test Organization (`tests/`)
|
|
71
241
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
242
|
+
```
|
|
243
|
+
tests/
|
|
244
|
+
conftest.py # Shared fixtures (db, client, factories)
|
|
245
|
+
unit/
|
|
246
|
+
services/
|
|
247
|
+
test_user_service.py
|
|
248
|
+
utils/
|
|
249
|
+
test_hashing.py
|
|
250
|
+
integration/
|
|
251
|
+
api/
|
|
252
|
+
test_users.py
|
|
253
|
+
test_content.py
|
|
254
|
+
repositories/
|
|
255
|
+
test_user_repo.py
|
|
256
|
+
factories/
|
|
257
|
+
user_factory.py
|
|
258
|
+
content_factory.py
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Pattern**: Mirror `src/app/` structure in `tests/`. Separate unit and integration tests.
|
|
76
262
|
|
|
77
263
|
---
|
|
78
|
-
|
|
264
|
+
|
|
265
|
+
_Document patterns, not file trees. New files following patterns should not require updates._
|
|
@@ -1,64 +1,121 @@
|
|
|
1
1
|
# Technology Stack
|
|
2
2
|
|
|
3
|
-
## Project: {{projectName}}
|
|
4
|
-
|
|
5
3
|
## Architecture
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
Modern Python application with async-first design. FastAPI or Django as web framework, PostgreSQL for persistence, Redis for caching and task queues, Docker for deployment.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
8
|
|
|
9
9
|
## Core Technologies
|
|
10
10
|
|
|
11
|
-
- **Language**: Python 3.
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
11
|
+
- **Language**: Python 3.12+
|
|
12
|
+
- **Package Manager**: uv (fast, Rust-based)
|
|
13
|
+
- **Web Framework**: FastAPI (API-first) or Django (full-stack)
|
|
14
|
+
- **Database**: PostgreSQL with asyncpg
|
|
15
|
+
- **ORM**: SQLAlchemy 2.0 (async) or Django ORM
|
|
16
|
+
- **Cache/Queue**: Redis with redis-py
|
|
17
|
+
|
|
18
|
+
---
|
|
14
19
|
|
|
15
20
|
## Key Libraries
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
22
|
+
### Web & API
|
|
23
|
+
- **FastAPI**: High-performance async API framework
|
|
24
|
+
- **Uvicorn**: ASGI server (production: with gunicorn)
|
|
25
|
+
- **Pydantic v2**: Request/response validation, settings
|
|
26
|
+
- **python-multipart**: Form/file upload handling
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
### Database & Storage
|
|
29
|
+
- **SQLAlchemy 2.0**: Async ORM with type-safe queries
|
|
30
|
+
- **Alembic**: Database migrations
|
|
31
|
+
- **asyncpg**: Async PostgreSQL driver
|
|
32
|
+
- **boto3**: AWS S3 for file storage (when needed)
|
|
33
|
+
|
|
34
|
+
### Background Tasks
|
|
35
|
+
- **Celery**: Distributed task queue (with Redis broker)
|
|
36
|
+
- **arq**: Lightweight async task queue alternative
|
|
37
|
+
- **APScheduler**: Scheduled/cron jobs
|
|
23
38
|
|
|
24
|
-
###
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
39
|
+
### Deployment
|
|
40
|
+
- **Docker**: Containerized deployment
|
|
41
|
+
- **Docker Compose**: Multi-service local development
|
|
42
|
+
- **Gunicorn + Uvicorn**: Production ASGI serving
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Development Standards
|
|
29
47
|
|
|
30
48
|
### Code Quality
|
|
31
|
-
- Ruff
|
|
32
|
-
-
|
|
33
|
-
-
|
|
49
|
+
- **Ruff**: Linting and formatting (replaces black, isort, flake8)
|
|
50
|
+
- **mypy**: Static type checking (strict mode)
|
|
51
|
+
- **pre-commit**: Git hooks for automated checks
|
|
52
|
+
|
|
53
|
+
### Security
|
|
54
|
+
- **bandit**: Security vulnerability scanner
|
|
55
|
+
- **safety**: Dependency vulnerability scanning
|
|
56
|
+
- **python-dotenv**: Environment-based configuration (never commit `.env`)
|
|
34
57
|
|
|
35
58
|
### Testing
|
|
36
|
-
- pytest
|
|
37
|
-
- pytest-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
59
|
+
- **pytest**: Test framework with fixtures and parametrize
|
|
60
|
+
- **pytest-asyncio**: Async test support
|
|
61
|
+
- **pytest-cov**: Coverage reporting
|
|
62
|
+
- **factory-boy + faker**: Test data generation
|
|
63
|
+
- **httpx**: Async HTTP client for integration tests
|
|
64
|
+
|
|
65
|
+
---
|
|
40
66
|
|
|
41
67
|
## Development Environment
|
|
42
68
|
|
|
43
69
|
### Required Tools
|
|
44
|
-
- Python 3.
|
|
45
|
-
- uv
|
|
46
|
-
-
|
|
70
|
+
- Python 3.12+ (see `.python-version`)
|
|
71
|
+
- uv (package manager)
|
|
72
|
+
- PostgreSQL 16+
|
|
73
|
+
- Redis 7+
|
|
74
|
+
- Docker & Docker Compose
|
|
47
75
|
|
|
48
76
|
### Common Commands
|
|
49
77
|
```bash
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
78
|
+
# Environment setup
|
|
79
|
+
uv sync # Install dependencies
|
|
80
|
+
uv run alembic upgrade head # Run migrations
|
|
81
|
+
|
|
82
|
+
# Dev server
|
|
83
|
+
uv run uvicorn app.main:app --reload # FastAPI
|
|
84
|
+
uv run python manage.py runserver # Django
|
|
85
|
+
|
|
86
|
+
# Tests
|
|
87
|
+
uv run pytest # All tests
|
|
88
|
+
uv run pytest tests/unit/ # Unit tests only
|
|
89
|
+
uv run pytest --cov=src # With coverage
|
|
90
|
+
|
|
91
|
+
# Code quality
|
|
92
|
+
uv run ruff check . # Lint
|
|
93
|
+
uv run ruff format . # Format
|
|
94
|
+
uv run mypy src/ # Type check
|
|
95
|
+
|
|
96
|
+
# Database
|
|
97
|
+
uv run alembic revision --autogenerate -m "description" # New migration
|
|
98
|
+
uv run alembic upgrade head # Apply migrations
|
|
99
|
+
uv run alembic downgrade -1 # Rollback one
|
|
100
|
+
|
|
101
|
+
# Docker
|
|
102
|
+
docker compose up -d # Start services
|
|
103
|
+
docker compose logs -f app # Follow app logs
|
|
54
104
|
```
|
|
55
105
|
|
|
106
|
+
---
|
|
107
|
+
|
|
56
108
|
## Key Technical Decisions
|
|
57
109
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
110
|
+
| Decision | Rationale |
|
|
111
|
+
|----------|-----------|
|
|
112
|
+
| **uv over pip/poetry** | 10-100x faster installs, built-in venv, lockfile support |
|
|
113
|
+
| **Ruff over black+isort+flake8** | Single tool, Rust-based speed, drop-in replacement |
|
|
114
|
+
| **Pydantic v2 over attrs/marshmallow** | Native FastAPI integration, Rust core, JSON Schema |
|
|
115
|
+
| **SQLAlchemy 2.0 async** | Type-safe queries, async support, mature ecosystem |
|
|
116
|
+
| **PostgreSQL over SQLite** | Production-grade, JSONB, full-text search, concurrency |
|
|
117
|
+
| **Redis for cache + queue** | Versatile: caching, Celery broker, pub/sub, rate limiting |
|
|
62
118
|
|
|
63
119
|
---
|
|
64
|
-
|
|
120
|
+
|
|
121
|
+
_Document standards and patterns, not every dependency. See `python.md` for detailed Python conventions._
|