|
| 1 | +Contributing |
| 2 | +============ |
| 3 | + |
| 4 | +Thanks for helping to build lenapy! |
| 5 | + |
| 6 | +Retrieve the code: forking and cloning the Repository |
| 7 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 8 | + |
| 9 | +Make a fork of the `lenapy repo <https://github.com/CNES/lenapy>`__ and clone |
| 10 | +the fork. |
| 11 | + |
| 12 | +A documentation is available on GitHub to help platform users create a fork: `https://docs.github.com/fork-a-repo <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo>`__ |
| 13 | + |
| 14 | +.. code-block:: none |
| 15 | +
|
| 16 | + git clone https://github.com/<your-github-username>/lenapy.git |
| 17 | + cd lenapy |
| 18 | +
|
| 19 | +You may want to add ``https://github.com/CNES/lenapy`` as an upstream remote |
| 20 | +repository. |
| 21 | + |
| 22 | +.. code-block:: none |
| 23 | +
|
| 24 | + git remote add upstream https://github.com/CNES/lenapy |
| 25 | +
|
| 26 | +Creating a Python environment |
| 27 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 28 | + |
| 29 | +We have conda environment YAML file with all the necessary dependencies. |
| 30 | + |
| 31 | +.. code-block:: none |
| 32 | +
|
| 33 | + conda env create -f environment.yml --name=lenapy-dev |
| 34 | +
|
| 35 | +to create a conda environment and install all the dependencies. |
| 36 | + |
| 37 | +Building lenapy |
| 38 | +~~~~~~~~~~~~~~~ |
| 39 | + |
| 40 | +Lenapy is a pure-python repository. Development installation should be as simple as |
| 41 | +cloning the repository and running the following in the cloned directory: |
| 42 | + |
| 43 | +.. code-block:: none |
| 44 | +
|
| 45 | + conda activate lenapy-dev |
| 46 | + python -m pip install --no-deps -e . |
| 47 | +
|
| 48 | +If you have any trouble, please open an issue on the |
| 49 | +`lenapy issue tracker <https://github.com/CNES/lenapy/issues>`_. |
| 50 | + |
| 51 | +Style |
| 52 | +~~~~~ |
| 53 | + |
| 54 | +Lenapy uses `black <http://black.readthedocs.io/en/stable/>`_ and `isort <https://isort.readthedocs.io/en/latest/>`_ |
| 55 | +for formatting. If you installed lenapy with ``python -m pip install -e ".[dev]"`` these tools will already be |
| 56 | +installed. |
| 57 | + |
| 58 | +Running tests |
| 59 | +~~~~~~~~~~~~~ |
| 60 | + |
| 61 | +Lenapy uses `pytest <https://docs.pytest.org/en/latest/>`_ for testing. You |
| 62 | +can run tests from the main lenapy directory as follows: |
| 63 | + |
| 64 | +.. code-block:: none |
| 65 | +
|
| 66 | + pytest tests |
| 67 | +
|
| 68 | +Alternatively you may choose to run only a subset of the full test suite. For |
| 69 | +example to test only the `writers` submodule we would run tests as follows: |
| 70 | + |
| 71 | +.. code-block:: none |
| 72 | +
|
| 73 | + pytest tests/writers |
| 74 | +
|
| 75 | +Coverage |
| 76 | +~~~~~~~~ |
| 77 | + |
| 78 | +It is possible to check code coverage |
| 79 | + |
| 80 | +.. code-block:: none |
| 81 | +
|
| 82 | + pytest --cov=lenapy --cov-report=html |
| 83 | +
|
| 84 | +You can still use all the usual pytest command-line options in addition to those. |
| 85 | + |
| 86 | +Pre-Commit Hooks |
| 87 | +~~~~~~~~~~~~~~~~ |
| 88 | + |
| 89 | +Install and build the `pre commit <https://github.com/pre-commit/pre-commit>`_ tool as: |
| 90 | + |
| 91 | +.. code-block:: none |
| 92 | +
|
| 93 | + python -m pip install -e ".[dev]" |
| 94 | + pre-commit install |
| 95 | +
|
| 96 | +to install a few plugins like black, isort, and pylint. These tools will automatically |
| 97 | +be run on each commit. You can skip the checks with ``git commit --no-verify``. |
| 98 | + |
| 99 | +Documentation |
| 100 | +~~~~~~~~~~~~~ |
| 101 | + |
| 102 | +We use `numpydoc <http://numpydoc.readthedocs.io/en/latest/format.html>`_ for our docstrings. |
| 103 | + |
| 104 | +Building the docs is possible with |
| 105 | + |
| 106 | +.. code-block:: none |
| 107 | +
|
| 108 | + $ conda env create -f environment.yml --name=lenapy-dev |
| 109 | + $ conda activate lenapy-dev |
| 110 | + $ python -m pip install -e ".[dev]" |
| 111 | + $ cd doc |
| 112 | + $ sphinx-build -b html doc doc/build |
0 commit comments