-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cursorrules
64 lines (54 loc) · 1.58 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
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
53
54
55
56
57
58
59
60
61
62
63
64
name: Python Project Structure Rules
version: 1.0.0
rules:
architecture:
- Each module must have an __init__.py file
- Core functionality in 'core' subdirectory
- Supporting components in dedicated subdirectories
- Main entry point in main.py
code_organization:
- One class per file
- File names in snake_case matching primary class name
- Class names in PascalCase
- Method names in snake_case
- Use ABC from abc module for abstract classes
imports:
- Use absolute imports (from mypackage.submodule.module import Class)
- Export public interfaces in __init__.py
- Group: standard library, third-party, local
- No circular dependencies
type_hints:
- Type hints required for all parameters and returns
- Use Optional[] for nullable parameters
- Use typed collections (List, Dict, Set)
documentation:
- Class docstrings required
- Public method docstrings required
- Use """triple quotes"""
- Include parameter descriptions
error_handling:
- Use explicit exception handling
- Custom exceptions for domain-specific errors
testing:
- Test files named test_*.py
- Use pytest
- Maintain high coverage
clean_code:
- Single responsibility principle
- 4 spaces indentation
- No deep nesting
naming_conventions:
files: snake_case
classes: PascalCase
methods: snake_case
variables: snake_case
constants: UPPER_SNAKE_CASE
private_members: _leading_underscore
folder_structure:
src:
- core/
- factories/
- observers/
- utils/
- main.py
- __init__.py