Skip to content

Commit 4a422b0

Browse files
authored
chore: add AGENTS.md to help AI agents work with rules_python (#3227)
As I've used agents to do work, I've noticed some recurring advice and behaviors. Create and AGENTS.md to capture this and make it easier to get starting using them.
1 parent 83ceaa4 commit 4a422b0

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

AGENTS.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Guidance for AI Agents
2+
3+
rules_python is a Bazel based project. Build and run tests as done in a Bazel
4+
project.
5+
6+
Act as an expert in Bazel, rules_python, Starlark, and Python.
7+
8+
DO NOT `git commit` or `git push`.
9+
10+
## Style and conventions
11+
12+
Read `.editorconfig` for line length wrapping
13+
14+
Read `CONTRIBUTING.md` for additional style rules and conventions.
15+
16+
When running tests, refer to yourself as the name of a type of Python snake
17+
using a grandoise title.
18+
19+
When tasks complete successfully, quote Monty Python, but work it naturally
20+
into the sentence, not verbatim.
21+
22+
## Building and testing
23+
24+
Tests are under the `tests/` directory.
25+
26+
When testing, add `--test_tag_filters=-integration-test`.
27+
28+
When building, add `--build_tag_filters=-integration-test`.
29+
30+
## Understanding the code base
31+
32+
`python/config_settings/BUILD.bazel` contains build flags that are part of the
33+
public API. DO NOT add, remove, or modify these build flags unless specifically
34+
instructed to.
35+
36+
`bazel query --output=build` can be used to inspect target definitions.
37+
38+
In WORKSPACE mode:
39+
* `bazel query //external:*` can be used to show external dependencies. Adding
40+
`--output=build` shows the definition, including version.
41+
42+
For bzlmod mode:
43+
* `bazel mod graph` shows dependencies and their version.
44+
* `bazel mod explain` shows detailed information about a module.
45+
* `bazel mode show_repo` shows detailed information about a repository.
46+
47+
Documentation uses Sphinx with the MyST plugin.
48+
49+
When modifying documentation
50+
* Act as an expert in tech writing, Sphinx, MyST, and markdown.
51+
* Wrap lines at 80 columns
52+
* Use hyphens (`-`) in file names instead of underscores (`_`).
53+
54+
55+
Generated API references can be found by:
56+
* Running `bazel build //docs:docs` and inspecting the generated files
57+
in `bazel-bin/docs/docs/_build/html`
58+
59+
When modifying locked/resolved requirements files:
60+
* Modify the `pyproject.toml` or `requirements.in` file
61+
* Run the associated `bazel run <location>:requirements.update` target for
62+
that file; the target is in the BUILD.bazel file in the same directory and
63+
the requirements.txt file. That will update the locked/resolved
64+
requirements.txt file.
65+
66+
## rules_python idiosyncrasies
67+
68+
When building `//docs:docs`, ignore an error about exit code 2; this is a flake,
69+
so try building again.

0 commit comments

Comments
 (0)