-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.cursorrules
97 lines (84 loc) · 3.19 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Jupy-Juice
Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.
## Project Context
- AI-powered coding companion for Jupyter notebooks
- Built on top of Pydantic AI framework
- Provides interactive AI assistance within Jupyter notebooks
- Focuses on code generation and notebook management
## Code Style and Structure
- Write clean, Pythonic code with type hints
- Use functional programming patterns where appropriate
- Prefer composition over inheritance
- Use descriptive variable names that reflect purpose
- Structure repository files as follows:
```
jupy_juice/ # THIS PART IS AUTOGENERATED USING NBDEV - use nbdev_export terminal commmand to create this files from notebooks
├── core/ # Core functionality
├── agents/ # AI agent implementations
├── tools/ # Tool definitions
├── models/ # Pydantic models
└── utils/ # Helper functions
nbs/
├── index.ipynb # Documentation homepage
└── *.ipynb # Feature documentation
```
## Tech Stack
- Primary stack:
- Python (>=3.10)
- nbdev
- Jupyter Notebooks in VS Code
- Project related libraries:
- Pydantic
- Pydantic-settings
- OpenAI API
## Type Hints
- Use type hints for all function parameters and return values
- Leverage Pydantic models for data validation
- Use Optional[] for nullable fields
- Define clear interfaces using Protocol when needed
- Use TypeVar for generic type definitions
## Jupyter Notebook Specific
- Follow nbdev conventions for notebook documentation
- Include clear markdown documentation in notebooks
- Use #| hide for cells that do not need to be shown in documentation details
- Use #| export for code to be included in the package
- Implement proper error handling in notebook cells
## State Management
- Use environment variables for configuration
- Implement proper cleanup in notebook cells
- Handle notebook context appropriately
- Maintain agent state consistently
## Syntax and Formatting
- Use Ruff for code formatting and linting
- Feel free to use longer line length in coding
- Use docstring format compatible with nbdev
## Error Handling
- Implement proper exception handling
- Use custom exceptions where appropriate
- Provide clear error messages
- Log errors appropriately for debugging
- Handle API failures gracefully
## Testing
- Write unit tests for core functionality
- Test notebook execution
- Test with different Python versions
- Test API integrations
- Include integration tests for notebook features
## Security
- Handle API keys securely
- Use environment variables for sensitive data
- Sanitize user inputs
- Follow security best practices for notebook execution
- Implement proper token management
## Documentation
- Documentation is automatically created from notebooks using nbdev
- README.md is autogenerated from index.ipynb - modify this notebook for documentaion purposes
- Keep notebooks well-documented
- Include usage examples
- Document configuration options
## Development Workflow
- Use nbdev for development
- Follow test-driven development
- Review code changes
- Update documentation
- Maintain changelog