Files
droid_rules/.factory/rules/python.md
abhishekbhakat 9b35a38728 Enhance droid documentation and coding rules:
- Update coder and reviewer descriptions to clarify subagent roles.
- Improve coding rules for modularity and project structure.
- Add new semantic code search skill documentation for ColGREP.
- Introduce rules skill for accessing project coding conventions.
2026-02-16 16:16:26 +05:30

26 lines
960 B
Markdown

# Python Rules
Always make sure to run linter and typecheck.
Possibly with `uv` like `uv run ruff check --fix` and `uv run ty`.
## Package management
use `uv pip` instead of `pip` as I always create my virtual environments with `uv` if it doesn't already exist. Example: `uv venv -p 3.12`
## Code style
Do not try to use comments to work around the linter (ruff) or type checker (ty) issues.
Chances are Makefiles are present read and use them. If doesn't exist then create it.
Run formatting after done with changes.
Never use `sys.path` or `pathlib` for resources. Use `importlib.resources`.
Fetch version from pyproject.toml using `importlib.metadata`.
## Some rules to configure in ruff
- Ban relative imports.
- Keep imports at the top of the file.
## Type checking
Try to write type safe code. Use type hints and type annotations as much as possible. It will help you to catch bugs early and it will also help you to understand the code better.