Skip to content

Commit b70b9bd

Browse files
committed
📝 streamlined contributing guide
1 parent 936e5b0 commit b70b9bd

File tree

1 file changed

+49
-211
lines changed

1 file changed

+49
-211
lines changed

CONTRIBUTING.md

+49-211
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,41 @@
1-
<!-- omit in toc -->
1+
# SciPy pull request guidelines
22

3-
# Contributing to scipy-stubs
3+
Pull requests are always welcome, and the SciPy community appreciates any help you give.
4+
Note that a [Code of Conduct][coc] applies to all spaces managed by the SciPy project,
5+
including issues and pull requests.
46

5-
First off, thanks for taking the time to contribute! ❤️
7+
When submitting a pull request, we ask you to check the following:
68

7-
All types of contributions are encouraged and valued.
8-
See the [Table of Contents](#table-of-contents) for different ways to help and
9-
details about how this project handles them.
10-
Please make sure to read the relevant section before making your contribution.
11-
It will make it a lot easier for us maintainers and smooth out the experience
12-
for all involved.
13-
The community looks forward to your contributions. 🎉
9+
1. [Tests](#testing), [documentation](#documentation), and [code style](#code-style)
10+
are in order, and no errors are reported by type-checkers and stubgen.
11+
For details, see the [*Local development*](#local-development) section.
1412

15-
> [!NOTE]
16-
> And if you like scipy-stubs, but just don't have time to contribute, that's fine.
17-
> There are other easy ways to support the project and show your appreciation,
18-
> which we would also be very happy about:
19-
>
20-
> - Star the project
21-
> - Tweet about it
22-
> - Refer this project in your project's readme
23-
> - Mention the project at local meetups and tell your friends/colleagues
24-
25-
<!-- omit in toc -->
26-
27-
## Table of Contents
28-
29-
- [Code of Conduct](#code-of-conduct)
30-
- [I Have a Question](#i-have-a-question)
31-
- [I Want To Contribute](#i-want-to-contribute)
32-
- [Reporting Bugs](#reporting-bugs)
33-
- [Suggesting Enhancements](#suggesting-enhancements)
34-
- [Your First Code Contribution](#your-first-code-contribution)
35-
- [Improving The Documentation](#improving-the-documentation)
13+
It's also OK to submit work in progress if you're unsure of what this exactly means,
14+
in which case you'll likely be asked to make some further changes.
3615

37-
## Code of Conduct
16+
1. The contributed code will be **licensed under scipy-stubs' [license]**.
17+
If you did not write the code yourself, you ensure the existing license is compatible
18+
and include the license information in the contributed files, or obtain permission
19+
from the original author to relicense the contributed code.
3820

39-
This project and everyone participating in it is governed by the
40-
[`scipy-stubs` Code of Conduct][coc].
41-
By participating, you are expected to uphold this code.
42-
Please report unacceptable behavior to `jhammudoglu<at>gmail<dot>com`.
21+
## Local development
4322

44-
## I Have a Question
45-
46-
> [!NOTE]
47-
> If you want to ask a question, we assume that you have read the
48-
> available [Documentation][doc].
49-
50-
Before you ask a question, it is best to search for existing [Issues][bug]
51-
that might help you.
52-
In case you have found a suitable issue and still need clarification,
53-
you can write your question in this issue.
54-
It is also advisable to search the internet for answers first.
55-
56-
If you then still feel the need to ask a question and need clarification, we
57-
recommend the following:
58-
59-
- Open an [Issue][bug].
60-
- Provide as much context as you can about what you're running into.
61-
- Provide project and platform versions (Python, mypy, pyright, ruff, etc),
62-
depending on what seems relevant.
63-
64-
We will then take care of the issue as soon as possible.
65-
66-
## I Want To Contribute
67-
68-
> ### Legal Notice <!-- omit in toc -->
69-
>
70-
> When contributing to this project,
71-
> you must agree that you have authored 100% of the content,
72-
> that you have the necessary rights to the content and that the content you
73-
> contribute may be provided under the project license.
74-
75-
### Reporting Bugs
76-
77-
<!-- omit in toc -->
78-
79-
#### Before Submitting a Bug Report
80-
81-
A good bug report shouldn't leave others needing to chase you up for more
82-
information.
83-
Therefore, we ask you to investigate carefully, collect information and
84-
describe the issue in detail in your report.
85-
Please complete the following steps in advance to help us fix any potential
86-
bug as fast as possible.
87-
88-
- Make sure that you are using the latest version.
89-
- Determine if your bug is really a bug and not an error on your side e.g.
90-
using incompatible environment components/versions
91-
(Make sure that you have read the [documentation][doc].
92-
If you are looking for support, you might want to check
93-
[this section](#i-have-a-question)).
94-
- To see if other users have experienced (and potentially already solved)
95-
the same issue you are having, check if there is not already a bug report
96-
existing for your bug or error in the [bug tracker][bug].
97-
- Also make sure to search the internet (including Stack Overflow) to see if
98-
users outside of the GitHub community have discussed the issue.
99-
- Collect information about the bug:
100-
- Stack trace (Traceback)
101-
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
102-
- Version of the interpreter, compiler, SDK, runtime environment,
103-
package manager, depending on what seems relevant.
104-
- Possibly your input and the output
105-
- Can you reliably reproduce the issue?
106-
And can you also reproduce it with older versions?
107-
108-
<!-- omit in toc -->
109-
110-
#### How Do I Submit a Good Bug Report?
111-
112-
> You must never report security related issues, vulnerabilities or bugs
113-
> including sensitive information to the issue tracker, or elsewhere in public.
114-
> Instead sensitive bugs must be sent by email to `jhammudoglu<at>gmail<dot>com`.
115-
116-
We use GitHub issues to track bugs and errors.
117-
If you run into an issue with the project:
118-
119-
- Open an [Issue][bug].
120-
(Since we can't be sure at this point whether it is a bug or not,
121-
we ask you not to talk about a bug yet and not to label the issue.)
122-
- Explain the behavior you would expect and the actual behavior.
123-
- Please provide as much context as possible and describe the
124-
*reproduction steps* that someone else can follow to recreate the issue on
125-
their own.
126-
This usually includes your code.
127-
For good bug reports you should isolate the problem and create a reduced test
128-
case.
129-
- Provide the information you collected in the previous section.
130-
131-
Once it's filed:
132-
133-
- The project team will label the issue accordingly.
134-
- A team member will try to reproduce the issue with your provided steps.
135-
If there are no reproduction steps or no obvious way to reproduce the issue,
136-
the team will ask you for those steps and mark the issue as `needs-repro`.
137-
Bugs with the `needs-repro` tag will not be addressed until they are
138-
reproduced.
139-
- If the team is able to reproduce the issue, it will be marked `needs-fix`,
140-
as well as possibly other tags (such as `critical`), and the issue will be
141-
left to be [implemented by someone](#your-first-code-contribution).
142-
143-
### Suggesting Enhancements
144-
145-
This section guides you through submitting an enhancement suggestion for
146-
scipy-stubs, **including completely new features and minor improvements to existing
147-
functionality**.
148-
Following these guidelines will help maintainers and the community to
149-
understand your suggestion and find related suggestions.
150-
151-
<!-- omit in toc -->
152-
153-
#### Before Submitting an Enhancement
154-
155-
- Make sure that you are using the latest version.
156-
- Read the [documentation][doc] carefully and find out if the functionality is
157-
already covered, maybe by an individual configuration.
158-
- Perform a [search][bug] to see if the enhancement has already been suggested.
159-
If it has, add a comment to the existing issue instead of opening a new one.
160-
- Find out whether your idea fits with the scope and aims of the project.
161-
It's up to you to make a strong case to convince the project's developers of
162-
the merits of this feature. Keep in mind that we want features that will be
163-
useful to the majority of our users and not just a small subset. If you're
164-
just targeting a minority of users, consider writing an add-on/plugin library.
165-
166-
<!-- omit in toc -->
167-
168-
#### How Do I Submit a Good Enhancement Suggestion?
169-
170-
Enhancement suggestions are tracked as [GitHub issues][bug].
171-
172-
- Use a **clear and descriptive title** for the issue to identify the
173-
suggestion.
174-
- Provide a **step-by-step description of the suggested enhancement** in as
175-
many details as possible.
176-
- **Describe the current behavior** and **explain which behavior you expected
177-
to see instead** and why. At this point you can also tell which alternatives
178-
do not work for you.
179-
- **Explain why this enhancement would be useful** to most scipy-stubs users.
180-
You may also want to point out the other projects that solved it better and
181-
which could serve as inspiration.
182-
183-
### Your First Code Contribution
184-
185-
Ensure you have [`uv`](https://docs.astral.sh/uv/getting-started/installation/) installed.
186-
Now you can install the project with the dev dependencies:
23+
Ensure you have [`uv`](https://docs.astral.sh/uv/getting-started/installation/)
24+
installed. Now you can install the project with the dev dependencies:
18725

18826
```bash
189-
uv sync --frozen
27+
uv sync --python 3.10
19028
```
19129

30+
By installing the lowest support Python version (3.10 in this example), it prevents
31+
your IDE from e.g. auto-importing unsupported `typing` features.
32+
19233
### pre-commit
19334

19435
`scipy-stubs` uses [pre-commit](https://pre-commit.com/) to ensure that the code is
195-
formatted and typed correctly when committing the changes. For better performance,
196-
you could additionally install [`pre-commit-uv`](https://github.com/tox-dev/pre-commit-uv):
36+
formatted and type-checked when committing the changes. Running this will be slightly
37+
faster if [`pre-commit-uv`](https://github.com/tox-dev/pre-commit-uv) is additionally
38+
installed:
19739

19840
```bash
19941
uv tool install pre-commit --with pre-commit-uv --force-reinstall
@@ -223,7 +65,8 @@ Installed 1 executable: pre-commit
22365

22466
</details>
22567

226-
Now to install the git hook script, make sure that your the root directory of the `scipy-stubs` repo, then run:
68+
Now to install the git hook script, make sure that your the root directory of the
69+
`scipy-stubs` repo, then run:
22770

22871
```bash
22972
uvx pre-commit install
@@ -236,20 +79,21 @@ pre-commit installed at .git/hooks/pre-commit
23679
```
23780

23881
> [!NOTE]
239-
> For performance reasons, `pre-commit` won't run `mypy` and `stubtest`. You could do this
240-
> yourself with `tox -e mypy` and `tox -e stubtest`, as explained in the next section.
241-
> That way you won't have to rely on the (slow) github actions workflow when you submit your PR.
82+
> For performance reasons, `pre-commit` won't run `mypy` and `stubtest`. You could do
83+
> this yourself with `tox -e mypy` and `tox -e stubtest`, as explained in the next
84+
> section. That way you won't have to rely on the (slow) github actions workflow when
85+
> you submit your PR.
24286
24387
### Tox
24488

245-
The pre-commit hooks and `stubtest` can easily be run with [tox](https://github.com/tox-dev/tox).
246-
It can be installed with:
89+
The pre-commit hooks and `stubtest` can easily be run with
90+
[tox](https://github.com/tox-dev/tox). It can be installed as a `uv` tool:
24791

24892
```bash
24993
uv tool install tox --with tox-uv --upgrade
25094
```
25195

252-
To run all environments in parallel, run:
96+
To run all environments (in parallel), run:
25397

25498
```bash
25599
uvx tox p
@@ -279,33 +123,27 @@ pyright: OK ✔ in 25.23 seconds
279123

280124
</details>
281125

282-
### Commit message style
283-
284-
See <https://gitmoji.dev/>.
126+
## Documentation
285127

286-
### Improving The Documentation
128+
All [documentation] lives in the `README.md`. Please read it carefully before proposing
129+
any changes. Ensure that the markdown is formatted correctly with
130+
[markdownlint](https://github.com/DavidAnson/markdownlint/tree/main), by enabling
131+
[pre-commit](#pre-commit).
287132

288-
All [documentation] lives in the `README.md`. Please read it carefully before
289-
proposing any changes. Ensure that the markdown is formatted correctly with
290-
[markdownlint](https://github.com/DavidAnson/markdownlint/tree/main).
133+
## Testing
291134

292-
## Useful resources
135+
See the `READNE.md` in [`scipy-stubs/tests`][tests].
293136

294-
- [official typing docs](https://typing.readthedocs.io/en/latest/)
295-
- [`basedmypy` docs](https://kotlinisland.github.io/basedmypy/)
296-
- [`basedpyright` docs](https://docs.basedpyright.com/latest/)
297-
- [`basedpyright` playground](https://basedpyright.com/)
298-
- [`numpy.typing` docs](https://numpy.org/doc/stable/reference/typing.html)
299-
- [`scipy-stubs` docs](https://github.com/jorenham/scipy-stubs/blob/master/README.md)
300-
- [`typing_extensions` docs](https://typing-extensions.readthedocs.io/en/latest/#)
137+
## Code style
301138

302-
<!-- omit in toc -->
139+
See <https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#style-guide>.
303140

304-
## Attribution
141+
## Commit message style
305142

306-
This guide is based on the **contributing-gen**.
307-
[Make your own](https://github.com/bttger/contributing-gen)!
143+
Scipy-stubs recommends using [Gitmoji](https://gitmoji.dev/) for commit messages and PR
144+
titles. For VSCode and VSCodium users, it is recommended to use the
145+
[`gitmoji-vscode` extension](https://github.com/seatonjiang/gitmoji-vscode) for this.
308146

309-
[bug]: https://github.com/jorenham/scipy-stubs/issues
310-
[coc]: https://github.com/jorenham/scipy-stubs/blob/master/CODE_OF_CONDUCT.md
311-
[doc]: https://github.com/jorenham/scipy-stubs?tab=readme-ov-file#scipy-stubs
147+
[coc]: https://docs.scipy.org/doc/scipy/dev/conduct/code_of_conduct.html
148+
[license]: https://github.com/jorenham/scipy-stubs/blob/master/LICENSE
149+
[tests]: https://github.com/jorenham/scipy-stubs/tree/master/tests

0 commit comments

Comments
 (0)