|
1 | | -See the [Scientific Python Developer Guide][spc-dev-intro] for a detailed |
2 | | -description of best practices for developing scientific packages. |
| 1 | +# Contributing |
3 | 2 |
|
4 | | -[spc-dev-intro]: https://learn.scientific-python.org/development/ |
| 3 | +## Getting Started |
5 | 4 |
|
6 | | -# Quick development |
| 5 | +* Make sure you have a [GitHub account](https://github.com/signup/free) |
| 6 | +* Submit a ticket for your issue, assuming one does not already exist. |
| 7 | + * Clearly describe the issue including steps to reproduce when it is a bug. |
| 8 | + * Make sure you fill in the earliest version that you know has the issue. |
| 9 | +* Fork the repository on GitHub |
7 | 10 |
|
8 | | -The fastest way to start with development is to use nox. If you don't have nox, |
9 | | -you can use `uvx nox` to run it without installing, or `uv tool install nox`. If |
10 | | -you don't have uv, you can |
11 | | -[install it a variety of ways](https://docs.astral.sh/uv/getting-started/installation/), |
12 | | -including with pip, pipx, brew, and just downloading the binary (single file). |
13 | 11 |
|
14 | | -To use, run `nox`. This will lint and test using every installed version of |
15 | | -Python on your system, skipping ones that are not installed. You can also run |
16 | | -specific jobs: |
| 12 | +## Making Changes |
17 | 13 |
|
18 | | -```console |
19 | | -$ nox -s lint # Lint only |
20 | | -$ nox -s tests # Python tests |
21 | | -$ nox -s docs # Build and serve the docs |
22 | | -$ nox -s build # Make an SDist and wheel |
23 | | -``` |
24 | | - |
25 | | -Nox handles everything for you, including setting up an temporary virtual |
26 | | -environment for each run. |
| 14 | +* Create a topic branch from where you want to base your work. |
| 15 | + * This is usually the master branch. |
| 16 | + * Only target release branches if you are certain your fix must be on that |
| 17 | + branch. |
| 18 | + * To quickly create a topic branch based on master; `git checkout -b |
| 19 | + fix/master/my_contribution master`. Please avoid working directly on the |
| 20 | + `master` branch. |
| 21 | +* Make commits of logical units. |
| 22 | +* Check for unnecessary whitespace with `git diff --check` before committing. |
| 23 | +* Make sure your commit messages are in the proper format (see below) |
| 24 | +* Make sure you have added the necessary tests for your changes. |
| 25 | +* Run _all_ the tests to assure nothing else was accidentally broken. |
27 | 26 |
|
28 | | -# Setting up a development environment manually |
| 27 | +### Writing the commit message |
29 | 28 |
|
30 | | -You can set up a development environment by running: |
| 29 | +Commit messages should be clear and follow a few basic rules. Example: |
31 | 30 |
|
32 | | -```bash |
33 | | -uv sync |
34 | 31 | ``` |
| 32 | +ENH: add functionality X to bluesky.<submodule>. |
35 | 33 |
|
36 | | -# Pre-commit |
37 | | - |
38 | | -You should prepare pre-commit, which will help you by checking that commits pass |
39 | | -required checks: |
40 | | - |
41 | | -```bash |
42 | | -uv tool install pre-commit # or brew install pre-commit on macOS |
43 | | -pre-commit install # Will install a pre-commit hook into the git repo |
| 34 | +The first line of the commit message starts with a capitalized acronym |
| 35 | +(options listed below) indicating what type of commit this is. Then a blank |
| 36 | +line, then more text if needed. Lines shouldn't be longer than 72 |
| 37 | +characters. If the commit is related to a ticket, indicate that with |
| 38 | +"See #3456", "See ticket 3456", "Closes #3456" or similar. |
44 | 39 | ``` |
45 | 40 |
|
46 | | -You can also/alternatively run `pre-commit run` (changes only) or |
47 | | -`pre-commit run --all-files` to check even without installing the hook. |
| 41 | +Describing the motivation for a change, the nature of a bug for bug fixes |
| 42 | +or some details on what an enhancement does are also good to include in a |
| 43 | +commit message. Messages should be understandable without looking at the code |
| 44 | +changes. |
48 | 45 |
|
49 | | -# Testing |
50 | | - |
51 | | -Use pytest to run the unit checks: |
52 | | - |
53 | | -```bash |
54 | | -uv run pytest |
| 46 | +Standard acronyms to start the commit message with are: |
55 | 47 | ``` |
56 | | - |
57 | | -# Coverage |
58 | | - |
59 | | -Use pytest-cov to generate coverage reports: |
60 | | - |
61 | | -```bash |
62 | | -uv run pytest --cov=save-and-restore-api |
| 48 | +API: an (incompatible) API change |
| 49 | +BLD: change related to building numpy |
| 50 | +BUG: bug fix |
| 51 | +CI : continuous integration |
| 52 | +DEP: deprecate something, or remove a deprecated object |
| 53 | +DEV: development tool or utility |
| 54 | +DOC: documentation |
| 55 | +ENH: enhancement |
| 56 | +MNT: maintenance commit (refactoring, typos, etc.) |
| 57 | +REV: revert an earlier commit |
| 58 | +STY: style fix (whitespace, PEP8) |
| 59 | +TST: addition or modification of tests |
| 60 | +REL: related to releases |
63 | 61 | ``` |
| 62 | +## The Pull Request |
64 | 63 |
|
65 | | -# Building docs |
66 | | - |
67 | | -You can build and serve the docs using: |
| 64 | +* Now push to your fork |
| 65 | +* Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch. This is a start to the conversation. |
68 | 66 |
|
69 | | -```bash |
70 | | -nox -s docs |
71 | | -``` |
72 | | - |
73 | | -You can build the docs only with: |
| 67 | +At this point you're waiting on us. We like to at least comment on pull requests within three business days |
| 68 | +(and, typically, one business day). We may suggest some changes or improvements or alternatives. |
74 | 69 |
|
75 | | -```bash |
76 | | -nox -s docs --non-interactive |
77 | | -``` |
| 70 | +Hints to make the integration of your changes easy (and happen faster): |
| 71 | +- Keep your pull requests small |
| 72 | +- Don't forget your unit tests |
| 73 | +- All algorithms need documentation, don't forget the .rst file |
| 74 | +- Don't take changes requests to change your code personally |
0 commit comments