@@ -8,196 +8,4 @@ SPDX-License-Identifier: CC0-1.0
8
8
9
9
Your contributions, in any form, are very much welcome! 🙏
10
10
11
- When contributing to this repository with a proposed change to the code, please first
12
- discuss the change you wish to make in an [ issue] [ github-new-issue ] (for bugs or
13
- features), create a [ discussion] [ github-new-discussion ] post in case anything is
14
- unclear, write me an email (
` [email protected] ` ) or any other method with
15
- the owners of this repository before making a change.
16
-
17
- ## Getting started with development
18
-
19
- 1 . Get a copy of the repository and change your current directory in the project root.
20
-
21
- 1 . Create a clean Python 3.10.x/3.11.x virtual environment and activate it.
22
- Suggested way is to install [ direnv] [ direnv-home ] together with [ Pyenv] [ pyenv-github ]
23
- and use the project-supplied ` .envrc ` (` direnv allow ` ).
24
-
25
- 1 . Make sure the base Python packages such as ` pip ` , ` setuptools ` and ` setuptools-scm `
26
- are up-to-date * inside this virtualenv* .
27
-
28
- ```
29
- $ pip install --upgrade pip setuptools setuptools-scm[toml]
30
- ```
31
-
32
- 1 . This should list zero outdated packages at this point:
33
-
34
- ```
35
- $ pip list --outdated
36
- ```
37
-
38
- 1 . Install the project with development and examples dependencies with this virtualenv
39
- active.
40
- E.g.:
41
-
42
- ```
43
- $ pip install -e .[development,tool]
44
- ```
45
-
46
- 1. Verify that all tests pass by running `pytest`.
47
-
48
- ```
49
- $ pytest
50
- [...]
51
- ==== 117 passed in 0.21s ====
52
- ```
53
-
54
- 1. Verify that you can run the `run-all-linters` script.
55
-
56
- ```
57
- $ ./run-all-linters
58
- [...]
59
- Everything looks OK! 🎉
60
- ```
61
-
62
- 1. Now you're ready to make your changes!
63
-
64
- ### Suggested IDE: VS Code
65
-
66
- The repository ships with helpers for use with
67
- [Microsoft Visual Studio Code][ms-vscode-home].
68
- It suggests extensions, performs strict mypy type checking on the fly, visual indicators
69
- for code style (e.g. 88-chars ruler), provides a task with 'problemMatcher' to run the
70
- `run-all-linters` script and more.
71
-
72
- In order for them to work correctly, please
73
- [select the Python interpreter][ms-vscode-select-python] of the virtualenv you created,
74
- e.g. `.direnv/python-3.11/bin/python`.
75
-
76
- Please set `ruff.importStrategy` to `fromEnvironment` in your workspace (or user)
77
- settings to use the same Ruff version as in the virtual environment.
78
- The Ruff plugin uses the bundled version by default.
79
-
80
- All linters and type checkers will run inside this environment created with
81
- specific versions specified rather than relying on whatever is available system-wide.
82
-
83
- ℹ️ If you like, enable automatic on-save formatting with project-provided settings using
84
- the user-level setting `editor.formatOnSave`.
85
- It will run `black` for you whenever hitting Save on a file.
86
-
87
- ## Add yourself as contributor
88
-
89
- In case you have some (significant) contributions and you would like to see your name in
90
- the *copyright* file headers invoke the `reuse` tool to do the job:
91
-
92
- ```
93
- $ reuse annotate --copyright "Your Name
< [email protected] > " path/to/file
[ file...
]
94
- ```
95
-
96
- This adds a line like below to the files specified.
97
-
98
- ```
99
- # SPDX-FileCopyrightText: 2023 Your Name < [email protected] >
100
- ```
101
-
102
- Alternatively, you could choose to waive the copyright and just be mentioned as a
103
- non-copyright *contributor* by replacing `--copyright` with `--contributor`.
104
-
105
- This adds a line like below to the files specified.
106
-
107
- ```
108
- # SPDX-FileContributor: Your Name < [email protected] >
109
- ```
110
-
111
- A use case for this are changes which are considered insignificant in terms of
112
- copyright, for example automated reformatting or changing the name of a variable.
113
-
114
- ## Pull Request Process
115
-
116
- ℹ️ The aim for this workflow is to end up with a clean git history which should be
117
- helpful for anyone else in the future (e.g. using git-blame, git-log).
118
-
119
- 1. Fork the repository to your own GitHub account.
120
- 1. Push the change(s) to your local fork, preferably to brach with a self-descriptive
121
- name.
122
- Please use a clean git commit history with descriptive commit messages and refer to
123
- relevant issues or discussions.
124
- In case your work was done in multiple iterations, use amending and/or an interactive
125
- rebase to craft a set of contained commits.
126
- 1. Ensure that your fork's branch is based off with latest upstream `develop` branch.
127
- If not, fetch latest changes and *rebase* it.
128
- 1. Run the `run-all-linters` script to ensure all code adheres to the code style, strict
129
- typing requirements and licensing headers.
130
- 1. Run `pytest` to ensure your code changes do not break current tests (adjust if
131
- necessary) and your newly introduced lines are all covered by new/adjusted tests
132
- (compare coverage output).
133
- 1. All ready?!
134
- Create a pull request targeting the `develop` branch.
135
- Write a title that consicely describes the main aim of the changes in the request.
136
- Consider to tick the *"Allow edits by maintainers"* checkbox (see below).
137
- 1. Please allow the maintainer to take the time to review and test the code.
138
- In case code changes are requested, please amend the commit(s) affected and update
139
- the commit message(s) if necessary.
140
-
141
- ℹ️ If you're uncomfortable to rebase/amend or unsure about commit message wording or even
142
- adjusting test cases, please indicate that the maintainer is allowed to edit your pull
143
- request when creating the pull request.
144
- Then in the pull request description kindly request the maintainer to apply the work on
145
- that and consider to mark the pull request as [draft][github-draft-pr-howto].
146
-
147
- Notes:
148
-
149
- - Ideally, every single commit should be reversible and have a single responsibility.
150
- Preparatory work leading up to an actual change should happen in separate commit(s) to
151
- aid reviewing and having a useful git history.
152
- Example of a well-crafted set of commits:
153
-
154
- `HEAD Implement feature X`<br/>
155
- — the aim of the pull request
156
-
157
- `HEAD^ Refactor module Y to allow for subclassing ClassZ`<br/>
158
- — improvement, but preparatory change
159
-
160
- `HEAD^^ Add tests for current logic in module Y`<br/>
161
- — not a functional change in itself, but purely preparatory to assert a before-change
162
- state is tested for.
163
-
164
- - Please adhere to the following style in commit messages:
165
-
166
- - Use present tense.
167
- - Avoid captain obvious-only commit messages like *"Delete file x"* or
168
- *"Update file y"*, because, well, anyone can see precisely that when looking at the
169
- diff.
170
- - Add the reason for the change (if not obvious).
171
- To have a *why* later looking at the changes is very useful, e.g. when creating
172
- release notes or even at review time understanding for the need to include the
173
- change.
174
-
175
- - Please avoid merge commits in your pull request; use rebase instead.
176
- Merge commits are harder to revert and to cherry-pick.
177
- - Pull requests should apply cleanly on the latest upstream `develop` branch.
178
- Preferably, your branch should be 'fast-forwardable' in git-speak.
179
- - The maintainer is free to cherry-pick, amend and push your work in a pull request's
180
- commits directly to any branch, effectively bypassing GitHub's pull request 'merge'
181
- button.
182
- Attributions will be preserved by either the commit's author field or a
183
- `Co-authored-by` footer in the commits.
184
-
185
- This also enables to move forward with dependent commits in a pull request still
186
- pending discussion on the adoption of that actual feature or bug fix approach.
187
- E.g. the two commits at the bottom (`Update code style ...`, `Refactor module Y ...`)
188
- could be merged for everyone to profit from already and reducing the size of the pull
189
- request pending review as well.
190
-
191
- - At the expense of the clean git history policy GPG/SSH signatures on commits by
192
- contributors could be lost as a result of the amendments by non-authors.
193
- If you wish to maintain your digitally verifiable signature, please take the time to
194
- submit your pull request in a state it can be *fast-forward*ed and rebase whenever
195
- the target branch is updated (which may be frequent).
196
-
197
- [github-new-issue]: https://github.com/gertvdijk/PyKMP/issues/new/choose
198
- [github-new-discussion]: https://github.com/gertvdijk/PyKMP/discussions/new
199
- [direnv-home]: https://direnv.net/
200
- [pyenv-github]: https://github.com/pyenv/pyenv
201
- [ms-vscode-home]: https://code.visualstudio.com/
202
- [ms-vscode-select-python]: https://code.visualstudio.com/docs/python/environments#_work-with-python-interpreters
203
- [github-draft-pr-howto]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests
11
+ Please see https://gertvdijk.github.io/PyKMP/contributing/ for more information.
0 commit comments