Developing MRI-nufft#
If you are a first time contributor, we recommend you to check the CONTRIBUTING.md file.
Developement environment#
We recommend to use a virtual environement, and install mri-nufft and its dependencies in it.
Running tests#
To run tests you will need to install the test extra dependencies with e.g. pip install -e .[test]
You can run the tests with pytest. Don’t hesitate to check how our CI runs tests for more details.
Writing documentation#
Documentation is available online at https://mind-inria.github.io/mri-nufft
It can also be built locally
cd mri-nufft
pip install -e .[doc]
python -m sphinx docs docs_build
To view the html doc locally you can use
python -m http.server --directory docs_build 8000
And visit localhost:8000 on your web browser.
API stability and deprecations#
MRI-nufft follows effort-based versioning rather than strict semantic versioning: a minor release may change the public API, but such changes go through a deprecation period whenever possible, and are always listed in the changelog.
The public API is everything exported in the __all__ of a public (not
underscored) module. A deprecated part of it keeps working, and emits a
mrinufft._deprecation.MRINufftDeprecationWarning (a FutureWarning, shown
by default), for at least two minor releases before its removal: deprecated in
1.7.0, removed in 1.9.0 at the earliest.
Use the helpers of mrinufft._deprecation, which keep the messages consistent:
from mrinufft._deprecation import deprecated, moved_attribute, renamed_parameter
@deprecated(since="1.7.0", removed_in="1.9.0", alternative="`new_func`")
def old_func(...): ...
@renamed_parameter("n", "n_bins", since="1.7.0", removed_in="1.9.0")
def func(..., n_bins=-1): ...
# In the module the object moved away from:
def __getattr__(name):
if name == "OldName":
return moved_attribute(
__name__, name, "mrinufft.new.module", since="1.7.0", removed_in="1.9.0"
)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
New parameters should be added after the existing ones, preferably as keyword-only, so that positional calls keep their meaning.
When a pull request breaks or deprecates part of the public API, including
behaviour changes that leave the signatures untouched (a new default, a sign
convention, an axis order…), add an entry to the Unreleased section of
docs/changelog.rst.
Making a release#
The version number comes from the git tag, through setuptools_scm: there is
nothing to bump.
Prepare the release in a pull request:
git fetch origin git switch -c release-X.Y.Z origin/master uv run --extra test tools/release.py prepare X.Y.Z git commit -am "chore: release X.Y.Z" gh pr create --fill
preparestops if a deprecated object is due for removal inX.Y.Z: remove it first. It then renames the Unreleased section ofdocs/changelog.rsttoX.Y.Z (date), and opens a new Unreleased section. Check that this section is complete before merging.Tag the merged commit and push the tag:
git switch master && git pull git tag -a vX.Y.Z -m "vX.Y.Z" git push origin vX.Y.Z
The
tags-release.ymlworkflow drafts the GitHub release, with the changelog section followed by the list of pull requests and new contributors, then publishes the package on PyPI. It publishes nothing if the changelog has noX.Y.Zsection.Proofread and publish the draft release, which also archives it on Zenodo.