Skip to content

Commit 7724428

Browse files
committed
DOC: Add CONTRIBUTING.md
1 parent 02d2209 commit 7724428

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed

CONTRIBUTING.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
Contributing
2+
============
3+
4+
Thanks for considering contributing to the bioscan-dataset package!
5+
6+
Please take a moment to read these guidelines which will help you contribute
7+
efficiently to the package.
8+
9+
10+
Issues
11+
------
12+
13+
If you have found an issue with the BIOSCAN-5M data, such as an invalid image
14+
or erroneous label, please
15+
[open an issue on the BIOSCAN-5M repository](https://github.com/bioscan-ml/BIOSCAN-5M/issues/new/choose)
16+
to report it.
17+
If you have found an issue with the BIOSCAN-1M data, please check whether this
18+
was fixed in BIOSCAN-5M by aligning the dataset records in the two datasets
19+
on the `processid` field before reporting the issue since some known issues
20+
with the BIOSCAN-1M data were fixed in BIOSCAN-5M.
21+
There is currently no intention to update the BIOSCAN-1M data further, but
22+
BIOSCAN-5M will be periodically updated if issues are identified.
23+
24+
If you encounter a bug with the bioscan-dataset package which you would like
25+
to report, please:
26+
1. First ensure you are using the latest release ![PyPI - Version](https://img.shields.io/pypi/v/bioscan-dataset)
27+
and/or check the [changelog](https://github.com/bioscan-ml/dataset/blob/master/CHANGELOG.rst)
28+
to see if the issue was already resolved.
29+
2. Secondly, check the [open issues](https://github.com/bioscan-ml/dataset/issues)
30+
to see if the bug has already been reported.
31+
3. Otherwise, open a [new issue](https://github.com/bioscan-ml/dataset/issues/new/choose),
32+
describing the version of the package you are using and details about your
33+
environment, the behaviour you expected, and the behaviour you instead
34+
encountered.
35+
36+
37+
Pull requests
38+
-------------
39+
40+
Pull requests are welcome!
41+
42+
For enhancements, please discuss with the code owner(s) by slack, email, or a
43+
GitHub issue before authoring your enhancement. This is to check your proposal
44+
is in line with the goals of the package and avoid wasting your time
45+
implementing code which will not be integrated.
46+
47+
If you have found a bug and are willing to fix it yourself, have found an error
48+
in the documentation, or can provide an improvement to the documentation, you
49+
are welcome to open a pull request without discussing it with the code owners
50+
beforehand.
51+
52+
1. Fork the repository.
53+
2. Clone your fork to the machine where you will develop the codebase.
54+
3. Install the pre-commit stack ([see below](#pre-commit) for details).
55+
4. Checkout a new feature or bugfix branch.
56+
- The branch name should be all in lowercase,
57+
start with a [commit tag](#commit-messages) (in lowercase),
58+
followed by a few words joined by hyphens that describe high-level
59+
objective of the PR.
60+
5. Implement and commit your changes.
61+
- Commits should be atomic: don't change multiple things that aren't related to each other in the same commit.
62+
- Commits messages should be succinctly descriptive of the change they contain.
63+
- Commits messages should open with an appropriate commit tag, or in some cases, combination of commit tags.
64+
([See below](#commit-messages) for details.)
65+
- Refactor your commit history to squash any "oops" commits that fix other commits within your PR into the commit they fix.
66+
6. For new features, consider adding an example usage of the feature to README.rst.
67+
- Note that you don't need to add details of the new feature to CHANGELOG.rst as this is updated at the time of release.
68+
7. Submit your PR to the master branch.
69+
8. A maintainer should review your code within a week.
70+
- If you haven't heard anything after two weeks, feel free to send a reminder or check-in message.
71+
72+
73+
### pre-commit
74+
75+
The repository comes with a [pre-commit](https://pre-commit.com/) stack.
76+
This is a set of git hooks which are executed every time you make a commit.
77+
The hooks catch errors as they occur by checking your python code is valid and
78+
[flake8](https://gitlab.com/pycqa/flake8)-compliant, and will automatically
79+
adjust your code's formatting to conform to a standardized code style
80+
([black](https://github.com/psf/black)).
81+
82+
To set up the pre-commit hooks, run the following code from within the repo directory:
83+
84+
# Install the developmental dependencies
85+
pip install -r requirements-dev.txt
86+
# Install the pre-commit hooks
87+
pre-commit install
88+
89+
Whenever you try to commit code which is flagged by the pre-commit
90+
hooks, the commit will *not happen*. Some of the pre-commit hooks
91+
(such as [black](https://github.com/psf/black),
92+
[isort](https://github.com/timothycrosley/isort)) will automatically
93+
modify your code to fix the issues. When this happens, you'll have to
94+
stage the changes made by the commit hooks and then try your commit
95+
again. Other pre-commit hooks will not modify your code and will just
96+
tell you about issues which you'll then have to manually fix.
97+
98+
You can also manually run the pre-commit stack on all the files at any time:
99+
100+
pre-commit run --all-files
101+
102+
To force a commit to go through without passing the pre-commit hooks use the `--no-verify` flag:
103+
104+
git commit --no-verify
105+
106+
The pre-commit stack which comes with the template is highly
107+
opinionated, and includes the following operations:
108+
109+
- Code is reformatted to use the [black](https://github.com/psf/black)
110+
style. Any code inside docstrings will be formatted to black using
111+
[blackendocs](https://github.com/asottile/blacken-docs).
112+
- Imports are automatically sorted using
113+
[isort](https://github.com/timothycrosley/isort).
114+
- [flake8](https://gitlab.com/pycqa/flake8) is run to check for
115+
linting errors with [pyflakes](https://github.com/PyCQA/pyflakes)
116+
(e.g. code does not compile or a variable is used before it is defined),
117+
and for conformity to the python style guide
118+
[PEP-8](https://www.python.org/dev/peps/pep-0008/).
119+
- Several [hooks from pre-commit](https://github.com/pre-commit/pre-commit-hooks)
120+
are used to screen for non-language specific git issues, such as incomplete
121+
git merges, or overly large files being commited to the repo, etc.
122+
- Several [hooks from pre-commit specific to python](https://github.com/pre-commit/pygrep-hooks)
123+
are used to screen for rST formatting issues, ensure noqa flags always
124+
specify an error code to ignore, etc.
125+
126+
Once it is set up, the pre-commit stack will run locally on every commit.
127+
The pre-commit stack will also run on github to ensure PRs are conformal.
128+
129+
130+
### Commit messages
131+
132+
Commit messages should be clear and follow a few basic rules. Example:
133+
134+
ENH: Add <functionality-X> [to <dataset or method name>]
135+
136+
The first line of the commit message starts with a capitalized acronym
137+
(options listed below) indicating what type of commit this is. Then a blank
138+
line, then more text if needed. Lines shouldn't be longer than 72
139+
characters. If the commit is related to a ticket, indicate that with
140+
"See #123", "Closes #123" or similar.
141+
142+
Describing the motivation for a change, the nature of a bug for bug fixes or
143+
some details on what an enhancement does are also good to include in a commit
144+
message. Messages should be understandable without looking at the code changes.
145+
Simple changes need only be one line long without extended description.
146+
A commit message like `MNT: Fixed another one` is an example of what not to do;
147+
the reader has to go look for context elsewhere to understand the message.
148+
149+
Standard acronyms (commit tags) to start the commit message with are based on
150+
the [commit tags used by numpy](https://numpy.org/doc/2.2/dev/development_workflow.html#writing-the-commit-message)
151+
as follows:
152+
153+
API: an (incompatible) API change
154+
BUG: bug fix
155+
CI: continuous integration
156+
DEP: deprecate something, or remove a deprecated object
157+
DEV: development tool or utility
158+
DOC: documentation
159+
ENH: enhancement
160+
MNT: maintenance commit (refactoring, typos, etc.)
161+
REL: related to releasing bioscan-dataset
162+
REV: revert an earlier commit
163+
STY: style fix (whitespace, PEP8)
164+
TST: addition or modification of tests
165+
WIP: work in progress, do not merge

0 commit comments

Comments
 (0)