Skip to content

Commit c7ef0d4

Browse files
committed
DOC: Add docs on using tox and pre-commit
1 parent dadd3f5 commit c7ef0d4

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

doc/source/devel/devguide.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,50 @@ advise that you enable merge summaries within git:
9595

9696
See :ref:`configure-git` for more detail.
9797

98+
Pre-commit hooks
99+
----------------
100+
101+
NiBabel uses pre-commit_ to help committers validate their changes
102+
before committing. To enable these, you can use pipx_::
103+
104+
pipx run pre-commit install
105+
106+
Or install and run::
107+
108+
python -m pip install pre-commit
109+
pre-commit install
110+
111+
112+
Testing
113+
=======
114+
115+
NiBabel uses tox_ to organize our testing and development workflows.
116+
tox runs tests in isolated environments that we specify,
117+
ensuring that we are able to test across many different environments,
118+
and those environments do not depend on our local configurations.
119+
120+
If you have the pipx_ tool installed, then you may simply::
121+
122+
pipx run tox
123+
124+
Alternatively, you can install tox and run it::
125+
126+
python -m pip install tox
127+
tox
128+
129+
This will run the tests in several configurations, with multiple sets of
130+
optional dependencies.
131+
If you have multiple versions of Python installed in your path, it will
132+
repeat the process for each version of Python iin our supported range.
133+
It may be useful to pick a particular version for rapid development::
134+
135+
tox -e py311-full-x64
136+
137+
This will run the environment using the Python 3.11 interpreter, with the
138+
full set of optional dependencies that are available for 64-bit
139+
interpreters. If you are using 32-bit Python, replace ``-x64`` with ``-x86``.
140+
141+
98142
Changelog
99143
=========
100144

@@ -123,3 +167,7 @@ Community guidelines
123167
Please see `our community guidelines
124168
<https://github.com/nipy/nibabel/blob/master/.github/CODE_OF_CONDUCT.md>`_.
125169
Other projects call these guidelines the "code of conduct".
170+
171+
.. _tox: https://tox.wiki
172+
.. _pipx: https://pypa.github.io/pipx/
173+
.. _precommit: https://pre-commit.com/

nibabel/info.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,27 @@
6262
.. _release archive: https://github.com/nipy/NiBabel/releases
6363
.. _development changelog: https://nipy.org/nibabel/changelog.html
6464
65+
Testing
66+
=======
67+
68+
During development, we recommend using tox_ to run nibabel tests::
69+
70+
git clone https://github.com/nipy/nibabel.git
71+
cd nibabel
72+
tox
73+
74+
To test an installed version of nibabel, install the test dependencies
75+
and run pytest_::
76+
77+
pip install nibabel[test]
78+
pytest --pyargs nibabel
79+
80+
For more inforation, consult the `developer guidelines`_.
81+
82+
.. _tox: https://tox.wiki
83+
.. _pytest: https://docs.pytest.org
84+
.. _developer guidelines: https://nipy.org/nibabel/devel/devguide.html
85+
6586
Mailing List
6687
============
6788

0 commit comments

Comments
 (0)