Skip to content

Commit

Permalink
Add coding guidelines text and move coding style from conventions to …
Browse files Browse the repository at this point in the history
…developing sections
  • Loading branch information
gavinmacaulay committed Dec 11, 2024
1 parent c48556f commit 5cbed3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
7 changes: 1 addition & 6 deletions docs/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,5 @@ rot = R.from_euler('ZYX', (yaw, theta-90, -phi), degrees=True) # angles in degr
incident_vector = rot.apply([0, 0, 1])
```

## Code style

Contributions of code should follow standardised or community-agreed styles and be provided in (or added to) a structure suitable for packaging and uploading to package libraries. For Python this includes `pip` and/or `conda`, for R this would be `CRAN`, for Matlab this would be a toolbox on the MATLAB File Exchange, etc.

Python code should follow [PEP8](https://peps.python.org/pep-0008) and docstrings should use [PEP257](https://peps.python.org/pep-0257/) with the contents following the [numpydoc style](https://numpydoc.readthedocs.io/en/latest/format.html). An exception to PEP8 is made to allow lines of up to 100 characters.

[^1]: [ISO. 2019.](https://www.iso.org/obp/ui/en/#iso:std:iso:80000:-2:ed-2:v2:en) ISO 80000-2. Part 2: Mathematics.

16 changes: 16 additions & 0 deletions docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ The echoSMs [source code](https://github.com/ices-tools-dev/echoSMs) is kept on

https://github.com/ices-tools-dev/echoSMs.git

## Coding guidelines

We want echoSMs to be a software package that is easy to maintain, understand, use, and to have lasting value. To help achieve this we aim for the following:

- clear and complete documentation
- good example code to help learn how to use echoSMs
- scattering model code that closely follows the terminology and structure of the papers that the models are implemented from
- a preference for clear code over computational efficiency
- minimial dependencies on other software (e.g., other Python packages)

### Style

Contributions of code should follow standardised or community-agreed styles and be provided in (or added to) a structure suitable for packaging and uploading to package libraries. For Python this includes `pip` and/or `conda`, for R this would be `CRAN`, for Matlab this would be a toolbox on the MATLAB File Exchange, etc.

Python code should follow [PEP8](https://peps.python.org/pep-0008) and docstrings should use [PEP257](https://peps.python.org/pep-0257/) with the contents following the [numpydoc style](https://numpydoc.readthedocs.io/en/latest/format.html). An exception to PEP8 is made to allow lines of up to 100 characters.

## Generating packages for PyPI

EchoSMs is a pure Python package. The build configuration is done via a [pyproject.toml](https://github.com/ices-tools-dev/echoSMs/blob/main/pyproject.toml) file and [`hatchling`](https://hatch.pypa.io/latest/) is used to produce packages.
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ site_name: echoSMs
nav:
- Introduction: index.md
- Using echoSMs: usage.md
- Developing echoSMs: developing.md
- Conventions: conventions.md
- Benchmarks: benchmark_data.md
- API reference: api_reference.md
- Developing echoSMs: developing.md
- Other software: other_software.md

theme:
Expand Down

0 comments on commit 5cbed3f

Please sign in to comment.