Merge pull request #1895 from j9ac9k/update-contributing-guide
Update contributing guide ahead of scipy sprints
This commit is contained in:
commit
d28e1c8075
@ -4,77 +4,86 @@ Contributions to pyqtgraph are welcome! Be kind and respectful! See [our Code of
|
|||||||
|
|
||||||
Please use the following guidelines when preparing changes:
|
Please use the following guidelines when preparing changes:
|
||||||
|
|
||||||
## Submitting Code Changes
|
## Development Environment Creation
|
||||||
|
|
||||||
* The preferred method for submitting changes is by github pull request against the "master" branch.
|
First thing to do is fork the repository, and clone your own fork to your local computer.
|
||||||
* Pull requests should include only a focused and related set of changes. Mixed features and unrelated changes may be rejected.
|
|
||||||
* For major changes, it is recommended to discuss your plans on the mailing list or in a github issue before putting in too much effort.
|
```bash
|
||||||
* The following deprecations are being considered by the maintainers
|
git clone https://github.com/<username>/pyqtgraph.git
|
||||||
* `pyqtgraph.opengl` may be deprecated and replaced with `VisPy` functionality
|
cd pyqtgraph
|
||||||
* After v0.11, pyqtgraph will adopt [NEP-29](https://numpy.org/neps/nep-0029-deprecation_policy.html) which will effectively mean that python2 support will be deprecated
|
```
|
||||||
* Qt4 will be deprecated shortly, as well as Qt5<5.9 (and potentially <5.12)
|
|
||||||
|
While there is nothing preventing users from using `conda` environments, as a general principle, we recommend using the `venv` module for creating an otherwise empty virtual environment. Furthermore, at this time, WSL is not supported (it can likely be made to work, but you're on your own if you go down this route).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3.9 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
# on windows this would be .venv/Scripts/activate
|
||||||
|
python -m pip install --upgrade wheel setuptools pip
|
||||||
|
python -m pip install numpy scipy pyside6 -e .
|
||||||
|
```
|
||||||
|
|
||||||
|
Before making changes to the code-base, create a different branch with a name that should be unique (this makes it easier for maintainers to examine the proposed changes locally).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git switch -c my-new-feature
|
||||||
|
```
|
||||||
|
|
||||||
|
When you're ready to submit the pull request, do so via the github, and the target of the pull request should be the `master` branch in the pyqtgraph repo.
|
||||||
|
|
||||||
|
Pull requests should include only a focused and related set of changes. Mixed features and unrelated changes may be rejected.
|
||||||
|
|
||||||
|
For major changes, it is recommended to discuss your plans on the mailing list or in a github issue/discussion before putting in too much effort.
|
||||||
|
|
||||||
|
PyQtGraph has adopted [NEP-29](https://numpy.org/neps/nep-0029-deprecation_policy.html) which governs the timeline for phasing out support for numpy and python versions.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
* Writing proper documentation and unit tests is highly encouraged. PyQtGraph uses pytest style testing, so tests should usually be included in a tests/ directory adjacent to the relevant code.
|
* Writing proper documentation and unit tests is highly encouraged. PyQtGraph uses [`pytest`](https://docs.pytest.org/) for testing.
|
||||||
* Documentation is generated with sphinx; please check that docstring changes compile correctly
|
* Documentation is generated with sphinx, and usage of [numpy-docstyle](https://numpydoc.readthedocs.io/en/latest/format.html) is encouraged (many places in the library do not use this docstring style at present, it's a gradual process to migrate).
|
||||||
|
* The docs built for this PR can be previewed by clicking on the "Details" link for the read-the-docs entry in the checks section of the PR conversation page.
|
||||||
|
|
||||||
## Style guidelines
|
## Style guidelines
|
||||||
|
|
||||||
### Rules
|
### Formatting ~~Rules~~ Suggestions
|
||||||
|
|
||||||
* PyQtGraph prefers PEP8 for most style issues, but this is not enforced rigorously as long as the code is clean and readable.
|
* PyQtGraph prefers PEP8 for most style issues, but this is not enforced rigorously as long as the code is clean and readable.
|
||||||
* Use `python setup.py style` to see whether your code follows the mandatory style guidelines checked by flake8.
|
* Variable and Function/Methods that are intended to be part of the public API should be camelCase.
|
||||||
* Exception 1: All variable names should use camelCase rather than underscore_separation. This is done for consistency with Qt
|
* "Private" methods/variables should have a leading underscore (`_`) before the name.
|
||||||
* Exception 2: Function docstrings use ReStructuredText tables for describing arguments:
|
|
||||||
|
|
||||||
```text
|
|
||||||
============== ========================================================
|
|
||||||
**Arguments:**
|
|
||||||
argName1 (type) Description of argument
|
|
||||||
argName2 (type) Description of argument. Longer descriptions must
|
|
||||||
be wrapped within the column guidelines defined by the
|
|
||||||
"====" header and footer.
|
|
||||||
============== ========================================================
|
|
||||||
```
|
|
||||||
|
|
||||||
QObject subclasses that implement new signals should also describe
|
|
||||||
these in a similar table.
|
|
||||||
|
|
||||||
### Pre-Commit
|
### Pre-Commit
|
||||||
|
|
||||||
PyQtGraph developers are highly encouraged to (but not required) to use [`pre-commit`](https://pre-commit.com/). `pre-commit` does a number of checks when attempting to commit the code to ensure it conforms to various standards, such as `flake8`, utf-8 encoding pragma, line-ending fixers, and so on. If any of the checks fail, the commit will be rejected, and you will have the opportunity to make the necessary fixes before adding and committing a file again. This ensures that every commit made conforms to (most) of the styling standards that the library enforces; and you will most likely pass the code style checks by the CI.
|
PyQtGraph developers are highly encouraged to (but not required) to use [`pre-commit`](https://pre-commit.com/). `pre-commit` does a number of checks when attempting to commit the code to being committed, such as ensuring no large files are accidentally added, address mixed-line-endings types and so on. Check the [pre-commit documentation](https://pre-commit.com) on how to setup.
|
||||||
|
|
||||||
To make use of `pre-commit`, have it available in your `$PATH` and run `pre-commit install` from the root directory of PyQtGraph.
|
## Testing
|
||||||
|
|
||||||
## Testing Setting up a test environment
|
### Basic Setup
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
|
|
||||||
* tox
|
* tox
|
||||||
* tox-conda
|
|
||||||
* pytest
|
* pytest
|
||||||
* pytest-cov
|
* pytest-cov
|
||||||
* pytest-xdist
|
* pytest-xdist
|
||||||
* Optional: pytest-xvfb
|
* Optional: pytest-xvfb (used on linux with headless displays)
|
||||||
|
|
||||||
If you have `pytest<5` (used in python2), you may also want to install `pytest-faulthandler==1.6` plugin to output extra debugging information in case of test failures. This isn't necessary with `pytest>=5`
|
To run the test suite, after installing the above dependencies run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pytest examples tests
|
||||||
|
```
|
||||||
|
|
||||||
### Tox
|
### Tox
|
||||||
|
|
||||||
As PyQtGraph supports a wide array of Qt-bindings, and python versions, we make use of `tox` to test against most of the configurations in our test matrix. As some of the qt-bindings are only installable via `conda`, `conda` needs to be in your `PATH`, and we utilize the `tox-conda` plugin.
|
As PyQtGraph supports a wide array of Qt-bindings, and python versions, we make use of `tox` to test against as many supported configurations as feasible. With tox installed, simply run `tox` and it will run through all the configurations. This should be done if there is uncertainty regarding changes working on specific combinations of PyQt bindings and/or python versions.
|
||||||
|
|
||||||
* Tests for a module should ideally cover all code in that module, i.e., statement coverage should be at 100%.
|
### Continuous Integration
|
||||||
* To measure the test coverage, un `pytest --cov -n 4` to run the test suite with coverage on 4 cores.
|
|
||||||
|
|
||||||
### Continous Integration
|
For our Continuous Integration, we utilize Github Actions. Tested configurations are visible on [README](README.md).
|
||||||
|
|
||||||
For our Continuous Integration, we utilize Azure Pipelines. Tested configurations are visible on [README](README.md). More information on coverage and test failures can be found on the respective tabs of the [build results page](https://dev.azure.com/pyqtgraph/pyqtgraph/_build?definitionId=1)
|
|
||||||
|
|
||||||
### Benchmarks
|
### Benchmarks
|
||||||
|
|
||||||
( *Still under development* ) To ensure this library is performant, we use [Air Speed Velocity (asv)](https://asv.readthedocs.io/en/stable/) to run benchmarks. For developing on core functions and classes, be aware of any impact your changes have on their speed. To configure and run asv:
|
( *Still under development* ) To ensure this library is performant, we use [Air Speed Velocity (asv)](https://asv.readthedocs.io/en/stable/) to run benchmarks. For developing on core functions and classes, be aware of any impact your changes have on their speed. To configure and run asv:
|
||||||
```
|
|
||||||
|
```bash
|
||||||
pip install asv
|
pip install asv
|
||||||
python setup.py asv_config
|
python setup.py asv_config
|
||||||
asv run
|
asv run
|
||||||
|
Loading…
Reference in New Issue
Block a user