The latest version of modepy is available on PyPI. It can be installed with
pip install modepyIt is also available on conda-forge and can be installed from there using, e.g.,
conda install modepyFor development, we recommend cloning the Git repository and setting up a development environment. The source can be obtained from GitHub using, e.g.,
git clone https://github.com/inducer/modepymodepy is a pure Python library that (mainly) depends on numpy. However, it
has several development dependencies that will be needed when submitting a PR.
To ensure a development environment that does not pollute your system install,
we recommend using virtual
environments.
A new virtual environment can be created as follows
python -m venv .venvand activated using
source .venv/bin/activateThese commands may differ slightly based on your operating system, so for more
information see the official
documentation.
modepy uses standard Python packaging techniques and as such is also
compatible with additional tools, such as
uv or
conda.
Once a virtual environment has been set up, we recommend performing an editable install with all the necessary dependencies.
If using the standard pip, you can directly run (in your activated virtual
environment!) the following command
pip install --verbose --editable .[doc,test]Reporting any issues should be done in the GitHub Issue Tracker. When reporting an issue, include as much information as possible to allow reproducing or pinpointing the exact cause. For example, consider adding
- A small code snippet that reproduces the issue.
- Library versions (especially
numpy). - Environment information (operating system, Python version, etc.).
modepy uses ruff to check for coding
style and other issues. The library follows a variant of the PEP
8 rules as checked by the linter.
Furthermore, we aim for (close to) full type annotated code. This is checked with basedpyright.
The suggested way to contribute to modepy is through pull requests on Github. If you are aiming to develop a larger feature, we recommend opening an issue first to discuss if it is appropriate for inclusion and any additional implementation details.
To get your PR merged, we require that
- All unit tests pass.
- All linting tests must pass (
ruff,typos, and any other future additions). - New functionality should be documented and tested appropriately.
Any new code added to the repository is expected to have sufficient type
annotations to pass basedpyright. In specific cases (and with adequate
justification), additions to the existing baseline of typing deficiencies may
be allowable.
You can find the official documentation for
modepy online. The documentation is generated using the
Sphinx generator using the default syntax. It
can be generated locally using
cd doc
make htmland loaded from _build/html/index.html.
Additions and corrections are very welcome! If you have a cool non-trivial
example of modepy usage, also consider adding it to the examples folder.
By contributing, you agree that your contributions will be licensed under the same license as the project (the MIT license). You will retain copyright to your contribution. To facilitate appropriate tracking, please add your name to the license header that should be present at the top of each file.
modepy uses pytest for its unit testing
needs. All tests (unit tests and doctests) can be run directly using
python -m pytest -v -s modepyNew unit tests should be added to a new or existing file in modepy/test.
As mentioned before, modepy uses ruff and basedpyright for static
linting. These tools are configured in the pyproject.toml file and can be run
directly without additional options. For example, for linting use
ruff checkand for type checking use
basedpyright