Skip to content

Commit 902be31

Browse files
VeckoTheGeckoheadtr1ckianhijsignell
authored andcommitted
Add AI policy (#11257)
--------- Co-authored-by: Michael Niklas <mick.niklas@gmail.com> Co-authored-by: Ian Hunt-Isaak <ianhuntisaak@gmail.com> Co-authored-by: Julia Signell <jsignell@gmail.com>
1 parent 83d1256 commit 902be31

6 files changed

Lines changed: 108 additions & 2 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
### Description
2+
3+
### Checklist
4+
15
<!-- Feel free to remove check-list items aren't relevant to your change -->
26

37
- [ ] Closes #xxxx
48
- [ ] Tests added
59
- [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst`
610
- [ ] New functions/methods are listed in `api.rst`
11+
12+
### AI Disclosure
13+
14+
<!--- Please review our AI & contribution guidelines: https://docs.xarray.dev/en/stable/contribute/ai-policy.html. Remove this section if your PR does not contain AI-generated content. --->
15+
16+
- [ ] This PR contains AI-generated content.
17+
- [ ] I have tested any AI-generated content in my PR.
18+
- [ ] I take responsibility for any AI-generated content in my PR.
19+
<!--- If you used AI to generate code, please specify the tool used and the prompt below. --->
20+
Tools: {e.g., Claude, Codex, GitHub Copilot, ChatGPT, etc.}

AI_POLICY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
doc/contribute/ai-policy.md

doc/contribute/ai-policy.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!-- markdownlint-disable MD013 -->
2+
3+
# AI Usage Policy
4+
5+
**Note:** Some Xarray developers use AI tools as part of our development workflow.
6+
We assume this is now common. Tools, patterns, and norms are evolving fast — this
7+
policy aims to avoid restricting contributors' choice of tooling while ensuring that:
8+
9+
- Reviewers are not overburdened
10+
- Contributions can be maintained
11+
- The submitter can vouch for and explain all changes
12+
- Developers can acquire new skills[^1]
13+
14+
To that end this policy applies regardless of whether the code was written by hand, with
15+
AI assistance, or generated entirely by an AI tool.
16+
17+
[^1]:
18+
Over-reliance on AI tools has been shown to
19+
[hinder skill formation amongst software developers](https://arxiv.org/abs/2601.20245).
20+
21+
## Core Principle: Changes
22+
23+
If you submit a pull request, you are responsible for understanding and having fully reviewed
24+
the changes. You must be able to explain why each change is correct[^2] and how it fits into
25+
the project. Strive to minimize changes to ease the burden on reviewers — avoid
26+
including unnecessary or loosely related changes.
27+
28+
[^2]:
29+
You may also open a draft PR with changes in order to discuss and receive feedback on the
30+
best approach if you are not sure what the best way forward is.
31+
32+
## Core Principle: Communication
33+
34+
PR descriptions, issue comments, and review responses must be your own words. The
35+
substance and reasoning must come from you. Do not paste AI-generated text as
36+
comments or review responses. Please attempt to be concise.
37+
38+
PR descriptions should follow the provided template.
39+
40+
Using AI to improve the language of your writing (grammar, phrasing, spelling, etc.) is
41+
acceptable. Be careful that it does not introduce inaccurate details in the process.
42+
43+
Maintainers reserve the right to delete or hide comments that violate our AI policy or code of conduct.
44+
45+
## Code and Tests
46+
47+
### Review Every Line
48+
49+
You must have personally reviewed and understood all changes before submitting.
50+
51+
If you used AI to generate code, you are expected to have read it critically and
52+
tested it. As with a hand-written PR, the description should explain the approach
53+
and reasoning behind the changes. Do not leave it to reviewers to figure out what
54+
the code does and why.
55+
56+
#### Not Acceptable
57+
58+
> I pointed an agent at the issue and here are the changes
59+
60+
> This is what Claude came up with. 🤷
61+
62+
#### Acceptable
63+
64+
> I iterated multiple times with an agent to produce this. The agent wrote the code at my direction,
65+
> and I have fully read and validated the changes.
66+
67+
> I pointed an agent at the issue and it generated a first draft. I reviewed the changes thoroughly and understand the implementation well.
68+
69+
### Large AI-Assisted Contributions
70+
71+
Generating code with agents is fast and easy. Reviewing it is not. Making a PR with a large diff
72+
shifts the burden from the contributor to the reviewer. To guard against this asymmetry:
73+
74+
If you are planning a large AI-assisted contribution (e.g., a significant refactor, a
75+
framework migration, or a new subsystem), **open an issue first** to discuss the scope
76+
and approach with maintainers. This helps us decide if the change is worthwhile, how
77+
it should be structured, and any other important decisions.
78+
79+
Maintainers reserve the right to close PRs where the scope makes meaningful review
80+
impractical, or when they suspect this policy has been violated. Similarly they may request
81+
that large changes be broken into smaller, reviewable pieces.
82+
83+
## Documentation
84+
85+
The same core principles apply to both code and documentation. You must review the result
86+
for accuracy and are ultimately responsible for all changes made. Xarray has domain-specific
87+
semantics that AI tools frequently get wrong. Do not submit documentation that you
88+
haven't carefully read and verified.

doc/contribute/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Overview
1515
We welcome your skills and enthusiasm at the xarray project!. There are numerous opportunities to
1616
contribute beyond just writing code.
1717
All contributions, including bug reports, bug fixes, documentation improvements, enhancement suggestions,
18-
and other ideas are welcome.
18+
and other ideas are welcome. LLM generated contributions are welcome, but they must follow :doc:`our AI policy <ai-policy>`.
1919

2020
If you have any questions on the process or how to fix something feel free to ask us!
2121
The recommended places to ask questions are `GitHub Discussions <https://github.com/pydata/xarray/discussions>`_

doc/contribute/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ In this section you will also find documentation on the internal organization of
1313
:hidden:
1414

1515
contributing
16+
ai-policy
1617
../internals/index
1718
../roadmap
1819
../whats-new

doc/whats-new.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ Bug Fixes
120120
Documentation
121121
~~~~~~~~~~~~~
122122

123+
- Add AI policy (:pull:`11257`).
124+
By `Nick Hodgskin <https://github.com/VeckoTheGecko>`_.
123125
- Update documentation and team guide to promote Zulip. Remove mentions of Discord (:pull:`11246`, :pull:`11254`).
124126
By `Nick Hodgskin <https://github.com/VeckoTheGecko>`_.
125127
- Fix typos (:pull:`11180`, :pull:`11181`, :pull:`11182`, :pull:`11185`, :pull:`11186`).
@@ -136,9 +138,9 @@ Performance
136138

137139
Internal Changes
138140
~~~~~~~~~~~~~~~~
141+
139142
- Add script for linting of public docstrings according to numpydoc (:pull:`11121`).
140143
By `Nick Hodgskin <https://github.com/VeckoTheGecko>`_.
141-
142144
- Add stubtest configuration and allowlist for validating type annotations against
143145
runtime behavior. This enables CI integration for type stub validation and helps
144146
prevent type annotation regressions (:issue:`11086`).

0 commit comments

Comments
 (0)