Skip to content

Commit f13bc56

Browse files
committed
initial pass on contributing doc
1 parent e310d12 commit f13bc56

File tree

1 file changed

+104
-5
lines changed

1 file changed

+104
-5
lines changed

docs/contributing.rst

Lines changed: 104 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ a core set of functionalities, and available time for development, review and ma
6262
of new features is limited. But if you have a great idea, please don't let that stop
6363
you posting it on GitHub, just please don't be offended if we respond cautiously.
6464

65-
Working with the code
66-
---------------------
65+
Contributing code and/or documentation
66+
--------------------------------------
6767

68-
Forking
69-
~~~~~~~
68+
Forking the repository
69+
~~~~~~~~~~~~~~~~~~~~~~
7070

7171
The Zarr source code is hosted on GitHub at the following location:
7272

@@ -93,9 +93,108 @@ the repository, you can do something like the following::
9393
$ virtualenv --no-site-packages --python=/usr/bin/python3.6 ~/pyenv/zarr-dev
9494
$ source ~/pyenv/zarr-dev/bin/activate
9595
$ pip install -r requirements_dev.txt
96+
$ pip install -r requirements_dev_optional.txt
97+
$ pip install -e .
98+
99+
To verify that your development environment is working, you can run the unit tests::
100+
101+
$ pytest -v zarr
102+
103+
Creating a branch
104+
~~~~~~~~~~~~~~~~~
105+
106+
It's best to create a new, separate branch for each piece of work you want to do. E.g.::
107+
108+
git checkout -b shiny-new-feature
109+
110+
This changes your working directory to the shiny-new-feature branch. Keep any changes in
111+
this branch specific to one bug or feature so it is clear what the branch brings to
112+
Zarr.
96113

97-
To verify that your development environment is working, you can run the unit test suite::
114+
To update this branch with latest code from Zarr, you can retrieve the changes from
115+
the master branch::
116+
117+
git fetch upstream
118+
git rebase upstream/master
119+
120+
This will replay your commits on top of the latest Zarr git master. If this leads to
121+
merge conflicts, these need to be resolved before submitting a pull request.
122+
123+
Before you do any new work or submit a pull request, please open an issue on GitHub to
124+
report the bug or propose the feature you'd like to add.
125+
126+
Running the test suite
127+
~~~~~~~~~~~~~~~~~~~~~~
128+
129+
Zarr includes a suite of unit tests, as well as doctests included in function and class
130+
docstrings and in the tutorial and storage spec. The simplest way to run the unit tests
131+
is to invoke::
98132

99133
$ pytest -v zarr
100134

135+
To also run the doctests within docstrings, run::
136+
137+
$ pytest -v --doctest-modules zarr
138+
139+
To run the doctests within the tutorial and storage spec, run::
140+
141+
$ python -m doctest -o NORMALIZE_WHITESPACE -o ELLIPSIS docs/tutorial.rst docs/spec/v2.rst
142+
143+
Tests can be run under different Python versions using tox. E.g. (assuming you have the
144+
corresponding Python interpreters installed on your system)::
145+
146+
$ tox -e py27,py34,py35,py36
147+
148+
Zarr currently supports Python 2.7 and Python 3.4-3.6, so the above command must
149+
succeed before code can be accepted into the main code base. Note that only the py36
150+
tox environment runs the doctests, i.e., doctests only need to succeed under Python 3.6.
151+
152+
All tests are automatically run via Travis (Linux) and AppVeyor (Windows) continuous
153+
integration services for every pull request. Tests must pass under both services before
154+
code can be accepted.
155+
156+
Code standards
157+
~~~~~~~~~~~~~~
158+
159+
All code must conform to the PEP8 standard. Regarding line length, lines up to 100
160+
characters are allowed, although please try to keep under 90 wherever possible.
161+
Conformance can be checked by running::
162+
163+
$ flake8 --max-line-length=100 zarr
164+
165+
This is automatically run when invoking ``tox -e py36``.
166+
167+
Test coverage
168+
~~~~~~~~~~~~~
169+
170+
Zarr maintains 100% test coverage under the latest Python stable release (currently
171+
Python 3.6). Both unit tests and docstring doctests are included when computing
172+
coverage. Running ``tox -e py36`` will automatically run the test suite with coverage
173+
and produce a coverage report. This should be 100% before code can be accepted into the
174+
main code base.
175+
176+
When submitting a pull request, coverage will also be collected across all supported
177+
versions via the Coveralls service, and will be reported back within the pull request.
178+
Coveralls coverage must also be 100% before code can be accepted.
179+
180+
Documentation
181+
~~~~~~~~~~~~~
182+
183+
Docstrings for user-facing classes and functions should follow the `numpydoc
184+
<https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_ standard,
185+
including sections for Parameters and Examples. All examples will be run as doctests
186+
under Python 3.6.
187+
188+
Zarr uses Sphinx for documentation, hosted on readthedocs.org. Documentation is
189+
written in the RestructuredText markup language (.rst files) in the ``docs`` folder.
190+
The documentation consists both of prose and API documentation. All user-facing classes
191+
and functions should be included in the API documentation, under the ``docs/api``
192+
folder. Any new features or important usage information should be included in the
193+
tutorial (``docs/tutorial.rst``). Any changes should also be included in the release
194+
notes (``docs/release.rst``).
195+
196+
The documentation can be built by running::
197+
198+
$ tox -e docs
101199

200+
The resulting built documentation will be available in the ``.tox/docs/tmp/html`` folder.

0 commit comments

Comments
 (0)