Skip to content

Commit ae483d4

Browse files
committed
added AGENTS.md
1 parent 24f0b1a commit ae483d4

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

AGENTS.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Repository instructions for datafusion-python
2+
3+
## Style and Linting
4+
- Python formatting and linting is handled by **ruff**.
5+
- Follow [PEP 8](https://www.python.org/dev/peps/pep-0008/) and these key
6+
ruff rules:
7+
- Use double quotes for string literals
8+
- Use explicit relative imports such as `from .module import Class`
9+
- Limit lines to 88 characters
10+
- Provide type hints for parameters and return values
11+
- Avoid unused imports
12+
- Prefer f-strings over other string formatting
13+
- Avoid `else` blocks after `return`
14+
- Use `isinstance()` instead of direct type comparison
15+
- Keep docstrings concise in Google format
16+
- Assign exception messages to variables before raising
17+
- All modules, classes, and functions should include docstrings.
18+
- Tests must use descriptive function names, pytest style assertions, and be
19+
grouped in classes when appropriate.
20+
- Rust code must pass `cargo fmt`, `cargo clippy`, and `cargo tomlfmt` and
21+
should omit unnecessary parentheses around `if` conditions.
22+
- Install the pre-commit hooks with `pre-commit install` and run them with
23+
`pre-commit run --files <file1> <file2>` or `pre-commit run --all-files`.
24+
- The same checks can be run manually using the scripts in `ci/scripts`:
25+
- `./ci/scripts/python_lint.sh`
26+
- `./ci/scripts/rust_fmt.sh`
27+
- `./ci/scripts/rust_clippy.sh`
28+
- `./ci/scripts/rust_toml_fmt.sh`
29+
30+
## Code Organization
31+
- Keep functions focused and under about 50 lines.
32+
- Break complex tasks into well-named helper functions and reuse existing
33+
helpers when possible.
34+
- Prefer adding parameters to existing functions rather than creating new
35+
versions with similar behavior.
36+
- Avoid unnecessary abstractions and follow established patterns in the
37+
codebase.
38+
39+
## Comments
40+
- Add meaningful comments for complex logic and avoid obvious comments.
41+
- Start inline comments with a capital letter.
42+
43+
## Running Tests
44+
1. Ensure submodules are initialized:
45+
```bash
46+
git submodule update --init
47+
```
48+
2. Create a development environment and install dependencies:
49+
```bash
50+
uv sync --dev --no-install-package datafusion
51+
```
52+
3. Build the Python extension:
53+
```bash
54+
uv run --no-project maturin develop --uv
55+
```
56+
4. Execute the test suite:
57+
```bash
58+
uv run --no-project pytest -v .
59+
```
60+
61+
## Building Documentation
62+
- Documentation dependencies can be installed with the `docs` group:
63+
```bash
64+
uv sync --dev --group docs --no-install-package datafusion
65+
```
66+
- Build the docs with:
67+
```bash
68+
uv run --no-project maturin develop --uv
69+
uv run --no-project docs/build.sh
70+
```
71+
- The generated HTML appears under `docs/build/html`.
72+
73+
## PR Template
74+
75+
When creating a pull request, please use the following template:
76+
77+
```markdown
78+
## Which issue does this PR close?
79+
80+
<!--
81+
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
82+
-->
83+
84+
- Closes #.
85+
86+
## Rationale for this change
87+
88+
<!--
89+
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
90+
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
91+
-->
92+
93+
## What changes are included in this PR?
94+
95+
<!--
96+
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
97+
-->
98+
99+
## Are these changes tested?
100+
101+
<!--
102+
We typically require tests for all PRs in order to:
103+
1. Prevent the code from being accidentally broken by subsequent changes
104+
2. Serve as another way to document the expected behavior of the code
105+
106+
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
107+
-->
108+
109+
## Are there any user-facing changes?
110+
111+
<!--
112+
If there are user-facing changes then we may require documentation to be updated before approving the PR.
113+
-->
114+
115+
<!--
116+
If there are any breaking changes to public APIs, please add the `api change` label.
117+
-->
118+
```

0 commit comments

Comments
 (0)