forked from cadence-workflow/cadence-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.cursorrules
More file actions
49 lines (41 loc) · 1.74 KB
/
.cursorrules
File metadata and controls
49 lines (41 loc) · 1.74 KB
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
# Cursor Rules for Cadence Python Client
## Package Management
- **Always use `uv` for Python package management**
- Use `uv run` for running Python commands instead of `python` directly
- Use `uv sync` for installing dependencies instead of `pip install`
- Use `uv tool run` for running development tools (pytest, mypy, ruff, etc.)
- Only use `pip` or `python` directly when specifically required by the tool or documentation
## Examples
```bash
# ✅ Correct
uv run python scripts/generate_proto.py
uv run python -m pytest tests/
uv tool run mypy cadence/
uv tool run ruff check
# ❌ Avoid
python scripts/generate_proto.py
pip install -e ".[dev]"
```
## Virtual Environment
- The project uses `uv` for virtual environment management
- Always activate the virtual environment using `uv` commands
- Dependencies are managed through `pyproject.toml` and `uv.lock`
## Testing
- Run tests with `uv run python -m pytest`
- Use `uv run` for any Python script execution
- Development tools should be run with `uv tool run`
## Code Generation
- Use `uv run python scripts/generate_proto.py` for protobuf generation
- Use `uv run python scripts/dev.py` for development tasks
## Code Quality
- **ALWAYS run linter and type checker after making code changes**
- Run linter with auto-fix: `uv tool run ruff check --fix`
- Run type checking: `uv tool run mypy cadence/`
- Use `uv tool run ruff check --fix && uv tool run mypy cadence/` to run both together
- **Standard workflow**: Make changes → Run linter → Run type checker → Commit
## Development Workflow
1. Make code changes
2. Run `uv tool run ruff check --fix` (fixes formatting and linting issues)
3. Run `uv tool run mypy cadence/` (checks type safety)
4. Run `uv run python -m pytest` (run tests)
5. Commit changes