Skip to content

Commit bae8f92

Browse files
Add a skill for modifying Python code (#1384)
1 parent b9a60b2 commit bae8f92

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

  • .agents/skills
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: usethis-python-code-modify
3+
description: Modify Python code (e.g. refactor, add new code, or delete code)
4+
compatibility: usethis, Python, pytest
5+
license: MIT
6+
metadata:
7+
version: "1.0"
8+
---
9+
10+
# Modifying Python code
11+
12+
## Procedure
13+
14+
1. Run a subset of the tests for `src/<module>` regularly from the parallel module in the `tests/<module>` directory. Never run the entire test suite.
15+
2. After finishing your modifications, run the static checks (e.g. `usethis-qa-static-checks`) to check for any issues.
16+
17+
## Run a subset of tests regularly
18+
19+
When modifying Python code, regularly run a relevant subset of the tests. The test suite is structured such that there are tests for each module in the `src` directory in the `tests` directory. For example, if we had `src/usethis/_a.py`, we would have `tests/test_a.py` with tests for that module.
20+
21+
### Never run the entire test suite
22+
23+
Running the entire test suite is unusually unnecessary and it is slow. The CI will run the entire test suite, so it is unnecessary for you to do so.
24+
25+
### What to do when tests fail
26+
27+
There are two reasons why tests might fail:
28+
29+
- The tests' expectations are no longer correct (e.g. because you changed the behavior of the code)
30+
- There is a bug in the code
31+
32+
In the first case, update the tests to have the correct expectations, or perhaps remove the test entirely. In the second case, fix the bug in the code.
33+
34+
## Run static checks after finishing modifications
35+
36+
After finishing your modifications, run the static checks (e.g. `usethis-qa-static-checks`) to check for any issues before merging.

.agents/skills/usethis-python-module-layout-modify/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: usethis-python-module-layout-modify
33
description: Modify the Python module layout (create, move, rename, or delete modules)
4-
compatibility: usethis, Python
4+
compatibility: usethis, Python, pytest
55
license: MIT
66
metadata:
77
version: "1.2"

0 commit comments

Comments
 (0)