Skip to content

Commit 3903203

Browse files
committed
Simplify pixi tasks and add agent documentation
- Simplified pixi tasks in pyproject.toml by removing overly complex task chains - Removed tasks that mix concerns (e.g., ci-push, fix-commit-push) - Organized tasks into logical groups with comments - Simplified update-lock to not auto-commit - Added agents.md with project workflow documentation and available pixi tasks
1 parent 94fab02 commit 3903203

File tree

2 files changed

+75
-18
lines changed

2 files changed

+75
-18
lines changed

agents.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# python_template Agent Documentation
2+
3+
## Project Overview
4+
This project uses **pixi** for environment management. Configuration and tasks are defined in `pyproject.toml`.
5+
6+
## Development Workflow
7+
8+
**Making Changes:**
9+
- Implement the requested modifications
10+
- Run `pixi run style` to format and lint the code
11+
- Run `pixi run test` to verify tests pass
12+
- Execute `pixi run ci` and iterate until all checks pass
13+
- Commit only when CI passes
14+
15+
## Available Pixi Tasks
16+
17+
### Formatting and Linting
18+
- `pixi run format` - Format code using ruff
19+
- `pixi run ruff-lint` - Lint and auto-fix code issues with ruff
20+
- `pixi run pylint` - Run pylint checks on all Python files
21+
- `pixi run lint` - Run both ruff-lint and pylint
22+
- `pixi run style` - Format and lint code (runs format + lint)
23+
24+
### Testing
25+
- `pixi run test` - Run pytest tests
26+
- `pixi run coverage` - Run tests with coverage reporting
27+
- `pixi run coverage-report` - Display coverage report
28+
29+
### CI Workflow
30+
- `pixi run ci` - Run complete CI pipeline (style + coverage + coverage-report)
31+
32+
### Pre-commit Hooks
33+
- `pixi run pre-commit` - Run all pre-commit hooks
34+
- `pixi run pre-commit-update` - Update pre-commit hook versions
35+
36+
### Utility Tasks
37+
- `pixi run update-lock` - Update pixi.lock file
38+
- `pixi run clear-pixi` - Remove .pixi directory and pixi.lock
39+
- `pixi run setup-git-merge-driver` - Configure git merge driver for lock files
40+
- `pixi run update-from-template-repo` - Update from the template repository
41+
42+
## Python Environments
43+
44+
The project supports multiple Python versions:
45+
- `default` - Default environment with latest supported Python
46+
- `py310` - Python 3.10 environment
47+
- `py311` - Python 3.11 environment
48+
- `py312` - Python 3.12 environment
49+
- `py313` - Python 3.13 environment
50+
51+
To use a specific environment, add `-e <env>` to pixi commands:
52+
```bash
53+
pixi run -e py310 test
54+
```
55+
56+
## Best Practices
57+
58+
1. **Always run CI before committing**: Use `pixi run ci` to ensure all checks pass
59+
2. **Keep dependencies updated**: Regularly run `pixi run update-lock`
60+
3. **Use pre-commit hooks**: Set up pre-commit hooks to catch issues early
61+
4. **Test across Python versions**: Verify compatibility by testing with different environments
62+
5. **Format before linting**: The `style` task runs format first, then lint

pyproject.toml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,27 @@ py313 = ["py313", "test"]
6161

6262

6363
[tool.pixi.tasks]
64-
pre-commit = "pre-commit run -a"
65-
pre-commit-update = "pre-commit autoupdate"
64+
# Formatting and linting
6665
format = "ruff format ."
67-
check-clean-workspace = "git diff --exit-code"
6866
ruff-lint = "ruff check . --fix"
6967
pylint = "pylint --version && echo 'running pylint...' && pylint $(git ls-files '*.py')"
7068
lint = { depends-on = ["ruff-lint", "pylint"] }
7169
style = { depends-on = ["format", "lint"] }
72-
commit-format = "git commit -a -m'autoformat code' || true"
70+
71+
# Testing
7372
test = "pytest"
7473
coverage = "coverage run -m pytest && coverage xml -o coverage.xml"
7574
coverage-report = "coverage report -m"
76-
update-lock = "pixi update && git commit -a -m'update pixi.lock' || true"
77-
push = "git push"
78-
update-lock-push = { depends-on = ["update-lock", "push"] }
79-
fix = { depends-on = ["update-lock", "format", "ruff-lint", "pre-commit"] }
80-
fix-commit-push = { depends-on = ["fix", "commit-format", "update-lock-push"] }
81-
ci-no-cover = { depends-on = ["style", "test"] }
82-
ci = { depends-on = [
83-
"format",
84-
"ruff-lint",
85-
"pylint",
86-
"coverage",
87-
"coverage-report",
88-
] }
89-
ci-push = { depends-on = ["format", "ruff-lint", "update-lock", "ci", "push"] }
75+
76+
# CI workflow
77+
ci = { depends-on = ["style", "coverage", "coverage-report"] }
78+
79+
# Pre-commit hooks
80+
pre-commit = "pre-commit run -a"
81+
pre-commit-update = "pre-commit autoupdate"
82+
83+
# Utility tasks
84+
update-lock = "pixi update"
9085
clear-pixi = "rm -rf .pixi pixi.lock"
9186
setup-git-merge-driver = "git config merge.ourslock.driver true"
9287
update-from-template-repo = "./scripts/update_from_template.sh"

0 commit comments

Comments
 (0)