Skip to content

Commit bda4ef5

Browse files
committed
fix: docs
1 parent 5d48a4f commit bda4ef5

File tree

9 files changed

+2416
-154
lines changed

9 files changed

+2416
-154
lines changed

docs/configurations/index.md

Lines changed: 288 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,292 @@
1-
# Configurations
1+
# Configuration Reference
22

3-
!!! TIPS
4-
Looking for a getting started guide? Check out the [Gettting Started](../getting-started/index.md) guide first.
3+
This section provides detailed information about how each tool in this template is configured. Understanding these configurations will help you customize the environment to match your project's specific needs.
54

6-
Configurations for using Python with uv on Dev Container.
7-
Learn more about using this repository:
5+
## Overview
86

9-
- [Understanding uv Configure](uv.md)
10-
- [Understanding Ruff Configure](ruff.md)
11-
- [Understanding pre-commit Configure](pre-commit.md)
12-
- [Understanding Pyright Configure](pyright.md)
13-
- [Understanding Test Configure](test.md)
7+
The development environment includes configuration files for:
148

9+
- **uv** - Package management and Python version
10+
- **Ruff** - Linting and formatting rules
11+
- **Pyright** - Type checking strictness
12+
- **pytest** - Testing and coverage
13+
- **pre-commit** - Automated quality checks
14+
15+
Each tool is configured through dedicated configuration files in the repository root.
16+
17+
## Configuration Files
18+
19+
| File | Tool | Purpose |
20+
|------|------|---------|
21+
| `pyproject.toml` | uv, Project | Dependencies and project metadata |
22+
| `ruff.toml` | Ruff | Linting and formatting rules |
23+
| `pyrightconfig.json` | Pyright | Type checking configuration |
24+
| `pytest.ini` | pytest | Testing and coverage settings |
25+
| `.pre-commit-config.yaml` | pre-commit | Hook definitions |
26+
| `noxfile.py` | nox | Task automation |
27+
28+
## Quick Links
29+
30+
Jump to detailed configuration guides:
31+
32+
### [uv Configuration](uv.md)
33+
Learn how uv manages dependencies and Python versions:
34+
- Dependency groups (production vs development)
35+
- Lock file management
36+
- Python version pinning
37+
- Virtual environment handling
38+
39+
**Key file**: `pyproject.toml`
40+
41+
[→ Read full uv configuration guide](uv.md)
42+
43+
### [Ruff Configuration](ruff.md)
44+
Understand Ruff's linting and formatting rules:
45+
- Rule selection (ALL enabled by default)
46+
- Specific rule exclusions
47+
- Per-file rule overrides
48+
- Line length and formatting style
49+
50+
**Key file**: `ruff.toml`
51+
52+
[→ Read full Ruff configuration guide](ruff.md)
53+
54+
### [Pyright Configuration](pyright.md)
55+
Configure type checking behavior:
56+
- Type checking mode (standard)
57+
- Python version target (3.14)
58+
- Include/exclude patterns
59+
- Virtual environment detection
60+
61+
**Key file**: `pyrightconfig.json`
62+
63+
[→ Read full Pyright configuration guide](pyright.md)
64+
65+
### [pytest Configuration](test.md)
66+
Set up testing and coverage:
67+
- Coverage requirements (75% minimum)
68+
- Test discovery patterns
69+
- Coverage reports (HTML + terminal)
70+
- pytest plugins and options
71+
72+
**Key file**: `pytest.ini`
73+
74+
[→ Read full pytest configuration guide](test.md)
75+
76+
### [pre-commit Configuration](pre-commit.md)
77+
Configure automated hooks:
78+
- Ruff formatting and linting hooks
79+
- File validation hooks
80+
- Dockerfile linting
81+
- Hook execution order
82+
83+
**Key file**: `.pre-commit-config.yaml`
84+
85+
[→ Read full pre-commit configuration guide](pre-commit.md)
86+
87+
## Common Configuration Tasks
88+
89+
### Adjusting Code Quality Standards
90+
91+
**Make linting more strict:**
92+
```toml
93+
# ruff.toml
94+
[lint]
95+
select = ["ALL"]
96+
ignore = [] # Remove exclusions to enable all rules
97+
```
98+
99+
**Increase coverage requirements:**
100+
```ini
101+
# pytest.ini
102+
[pytest]
103+
addopts = --cov-fail-under=90 # Increase from 75% to 90%
104+
```
105+
106+
**Enable stricter type checking:**
107+
```json
108+
// pyrightconfig.json
109+
{
110+
"typeCheckingMode": "strict" // Change from "standard"
111+
}
112+
```
113+
114+
### Adding New Dependencies
115+
116+
**Add production dependency:**
117+
```bash
118+
uv add requests
119+
```
120+
121+
**Add development dependency:**
122+
```bash
123+
uv add --dev pytest-mock
124+
```
125+
126+
Both commands automatically update `pyproject.toml` and `uv.lock`.
127+
128+
### Customizing for Your Project
129+
130+
**Update project metadata:**
131+
```toml
132+
# pyproject.toml
133+
[project]
134+
name = "your-project-name"
135+
version = "1.0.0"
136+
description = "Your project description"
137+
requires-python = ">=3.10"
138+
```
139+
140+
**Configure FastAPI settings:**
141+
```bash
142+
# .env.local
143+
DEBUG=true
144+
TITLE=Your API Name
145+
VERSION=1.0.0
146+
API_PREFIX_V1=/api/v1
147+
```
148+
149+
## Configuration Best Practices
150+
151+
### 1. Start with Defaults
152+
153+
The default configurations are production-tested. Only modify when you have a specific need.
154+
155+
### 2. Document Changes
156+
157+
If you modify configurations, document why:
158+
159+
```toml
160+
# ruff.toml
161+
[lint]
162+
ignore = [
163+
"D100", # Exclude module docstrings (team decision 2024-01-15)
164+
]
165+
```
166+
167+
### 3. Keep Configurations Consistent
168+
169+
Ensure configurations work together:
170+
- Ruff's line length should match your formatting preferences
171+
- Python version in `pyrightconfig.json` should match `pyproject.toml`
172+
- Test patterns should align with your file structure
173+
174+
### 4. Version Control
175+
176+
Commit configuration files to git:
177+
```bash
178+
git add pyproject.toml ruff.toml pyrightconfig.json pytest.ini .pre-commit-config.yaml
179+
git commit -m "Update project configurations"
180+
```
181+
182+
**Exception**: Never commit `.env.local` (contains local secrets)
183+
184+
### 5. Team Alignment
185+
186+
Configuration changes affect the entire team. Discuss before making major changes:
187+
- Changing coverage requirements
188+
- Modifying linting rules
189+
- Updating Python version requirements
190+
191+
## Troubleshooting
192+
193+
### Conflicts Between Tools
194+
195+
**Ruff and other formatters:**
196+
The template is configured to avoid conflicts. If you add other formatters, they may conflict with Ruff.
197+
198+
**Solution**: Use Ruff exclusively (it replaces Black, isort, etc.)
199+
200+
### VSCode Not Picking Up Changes
201+
202+
After modifying configurations:
203+
204+
1. Reload the VSCode window: `Cmd/Ctrl+Shift+P` → "Developer: Reload Window"
205+
2. Ensure the Dev Container rebuilt if you changed `devcontainer.json`
206+
207+
### Pre-commit Hooks Failing
208+
209+
If hooks fail after configuration changes:
210+
211+
```bash
212+
# Update pre-commit hooks
213+
uv run pre-commit autoupdate
214+
215+
# Reinstall hooks
216+
uv run pre-commit uninstall
217+
uv run pre-commit install
218+
```
219+
220+
## Advanced Configuration
221+
222+
### Multi-Environment Setup
223+
224+
Use different configurations for different environments:
225+
226+
```python
227+
# Load config based on environment
228+
from tools.config import Settings
229+
230+
settings = Settings()
231+
232+
if settings.IS_LOCAL:
233+
# Use local database
234+
DATABASE_URL = "sqlite:///./dev.db"
235+
else:
236+
# Use production database
237+
DATABASE_URL = settings.PRODUCTION_DATABASE_URL
238+
```
239+
240+
### CI/CD Configuration
241+
242+
GitHub Actions workflows use the same configurations:
243+
244+
```yaml
245+
# .github/workflows/test.yml
246+
- name: Run tests
247+
run: uv run nox -s test
248+
```
249+
250+
Ensure CI and local environments use identical configurations.
251+
252+
## Migration Guide
253+
254+
### From pip to uv
255+
256+
If migrating from pip:
257+
258+
```bash
259+
# Export current dependencies
260+
pip freeze > requirements.txt
261+
262+
# Add to pyproject.toml
263+
uv add $(cat requirements.txt)
264+
265+
# Remove old files
266+
rm requirements.txt
267+
```
268+
269+
### From Black/isort to Ruff
270+
271+
Ruff replaces both. Remove old configs:
272+
273+
```bash
274+
# Remove old configuration files
275+
rm .black.toml setup.cfg .isort.cfg
276+
277+
# Configure Ruff in ruff.toml (already done in template)
278+
```
279+
280+
## Next Steps
281+
282+
- **Customize your setup**: Read the detailed configuration guides
283+
- **Understand the tools**: Check the [Development Guides](../guides/index.md)
284+
- **See it in action**: Browse [Use Cases](../usecases/index.md)
285+
286+
## Getting Help
287+
288+
- **uv**: [Official Documentation](https://docs.astral.sh/uv)
289+
- **Ruff**: [Official Documentation](https://docs.astral.sh/ruff)
290+
- **Pyright**: [Official Documentation](https://github.com/microsoft/pyright)
291+
- **pytest**: [Official Documentation](https://docs.pytest.org)
292+
- **pre-commit**: [Official Documentation](https://pre-commit.com)

0 commit comments

Comments
 (0)