Developing Open Source is great fun! =)
Here's the long and short of it:
Develop your contribution:
Pull the latest changes from upstream:
bash
git checkout master
git pull upstream master
bash
git checkout -b transform-speedups
Commit locally as you progress (git add
and git commit
)
To submit your contribution:
Push your changes back to your fork on GitHub:
bash
git push origin transform-speedups
Go to GitHub. The new branch will show up with a green Pull Request button - click it.
Review process:
Reviewers (the other developers and interested community members) will write inline and/or general comments on your Pull Request (PR) to help you improve its implementation, documentation and style. Every single developer working on the project has their code reviewed, and we've come to see it as friendly conversation from which we all learn and the overall code quality benefits. Therefore, please don't let the review discourage you from contributing: its only aim is to improve the quality of project, not to criticize (we are, after all, very grateful for the time you're donating!).
test coverage
_ below for more details).np.uint8
instead of "uint8"
).cimport numpy as cnp # in Cython code
``
- When documenting array parameters, use
image : (M, N) ndarrayand then refer to
Mand
Nin the docstring, if necessary.
- Refer to array dimensions as (plane), row, column, not as x, y, z. See :ref:
Coordinate conventions <numpy-images-coordinate-conventions>in the user guide for more information.
- Functions should support all input image dtypes. Use utility functions such as
img_as_floatto help convert to an appropriate type. The output format can be whatever is most efficient. This allows us to string together several functions into a pipeline
- Use
Py_ssize_tas data type for all indexing, shape and size variables in C/C++ and Cython code.
- Use relative module imports, i.e.
from .._shared import xyzrather than
from skimage._shared import xyz.
- Wrap Cython code in a pure Python function, which defines the API. This improves compatibility with code introspection tools, which are often not aware of Cython code.
- For Cython functions, release the GIL whenever possible, using
with nogil:`.</numpy-images-coordinate-conventions>
This package has an extensive test suite that ensures correct execution on your system. The test suite has to pass before a pull request can be merged, and tests should be added to cover any modifications to the code base.
We make use of the pytest testing framework, with tests located in the various tests
folders.
To use pytest
, ensure that Cython extensions are built and that
the library is installed in development mode:
$ pip install -e .
Now, run all tests using:
$ PYTHONPATH=. pytest <package>
Use --doctest-modules
to run doctests.
For example, run all tests and all doctests using:
$ PYTHONPATH=. pytest --doctest-modules --with-xunit --with-coverage <package>
Tests for a module should ideally cover all code in that module, i.e., statement coverage should be at 100%.
To measure the test coverage, install pytest-cov (using easy_install pytest-cov
) and then run:
$ coverage report
This will print a report with one line for each file in skimage
,
detailing the test coverage:
Name Stmts Exec Cover Missing
--------------------------------------------------------------
package/module1 77 77 100%
package/__init__ 1 1 100%
...
Please report bugs on GitHub.