Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
CI: yesqa & mdformat (#63)
Browse files Browse the repository at this point in the history
* add yesqa & mdformat
* fix require py2.7
* fix MD links
* prune code check
* drop pep8speaks
* docker py3.9

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Borda and pre-commit-ci[bot] authored Aug 2, 2021
1 parent f8dc014 commit 19876ac
Show file tree
Hide file tree
Showing 16 changed files with 296 additions and 305 deletions.
20 changes: 10 additions & 10 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ In the interest of fostering an open and welcoming environment, we as contributo

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Expand Down
130 changes: 71 additions & 59 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,101 +7,113 @@ Developing Open Source is great fun! =)
Here's the long and short of it:

1. Develop your contribution:
* Pull the latest changes from upstream::
```

- Pull the latest changes from upstream:

```bash
git checkout master
git pull upstream master
```
* Create a branch for the feature you want to work on. Since the branch name will appear in the merge message, use a sensible name such as 'transform-speedups'::
```

- Create a branch for the feature you want to work on. Since the branch name will appear in the merge message, use a sensible name such as 'transform-speedups':
```bash
git checkout -b transform-speedups
```
* Commit locally as you progress (``git add`` and ``git commit``)
- Commit locally as you progress (`git add` and `git commit`)

1. To submit your contribution:

* Push your changes back to your fork on GitHub::
```
- Push your changes back to your fork on GitHub:
```bash
git push origin transform-speedups
```
* Enter your GitHub username and password (repeat contributors or advanced users can remove this step by connecting to GitHub with SSH. See detailed instructions below if desired).
* Go to GitHub. The new branch will show up with a green Pull Request button - click it.
- Enter your GitHub username and password (repeat contributors or advanced users can remove this step by connecting to GitHub with SSH. See detailed instructions below if desired).
- Go to GitHub. The new branch will show up with a green Pull Request button - click it.

1. 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!).
* To update your pull request, make your changes on your local repository and commit. As soon as those changes are pushed up (to the same branch as before) the pull request will update automatically.
* `Travis-CI <http://travis-ci.org/>`__, a continuous integration service, is triggered after each Pull Request update to build the code, run unit tests, measure code coverage and check coding style (PEP8) of your branch. The Travis tests must pass before your PR can be merged. If Travis fails, you can find out why by clicking on the "failed" icon (red cross) and inspecting the build and test log.
* A pull request must be approved by two core team members before merging.

## Guidelines
- 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!).
- To update your pull request, make your changes on your local repository and commit. As soon as those changes are pushed up (to the same branch as before) the pull request will update automatically.
- [Travis-CI](http://travis-ci.org/), a continuous integration service, is triggered after each Pull Request update to build the code, run unit tests, measure code coverage and check coding style (PEP8) of your branch. The Travis tests must pass before your PR can be merged. If Travis fails, you can find out why by clicking on the "failed" icon (red cross) and inspecting the build and test log.
- A pull request must be approved by two core team members before merging.
* All code should have tests (see `test coverage`_ below for more details).
* All code should be documented, to the same
`standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard>`_ as NumPy and SciPy.
* For new functionality, always add an example to the gallery.
* No changes are ever committed without review and approval by two core team members. **Never merge your own pull request.**
* Examples in the gallery should have a maximum figure width of 8 inches.
## Guidelines
- All code should have tests (see `test coverage`\_ below for more details).
- All code should be documented, to the same
[standard](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard) as NumPy and SciPy.
- For new functionality, always add an example to the gallery.
- No changes are ever committed without review and approval by two core team members. **Never merge your own pull request.**
- Examples in the gallery should have a maximum figure width of 8 inches.
## Stylistic Guidelines
* Set up your editor to remove trailing whitespace. Follow `PEP08 <http://www.python.org/dev/peps/pep-0008/>`__. Check code with pyflakes / flake8.
* Use numpy data types instead of strings (``np.uint8`` instead of ``"uint8"``).
* Use the following import conventions::
```
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
- Set up your editor to remove trailing whitespace. Follow [PEP08](http://www.python.org/dev/peps/pep-0008/). Check code with pyflakes / flake8.
- Use numpy data types instead of strings (`np.uint8` instead of `"uint8"`).
- Use the following import conventions:
```python
import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
cimport numpy as cnp # in Cython code
cimport numpy as cnp # in Cython code
```
* When documenting array parameters, use ``image : (M, N) ndarray`` and then refer to ``M`` and ``N`` in 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_float`` to 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_t`` as data type for all indexing, shape and size variables in C/C++ and Cython code.
* Use relative module imports, i.e. ``from .._shared import xyz`` rather 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:``.
- When documenting array parameters, use `image : (M, N) ndarray` and then refer to `M` and `N` in 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_float` to 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_t` as data type for all indexing, shape and size variables in C/C++ and Cython code.
- Use relative module imports, i.e. `from .._shared import xyz` rather 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:`.
## Testing
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 <https://docs.pytest.org/en/latest/>`__ testing framework, with tests located in the various ``tests`` folders.
We make use of the [pytest](https://docs.pytest.org/en/latest/) 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>
To use `pytest`, ensure that Cython extensions are built and that
the library is installed in development mode:
```bash
$ pip install -e .
```
Use ``--doctest-modules`` to run doctests.
For example, run all tests and all doctests using::
Now, run all tests using:
```bash
$ PYTHONPATH=. pytest <package>
```
$ PYTHONPATH=. pytest --doctest-modules --with-xunit --with-coverage <package>
Use `--doctest-modules` to run doctests.
For example, run all tests and all doctests using:
```bash
$ PYTHONPATH=. pytest --doctest-modules --with-xunit --with-coverage <package>
```
## Test coverage
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 <http://pytest-cov.readthedocs.io/en/latest/>`__ (using ``easy_install pytest-cov``) and then run::
```
$ coverage report
To measure the test coverage, install [pytest-cov](http://pytest-cov.readthedocs.io/en/latest/) (using `easy_install pytest-cov`) and then run:
```bash
$ coverage report
```
This will print a report with one line for each file in `skimage`,
detailing the test coverage::
detailing the test coverage:
```
Name Stmts Exec Cover Missing
--------------------------------------------------------------
package/module1 77 77 100%
package/__init__ 1 1 100%
...
Name Stmts Exec Cover Missing
--------------------------------------------------------------
package/module1 77 77 100%
package/__init__ 1 1 100%
...
```
## Bugs
Please `report bugs on GitHub <https://github.com/Borda/pyImRegBenchmark/issues>`_.
Please [report bugs on GitHub](https://github.com/Borda/pyImRegBenchmark/issues).
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## 🐛 Bug

### Description

<!-- Please provide a general introduction to the issue/proposal. -->

<!--
If reporting a bug, attach the entire traceback from Python.
If proposing an enhancement/new feature, provide links to related articles, reference examples, etc.
-->


### Way to reproduce

If reporting a bug, please include the following important information:

- [ ] Code example
- [ ] Relevant images (if any)
- Operating system and version: ...
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ about: Suggest an idea for this project
title: ''
labels: enhancement, help wanted
assignees: ''

---

## 🚀 Feature

<!-- A clear and concise description of the feature proposal -->

### Motivation
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/Question.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ about: Asking a questions about...
title: ''
labels: question
assignees: ''

---

## ❓ Questions and Help

### Before asking:

<!--
1. search the issues.
2. search the docs.
Expand All @@ -27,5 +27,5 @@ assignees: ''

#### What's your environment?

- OS: [e.g. iOS, Linux, Win]
- Version [e.g. 0.2.1]
- OS: \[e.g. iOS, Linux, Win\]
- Version \[e.g. 0.2.1\]
16 changes: 9 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Before submitting

- [ ] Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
- [ ] My code follows the style guidelines of this project, see the [contributor guideline](https://github.com/Borda/BIRL/blob/master/.github/CONTRIBUTING.md)
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Was this **discussed/approved** via a Github issue? (no need for typos, doc improvements)
- [ ] My code follows the **style guidelines** of this project, see the [contributor guideline](https://github.com/Borda/BIRL/blob/master/.github/CONTRIBUTING.md)
- [ ] I have performed a **self-review** of my own code
- [ ] I have **commented my code**, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the **documentation**
- [ ] I have **added tests** that prove my fix is effective or that my feature works
- [ ] New and existing **unit tests pass** locally with my changes

## What does this PR do?

Expand All @@ -24,8 +24,10 @@ Fixes # (issue).
- This change requires a documentation update

## PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

## Did you have fun?

Make sure you had fun coding 🙃
2 changes: 1 addition & 1 deletion .github/workflows/ci_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
pip install $(grep "numpy" requirements.txt)
# v46 crashes openslide-python install
pip install "setuptools<46" -U
pip install --requirement requirements.txt --quiet --upgrade
pip install --requirement requirements.txt --upgrade
pip install --requirement tests/requirements.txt --quiet --upgrade
python --version
pip --version
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,6 @@ jobs:
- name: PEP8
run: flake8 .

format-check-yapf:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install --upgrade pip
pip install yapf
pip list
shell: bash
- name: yapf
run: yapf --diff --parallel --recursive .

imports-check-isort:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install isort
run: |
pip install isort
pip list
- name: isort
run: isort --check-only .

pre-commit:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python_version: [3.6, 3.7, 3.8]
python_version: [3.7, 3.8, 3.9]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
28 changes: 0 additions & 28 deletions .pep8speaks.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ repos:
language: python
require_serial: false

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.7
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-black
- mdformat_frontmatter

- repo: https://github.com/asottile/yesqa
rev: v1.2.3
hooks:
- id: yesqa

- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
Expand Down
Loading

0 comments on commit 19876ac

Please sign in to comment.