Skip to content

Commit

Permalink
update contribution page
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-salles committed Jun 20, 2024
1 parent 7cd6e3b commit 6590634
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 56 deletions.
102 changes: 47 additions & 55 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
Contributing to ``gospl``
Contributing to goSPL
=========================

Contributions of any kind to ``gospl`` are more than welcome. That does not mean
new code only, but also improvements of documentation and user guide, additional
tests (ideally filling the gaps in existing suite) or bug report or idea what
could be added or done better.
Contributions of any kind to goSPL are more than welcome. That does not mean new code only, but also improvements of documentation and user guide, additional tests (ideally filling the gaps in existing suite) or bug report or idea what could be added or done better.

All contributions should go through our GitHub repository. Bug reports, ideas or even questions should be raised by opening an issue on the GitHub tracker. Suggestions for changes in code or documentation should be submitted as a pull request. However, if you are not sure what to do, feel free to open an issue.

All contributions should go through our GitHub repository. Bug reports, ideas or
even questions should be raised by opening an issue on the GitHub tracker.
Suggestions for changes in code or documentation should be submitted as a pull
request. However, if you are not sure what to do, feel free to open an issue.
All discussion will then take place on GitHub to keep the development of
``gospl`` transparent.
goSPL transparent.

If you decide to contribute to the codebase, ensure that you are using an
up-to-date `master` branch. The latest development version will always be there,
including the documentation (powered by `sphinx`_).
up-to-date `master` branch. The latest development version will always be there, including the documentation (powered by `sphinx`_).


Seven Steps for Contributing
----------------------------

There are seven basic steps to contributing to ``gospl``:
There are seven basic steps to contributing to goSPL:

1. Fork the ``gospl`` git repository
1. Fork the goSPL git repository
2. Create a development environment
3. Install momepy dependencies
4. Make a development build of ``gospl``
3. Install goSPL dependencies
4. Make a development build of goSPL
5. Update the documentation
6. Format code
7. Submit a Pull Request

Each of the steps is detailed below.

1. Fork the ``gospl`` git repository
1. Fork the goSPL git repository
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Git can be complicated for new users, but you no longer need to use command line
to work with git. If you are not familiar with git, we recommend using tools on
GitHub.org, GitHub Desktop or tools with included git like Atom. However, if you
want to use command line, you can fork ``gospl`` repository using following::
Git can be complicated for new users, but you no longer need to use command line to work with ``git``. If you are not familiar with ``git``, we recommend using tools on GitHub.org, GitHub Desktop or tools with included git like Atom. However, if you want to use command line, you can fork goSPL repository using following::

git clone git@github.com:your-user-name/gospl.git gospl-yourname
cd gospl-yourname
Expand All @@ -53,31 +44,28 @@ Then simply create a new branch of master branch.

2. Create a development environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A development environment is a virtual space where you can keep an independent
installation of ``gospl``. This makes it easy to keep both a stable version of
python in one place you use for work, and a development version (which you may
break while playing with code) in another.

An easy way to create a ``gospl`` development environment is as follows:
A development environment is a virtual space where you can keep an independent installation of goSPL. This makes it easy to keep both a stable version of Python in one place you use for work, and a development version (which you may break while playing with the code) in another.

.. note::

For Windows user, this is recommended to first install `WSL <https://learn.microsoft.com/en-us/windows/wsl/install>`_ as some of the required libraries are not available as windows packages on Anaconda. Then you should be able to proceed as detailed below.


An easy way to create a goSPL development environment is as follows:

- Install either `Anaconda <http://docs.continuum.io/anaconda/>`_ or
`miniconda <http://conda.pydata.org/miniconda.html>`_
- Make sure that you have cloned the repository
- ``cd`` to the ``gospl`` source directory

Tell conda to create a new environment, named ``gospl_dev``, or any other name you would like
for this environment, by running::

conda create -n gospl_dev python=3.8
- ``cd`` to the goSPL source directory

This will create the new environment, and not touch any of your existing environments,
nor any existing python installation.
Tell conda to create a new environment, named ``gospl_dev``, or any other name you would like for this environment, by running::

To work in this environment, Windows users should ``activate`` it as follows::
conda create -n gospl_dev python=3.11

activate gospl_dev
This will create the new environment, and not touch any of your existing environments, nor any existing Python installation.

macOS and Linux users should use::
To work in this environment, macOS and Linux users should use::

conda activate gospl_dev

Expand All @@ -89,7 +77,7 @@ To view your environments::

To return to you home root environment::

deactivate
conda deactivate

See the full conda docs `here <http://conda.pydata.org/docs>`__.

Expand All @@ -98,8 +86,8 @@ At this point you can easily do a *development* install, as detailed in the next
3. Installing Dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^

To run *momepy* in an development environment, you must first install
*momepy*'s dependencies. We suggest doing so using the following commands
To run goSPL in an development environment, you must first install
goSPL's dependencies. We suggest doing so using the following commands
(executed after your development environment has been activated)
to ensure compatibility of all dependencies::

Expand All @@ -108,36 +96,40 @@ to ensure compatibility of all dependencies::
conda config --env --set channel_priority strict
conda install numpy pip scipy numpy-indexed cython compilers
conda install pandas h5py meshio ruamel.yaml
conda install vtk mpi4py petsc4py
pip install meshplex
conda install vtk mpi4py petsc4py meshplex
conda install xarray pyproj gflex

.. note::

This should install all necessary dependencies. Alternatively you could directly use the `environment.yml <https://raw.githubusercontent.com/Geodels/gospl/master/environment.yml>`_ file provided in the goSPL GitHub repository::

conda env create -f environment.yml

This should install all necessary dependencies.

4. Making a development build
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Once dependencies are in place, make an in-place build by navigating to the git
clone of the ``gospl`` repository and running::
Once dependencies are in place, make an in-place build by navigating to the git clone of the goSPL repository and running::

python setup.py install
pip install --no-build-isolation -e .

This will install ``gospl`` into your environment but allows any further changes
without the need of reinstalling new version.
This will install goSPL into your environment but allows any further changes without the need of reinstalling new version.

5. Updating the Documentation and User Guide
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

``gospl`` documentation resides in the `docs` folder. Changes to the docs are
make by modifying the appropriate file within `doc`.
``gospl`` docs us reStructuredText syntax, `which is explained here <http://www.sphinx-doc.org/en/stable/rest.html#rst-primer>`_
and the docstrings follow the `Numpy Docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_.
goSPL documentation resides in the `docs` folder. Changes to the docs are
make by modifying the appropriate file within `docs`.

goSPL docs us reStructuredText syntax, `which is explained here <http://www.sphinx-doc.org/en/stable/rest.html#rst-primer>`_ and the docstrings follow the `Numpy Docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_.

Once you have made your changes, you may try if they render correctly by building the docs using sphinx.

To do so, you can navigate to the doc folder and type::

READTHEDOCS=True make clean html

The resulting html pages will be located in doc/build/html. In case of any errors,
The resulting html pages will be located in ``docs/build/html``. In case of any errors,
you can try to use make html within a new environment based on requirements.txt specification in the doc folder.

For minor updates, you can skip whole make html part as reStructuredText syntax is
Expand All @@ -150,7 +142,7 @@ usually quite straightforward.
Python (PEP8 / black)
~~~~~~~~~~~~~~~~~~~~~

``gospl`` follows the `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_ standard
goSPL follows the `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_ standard
and uses `Black`_ to ensure a consistent code format throughout the project.

Travis CI will run ``black --check`` and fails if there are files which would be
Expand All @@ -168,7 +160,7 @@ If you don't have black, you can install it using pip::
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Once you've made changes and pushed them to your forked repository, you then
submit a pull request to have them integrated into the ``gospl`` code base.
submit a pull request to have them integrated into the goSPL code base.

You can find a pull request (or PR) tutorial in the `GitHub's Help Docs <https://help.github.com/articles/using-pull-requests/>`_.

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. :notoc:
:html_theme.sidebar_secondary.remove: true

.. gospl documentation master file, created by
.. goSPL documentation master file, created by
.. module:: goSPL

Expand Down

0 comments on commit 6590634

Please sign in to comment.