Delete uv-linting.md
This commit is contained in:
parent
8f4921fb1f
commit
f5eefdd1aa
1 changed files with 0 additions and 102 deletions
102
uv-linting.md
102
uv-linting.md
|
@ -1,102 +0,0 @@
|
|||
# UV and Ruff Development Loop
|
||||
|
||||
A framework for iterative development using `uv` for dependency management and `ruff`
|
||||
for formatting and linting. This combination provides a fast and efficient development
|
||||
workflow.
|
||||
|
||||
## Development Guidelines
|
||||
|
||||
### Project Configuration
|
||||
|
||||
- Use centralised project configuration in `pyproject.toml` whenever possible
|
||||
- Store all tool configurations (ruff, pytest, mypy, etc.) in `pyproject.toml`
|
||||
- Keep dependency specifications and project metadata in `pyproject.toml`
|
||||
|
||||
### Dependency Management
|
||||
|
||||
- Manage all dependencies exclusively with `uv`
|
||||
- Use `uv add <package>` to add new dependencies (e.g. `uv add fastapi`)
|
||||
- Use `uv add --dev <package>` for development dependencies (e.g. `uv add --dev pytest`)
|
||||
- Use `uv remove <package>` to remove dependencies
|
||||
- Never manually edit `uv.lock` - let `uv` manage it
|
||||
|
||||
### Python Development Principles
|
||||
|
||||
Follow KISS, DRY, YAGNI, SOLID, and Zen Of Python software engineering principles when
|
||||
writing and refactoring code.
|
||||
|
||||
### Common UV Commands
|
||||
|
||||
```bash
|
||||
# Add a new dependency
|
||||
uv add fastapi
|
||||
|
||||
# Add a development dependency
|
||||
uv add --dev pytest
|
||||
|
||||
# Remove a dependency
|
||||
uv remove requests
|
||||
|
||||
# Install all dependencies
|
||||
uv sync
|
||||
|
||||
# Run a command in the virtual environment
|
||||
uv run python script.py
|
||||
```
|
||||
|
||||
## Session Start
|
||||
|
||||
These commands should be run once at the beginning of each development session to ensure
|
||||
your tools and dependencies are up to date.
|
||||
|
||||
### 1. Update `uv`
|
||||
|
||||
Ensure you have the latest version of the `uv` tool.
|
||||
|
||||
```bash
|
||||
uv self update
|
||||
```
|
||||
|
||||
### 2. Update Dependencies
|
||||
|
||||
Update all dependencies in your `pyproject.toml` to the latest versions and update the
|
||||
`uv.lock` file.
|
||||
|
||||
```bash
|
||||
uv lock -U
|
||||
```
|
||||
|
||||
## Iterative Development Process
|
||||
|
||||
These commands are run repeatedly as you write and modify your code.
|
||||
|
||||
### 1. Format Code
|
||||
|
||||
Automatically format your code using `ruff`.
|
||||
|
||||
```bash
|
||||
uv run ruff format
|
||||
```
|
||||
|
||||
### 2. Check for Linting Issues
|
||||
|
||||
Check for any linting errors or style issues.
|
||||
|
||||
```bash
|
||||
uv run ruff check
|
||||
```
|
||||
|
||||
### 3. Resolve Linting Issues
|
||||
|
||||
Review the output from `ruff check` and address any reported issues by refactoring
|
||||
your code to follow best practices.
|
||||
|
||||
**Guidelines for resolving lints:**
|
||||
|
||||
- Prefer refactoring code over suppressing warnings
|
||||
- Use `#noqa` comments sparingly (valid use case: avoiding circular imports)
|
||||
- Update `pyproject.toml` configuration if specific rules need to be disabled project-wide
|
||||
- Clean up after yourself - remove unused imports, variables, and functions
|
||||
- Follow the development principles outlined above when making changes
|
||||
|
||||
After fixing issues, repeat the format and check commands until no issues remain.
|
Loading…
Add table
Add a link
Reference in a new issue