SalishSeaCmd Package Development
Python Versions
The SalishSeaCmd package is developed using Python 3.14.
The minimum supported Python version is 3.12.
The Continuous Integration workflow on GitHub ensures that the package
is tested for all versions of Python>=3.12.
An old version of the package running under Python 3.5 is deployed on the
Westgrid orcinus HPC platform.
That version is tagged in the repository as orcinus-python-3.5.
Getting the Code
Clone the SalishSeaCmd code and documentation repository from GitHub with:
$ git clone git@github.com:SalishSeaCast/SalishSeaCmd.git
Development Environment
SalishSeaCmd uses Pixi for package and environment management.
If you don’t already have Pixi installed,
please follow its installation instructions to do so.
Most commands are executed using pixi run in the SalishSeaCmd/ directory
(or a sub-directory).
Dependencies will be downloaded and linked in to environments when you use pixi run
for the first time.
The default environment has the packages installed that are required to run the
SalishSeaCmd command-line interface;
e.g. pixi run salishsea help
Other environments used by commands in the sections below have addition packages for running
the test suite,
building and link checking the documentation,
etc.
If you are using an integrated development environment like VSCode or PyCharm
where you need a Python interpreter to support coding assistance features,
run development tasks,
etc.,
use the interpreter in the dev environment.
You can get its full path with pixi run -e dev which python
To get detailed information about the environments,
the packages installed in them,
Pixi tasks that are defined for them,
etc.,
use pixi info.
SalishSeaCmd is installed in editable install mode in all of the environments that
Pixi creates.
That means that changes you make to the code are immediately reflected in the environments.
Coding Style
The SalishSeaCmd package uses Git pre-commit hooks managed by pre-commit to
maintain consistent code style and and other aspects of code,
docs,
and repo QA.
To install the pre-commit hooks in a newly cloned repo,
run pre-commit install:
$ cd SalishSeaCmd
$ pixi run -e dev pre-commit install
Note
You only need to install the hooks once immediately after you make a new clone
of the SalishSeaCmd repository.
Building the Documentation
The documentation for the SalishSeaCmd package is written in reStructuredText and converted to HTML using Sphinx.
If you have write access to the repository on GitHub,
whenever you push changes to GitHub the documentation is automatically re-built and rendered at https://salishseacmd.readthedocs.io/en/latest/.
Additions,
improvements,
and corrections to these docs are always welcome.
The quickest way to fix typos, etc. on existing pages is to use the Edit on GitHub link in the upper right corner of the page to get to the online editor for the page on GitHub.
For more substantial work,
and to add new pages,
follow the instructions in the Development Environment section above.
In the development environment you can build the docs locally instead of having to push commits to GitHub to trigger a build on readthedocs.org and wait for it to complete.
Below are instructions that explain how to:
Building and Previewing the Documentation
Building the documentation is driven by docs/Makefile.
To do a clean build of the documentation use:
$ cd SalishSeaCmd/
$ pixi run docs
The output looks something like:
✨ Pixi task (docs in docs): make clean html
Removing everything under '_build'...
Running Sphinx v8.1.3
loading translations [en]... done
making output directory... done
loading intersphinx inventory 'python' from https://docs.python.org/3/objects.inv ...
loading intersphinx inventory 'salishseadocs' from https://salishsea-meopar-docs.readthedocs.io/en/latest/objects.inv ...
loading intersphinx inventory 'nemocmd' from https://nemo-cmd.readthedocs.io/en/latest/objects.inv ...
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 10 source files that are out of date
updating environment: [new config] 10 added, 0 changed, 0 removed
reading sources... [100%] subcommands
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying static files...
Writing evaluated template result to /media/doug/warehouse/MEOPAR/SalishSeaCmd/docs/_build/html/_static/language_data.js
Writing evaluated template result to /media/doug/warehouse/MEOPAR/SalishSeaCmd/docs/_build/html/_static/documentation_options.js
Writing evaluated template result to /media/doug/warehouse/MEOPAR/SalishSeaCmd/docs/_build/html/_static/basic.css
Writing evaluated template result to /media/doug/warehouse/MEOPAR/SalishSeaCmd/docs/_build/html/_static/js/versions.js
copying static files: done
copying extra files...
copying extra files: done
copying assets: done
writing output... [100%] subcommands
generating indices... genindex done
highlighting module code... [100%] salishsea_cmd.api
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.
The HTML pages are in _build/html.
The HTML rendering of the docs ends up in docs/_build/html/.
You can open the index.html file in that directory tree in your browser to preview the results of the build before committing and pushing your changes to GitHub.
Whenever you push changes to the SalishSeaCmd on GitHub the documentation is automatically re-built and rendered at https://salishseacmd.readthedocs.io/en/latest/.
Link Checking the Documentation
Sphinx also provides a link checker utility which can be run to find broken or redirected links in the docs.
Run the link checker with:
$ cd SalishSeaCmd/
$ pixi run linkcheck
The output looks something like:
✨ Pixi task (linkcheck in docs): make clean linkcheck
Removing everything under '_build'...
Running Sphinx v8.1.3
loading translations [en]... done
making output directory... done
loading intersphinx inventory 'python' from https://docs.python.org/3/objects.inv ...
loading intersphinx inventory 'salishseadocs' from https://salishsea-meopar-docs.readthedocs.io/en/latest/objects.inv ...
loading intersphinx inventory 'nemocmd' from https://nemo-cmd.readthedocs.io/en/latest/objects.inv ...
building [mo]: targets for 0 po files that are out of date
writing output...
building [linkcheck]: targets for 10 source files that are out of date
updating environment: [new config] 10 added, 0 changed, 0 removed
reading sources... [100%] subcommands
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets...
copying assets: done
writing output... [100%] subcommands
( pkg_development: line 36) ok https://app.readthedocs.org/projects/salishseacmd/badge/?version=latest
( pkg_development: line 23) ok https://black.readthedocs.io/en/stable/
( pkg_development: line 23) ok https://app.codecov.io/gh/SalishSeaCast/SalishSeaCmd
( pkg_development: line 29) ok https://codecov.io/gh/SalishSeaCast/SalishSeaCmd/branch/main/graph/badge.svg
( pkg_development: line 460) ok https://coverage.readthedocs.io/en/latest/
(breaking_changes: line 132) ok https://calver.org/
( installation: line 35) ok https://docs.conda.io/en/latest/
( installation: line 35) ok https://docs.conda.io/en/latest/miniconda.html
( pkg_development: line 426) ok https://docs.pytest.org/en/latest/
( pkg_development: line 219) ok https://app.readthedocs.org/projects/salishseacmd/builds/
( pkg_development: line 23) ok https://docs.python.org/3/
(breaking_changes: line 183) ok https://docs.python.org/3/library/constants.html#False
( api: line 23) ok https://docs.python.org/3/library/constants.html#None
(run_description_file/3.6_agrif_yaml_file: line 26) ok https://agrif.imag.fr/
( index: line 33) ok https://docs.openstack.org/cliff/latest/
( api: line 23) ok https://docs.python.org/3/library/functions.html#int
(run_description_file/3.6_yaml_file: line 446) ok https://docs.python.org/3/library/constants.html#True
( api: line 23) ok https://docs.python.org/3/library/stdtypes.html#dict
( api: line 23) ok https://docs.python.org/3/library/pathlib.html#pathlib.Path
( pkg_development: line 509) ok https://docs.github.com/en/actions
( api: line 23) ok https://docs.python.org/3/library/stdtypes.html#str
( subcommands: line 301) ok https://en.wikipedia.org/wiki/Universally_unique_identifier
( pkg_development: line 524) ok https://git-scm.com/
(breaking_changes: line 123) ok https://f90nml.readthedocs.io/en/latest/
( index: line 33) ok https://github.com/SalishSeaCast/NEMO-Cmd
( subcommands: line 382) ok https://github.com/SalishSeaCast/NEMO-Cmd/
( subcommands: line 444) ok https://github.com/SalishSeaCast/SS-run-sets/blob/main/v201905/hindcast/file_def_dailysplit.xml
( pkg_development: line 23) ok https://github.com/SalishSeaCast/SalishSeaCmd
( pkg_development: line 32) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions/workflows/codeql-analysis.yaml/badge.svg
( pkg_development: line 26) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions/workflows/pytest-with-coverage.yaml/badge.svg
( pkg_development: line 39) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions/workflows/sphinx-linkcheck.yaml/badge.svg
( pkg_development: line 496) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions
( pkg_development: line 23) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions?query=workflow:CodeQL
( pkg_development: line 23) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions?query=workflow:sphinx-linkcheck
( pkg_development: line 496) ok https://github.com/SalishSeaCast/SalishSeaCmd/commits/main
( pkg_development: line 416) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions?query=workflow%3Asphinx-linkcheck
( pkg_development: line 489) ok https://github.com/SalishSeaCast/SalishSeaCmd/workflows/pytest-with-coverage/badge.svg
( pkg_development: line 298) ok https://github.com/SalishSeaCast/SalishSeaCmd/workflows/sphinx-linkcheck/badge.svg
( pkg_development: line 23) ok https://github.com/SalishSeaCast/SalishSeaCmd/actions?query=workflow:pytest-with-coverage
( pkg_development: line 23) ok https://github.com/SalishSeaCast/SalishSeaCmd/issues
( pkg_development: line 23) ok https://github.com/SalishSeaCast/SalishSeaCmd/releases
(breaking_changes: line 106) ok https://gitpython.readthedocs.io/en/stable/
( index: line 67) ok https://github.com/SalishSeaCast/docs/blob/main/CONTRIBUTORS.rst
( pkg_development: line 65) ok https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg
( pkg_development: line 62) ok https://img.shields.io/badge/code%20style-black-000000.svg
( pkg_development: line 53) ok https://img.shields.io/badge/license-Apache%202-cb2533.svg
( pkg_development: line 59) ok https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
( pkg_development: line 49) ok https://img.shields.io/github/issues/SalishSeaCast/SalishSeaCmd?logo=github
( pkg_development: line 56) ok https://img.shields.io/badge/version%20control-git-blue.svg?logo=github
( pkg_development: line 43) ok https://img.shields.io/github/v/release/SalishSeaCast/SalishSeaCmd?logo=github
( pkg_development: line 46) ok https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/SalishSeaCast/SalishSeaCmd/main/pyproject.toml&logo=Python&logoColor=gold&label=Python
( installation: line 35) ok https://github.com/conda-forge/miniforge
( subcommands: line 390) ok https://nemo-cmd.readthedocs.io/en/latest/subcommands.html#nemo-combine
( subcommands: line 231) ok https://nemo-cmd.readthedocs.io/en/latest/subcommands.html#nemo-deflate
( pkg_development: line 23) ok https://github.com/pypa/hatch
( subcommands: line 432) ok https://nemo-cmd.readthedocs.io/en/latest/subcommands.html#nemo-gather
( pkg_development: line 119) ok https://pixi.prefix.dev/latest/installation/
( pkg_development: line 119) ok https://pixi.prefix.dev/latest/
( pkg_development: line 153) ok https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
( pkg_development: line 460) ok https://pytest-cov.readthedocs.io/en/latest/
(breaking_changes: line 175) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/code-notes/salishsea-nemo/land-processor-elimination/index.html#landprocessorelimination
( index: line 25) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/code-notes/salishsea-nemo/index.html#salishseanemo
( pkg_development: line 23) ok https://pre-commit.com
( pkg_development: line 172) ok https://pre-commit.com/
(run_description_file/index: line 25) ok https://pyyaml.org/wiki/PyYAMLDocumentation
( installation: line 33) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/repos_organization.html#nemo-cmd-repo
(run_description_file/3.6_yaml_file: line 91) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/repos_organization.html#nemo-3-6-code-repo
(run_description_file/3.6_yaml_file: line 173) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/code-notes/salishsea-nemo/land-processor-elimination/index.html#preferred-mpi-lpe-decompositions
( installation: line 33) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/repos_organization.html#salishseacmd-repo
(run_description_file/index: line 30) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/repos_organization.html#ss-run-sets-repo
( pkg_development: line 80) ok https://www.python.org/
(run_description_file/3.6_yaml_file: line 102) ok https://salishsea-meopar-docs.readthedocs.io/en/latest/repos_organization.html#xios-repo
( pkg_development: line 23) ok https://salishseacmd.readthedocs.io/en/latest/
( pkg_development: line 203) ok https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html
( index: line 72) ok https://www.apache.org/licenses/LICENSE-2.0
(run_description_file/3.6_yaml_file: line 76) ok https://slurm.schedmd.com/
( pkg_development: line 203) ok https://www.sphinx-doc.org/en/master/
build succeeded.
Look for any errors in the above output or in _build/linkcheck/output.txt
linkcheck is run monthly via a scheduled GitHub Actions workflow.
Running the Unit Tests
The test suite for the SalishSeaCmd package is in SalishSeaCmd/tests/.
The pytest tool is used for test fixtures and as the test runner for the suite.
To run the test suite in the most recent supported version of Python use:
$ cd SalishSeaCmd/
$ pixi run -e test pytest
to run the test suite.
The output looks something like:
================================= test session starts ===================================
platform linux -- Python 3.14.2, pytest-9.0.2, pluggy-1.6.0
Using --randomly-seed=3689377719
rootdir: /media/doug/warehouse/MEOPAR/SalishSeaCmd
configfile: pytest.ini
plugins: cov-7.0.0, randomly-3.15.0
collected 268 items
tests/test_api.py ...... [ 2%]
tests/test_run.py ......................................................................
........................................................................................
.......................................................................... [ 88%]
tests/test_prepare.py .............. [ 94%]
tests/test_split_results.py ................ [100%]
================================= 268 passed in 0.68s ===================================
You can monitor what lines of code the test suite exercises using the coverage.py and pytest-cov tools with the command:
$ cd SalishSeaCmd/
$ pixi run -e test pytest-cov
The test coverage report will be displayed below the test suite run output.
Alternatively,
you can use
$ cd SalishSeaCmd/
$ pixi run -e test pytest-cov-html
to produce an HTML report that you can view in your browser by opening
SalishSeaCmd/htmlcov/index.html.
Continuous Integration
The SalishSeaCmd package unit test suite is run and a coverage report is generated
whenever changes are pushed to GitHub.
The results are visible on the repo actions page,
from the green checkmarks beside commits on the repo commits page,
or from the green checkmark to the left of the “Latest commit” message on the
repo code overview page .
The testing coverage report is uploaded to codecov.io
The GitHub Actions workflow configuration that defines the continuous integration
tasks is in the .github/workflows/pytest-with-coverage.yaml file.
Release Process
Releases are done at Doug’s discretion when significant pieces of development work have been
completed.
The release process steps are:
Use pixi run -e dev hatch version release to bump the version from .devn to the next release
version identifier
Confirm that docs/breaking_changes.rst includes any relevant notes for the
version being released
Commit the version bump and breaking changes log update
Create an annotated tag for the release with Git -> New Tag… in PyCharm
or git tag -e -a vyy.n
Push the version bump commit and tag to GitHub
Use the GitHub web interface to create a release,
editing the auto-generated release notes into sections:
Features
Bug Fixes
Documentation
Maintenance
Dependency Updates
Use the GitHub Issues -> Milestones web interface to edit the release
milestone:
Use the GitHub Issues -> Milestones web interface to create a milestone for
the next release:
Set the Title to the next release version,
prepended with a v;
e.g. v23.1
Set the Due date to the end of the year of the next release
Set the Description to something like
v23.1 release - when it's ready :-)
Create the next release milestone
Review the open issues,
especially any that are associated with the milestone for the just released version,
and update their milestone.
Close the milestone for the just released version.
Use pixi run -e dev hatch version minor,dev to bump the version for the next development cycle,
or use pixi run -e dev hatch version major,minor,dev for a year rollover version bump
Commit the version bump
Push the version bump commit to GitHub