Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .coveragerc

This file was deleted.

4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/generate-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
python -m pip install --group dev --group doc

- name: Install arch
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:
lint:
# The oldest and the newest supported Python. flake8 and black parse the code with
# the grammar of the Python that runs them.
# The oldest and the newest supported Python. black parses the code with the grammar
# of the Python that runs it.
name: Lint, Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
defaults:
Expand All @@ -27,19 +27,16 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# The lint dependency group in pyproject.toml
- name: Install the linters
id: install
run: |
python -m pip install --upgrade pip
python -m pip install black flake8 isort ruff "numpydoc>=1.10"
python -m pip install --group lint
python -m pip list

# Every check runs even when an earlier one fails, so that the log shows all of
# the problems
- name: flake8
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: flake8 arch

- name: ruff
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
run: ruff check arch
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/windows-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,18 @@ jobs:
python -c "import platform, sys; print(sys.version, platform.machine())"
python -c "import sys, sysconfig; print(sysconfig.get_platform()); sys.exit(sysconfig.get_platform() != 'win-arm64')"

# Only wheels, so that the job fails if a dependency would have to be compiled
# Only wheels, so that the job fails if a dependency would have to be compiled. The
# test requirements are the test dependency group in pyproject.toml.
- name: Install the dependencies
env:
NUMBA: ${{ matrix.numba }}
run: |
packages=(numpy scipy pandas statsmodels matplotlib seaborn "pytest>=9,<10" pytest-xdist)
packages=(numpy scipy pandas statsmodels matplotlib seaborn)
if [[ "${NUMBA}" == "true" ]]; then
packages+=(numba)
fi
python -m pip install --upgrade pip
python -m pip install --only-binary=:all: "${packages[@]}"
python -m pip install --only-binary=:all: --group test "${packages[@]}"

- name: Build the wheel
run: |
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,14 +266,19 @@ Building the extensions from source needs the Visual Studio Build Tools

### Developing

The development requirements are:

- Cython (3.1+), meson-python and ninja, unless building without the binary
modules
- pytest (9+, for tests)
- sphinx (to build docs)
- sphinx-immaterial (to build docs)
- jupyter, notebook and nbsphinx (to build docs)
The development requirements are dependency groups in `pyproject.toml`,
which pip 25.1 or later installs. From a clone of the repository,

```shell
python -m pip install --group dev
python -m pip install -e . --no-build-isolation
```

installs the tools to build (Cython 3.1+, meson-python and ninja), test
(pytest 9+) and lint arch, and then arch itself. Adding `--group doc` to the
first command also installs what the documentation needs (sphinx,
sphinx-immaterial and nbsphinx). `doc/source/contributing.rst` lists the
commands that check the code.

### Installation Notes

Expand Down
3 changes: 0 additions & 3 deletions arch/unitroot/critical_values/simulation/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions ci/azure/azure_template_posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:

- script: |
echo "Testing editable install"
export COVERAGE_OPTS="--cov-config=.coveragerc --cov=arch --cov-branch --cov-report xml:coverage.xml --cov-report term"
export COVERAGE_OPTS="--cov=arch --cov-branch --cov-report xml:coverage.xml --cov-report term"
echo pytest -m "${PYTEST_PATTERN}" --junitxml=junit/test-results.xml -n auto --durations=25 ${COVERAGE_OPTS} arch/tests
pytest -m "${PYTEST_PATTERN}" --junitxml=junit/test-results.xml -n auto --durations=25 ${COVERAGE_OPTS} arch/tests
displayName: 'Run tests (editable)'
Expand All @@ -230,7 +230,7 @@ jobs:
echo "Testing with Cython coverage"
# Uninstall xdist to avoid issues with coverage and Cython
python -m pip uninstall pytest-xdist -y || true
export COVERAGE_OPTS="--cov-config=.coveragerc --cov=arch --cov-branch --cov-report xml:coverage.xml --cov-report term"
export COVERAGE_OPTS="--cov=arch --cov-branch --cov-report xml:coverage.xml --cov-report term"
echo pytest --junitxml=junit/test-results.xml --durations=25 ${COVERAGE_OPTS} arch/tests/univariate/test_recursions.py arch/tests/bootstrap/test_samplers.py arch/tests/univariate/test_arch_in_mean.py
pytest --junitxml=junit/test-results.xml --durations=25 ${COVERAGE_OPTS} arch/tests/univariate/test_recursions.py arch/tests/bootstrap/test_samplers.py arch/tests/univariate/test_arch_in_mean.py
displayName: 'Run tests (cython coverage)'
Expand Down
12 changes: 7 additions & 5 deletions ci/azure/azure_template_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ jobs:
strategy:
# The newest Python with the newest packages, and the oldest Python with numpy 1.x
# (the default integer is 32 bits on Windows) and pandas 2.1. PACKAGES is installed
# in a single pip command with requirements.txt, so that pip also picks versions
# of the other packages that work with the pins.
# in a single pip command with the build and test dependency groups in
# pyproject.toml, so that pip also picks versions of the other packages that work
# with the pins. pip installs scipy, pandas and statsmodels with arch when PACKAGES
# does not list them.
matrix:
python314_win_latest:
python.version: '3.14'
PACKAGES: 'matplotlib seaborn'
python310_win_numpy126:
python.version: '3.10'
PACKAGES: 'numpy==1.26.4 scipy==1.11.4 pandas==2.1.4 statsmodels==0.14.1 matplotlib seaborn numba build'
Expand All @@ -40,9 +43,8 @@ jobs:
- script: |
python -m venv arch-test
call arch-test\Scripts\activate.bat
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt -U
python -m pip install %PACKAGES% -r requirements.txt -U || exit /b 1
python -m pip install --upgrade pip
python -m pip install --group build --group test %PACKAGES% -U || exit /b 1
python -m pip list
displayName: 'Create Venv and Install dependencies'

Expand Down
21 changes: 15 additions & 6 deletions ci/azure/install-posix.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

# The build tools, the test requirements and the packages that the example notebooks
# need are dependency groups in pyproject.toml, which pip 25.1 or later installs
DEP_GROUPS=(--group build --group test --group notebooks)

if [[ ${USE_CONDA} == "true" ]]; then
# Miniforge (conda-forge only) is installed by the pipeline and the env's bin
# directory is on PATH, so no activation is needed.
Expand All @@ -13,16 +17,15 @@ if [[ ${USE_CONDA} == "true" ]]; then
fi
CMD="mamba install -n arch-test -y -c conda-forge numpy"
else
CMD="python -m pip install numpy"
CMD="python -m pip install ${DEP_GROUPS[*]} numpy"
fi

python -m pip install --upgrade pip "setuptools>=61" wheel
python -m pip install cython "pytest>=9,<10" pytest-xdist "coverage[toml]" pytest-cov ipython jupyter notebook nbconvert "property_cached>=1.6.3" nbconvert setuptools_scm colorama "meson-python>=0.18.0" meson ninja "numpydoc>=1.10"

python -m pip install --upgrade pip

# Versions are exact so that the job tests what its matrix entry says, and all of
# the packages are installed in a single command so that the installer picks
# versions of matplotlib, seaborn, ... that work with them
# the packages (with pip, also the dependency groups) are installed in a single
# command so that the installer picks versions of matplotlib, seaborn, ... that work
# with them
if [[ -n ${NUMPY} ]]; then CMD="$CMD==${NUMPY}"; fi;
CMD="$CMD scipy"
if [[ -n ${SCIPY} ]]; then CMD="$CMD==${SCIPY}"; fi;
Expand All @@ -47,6 +50,12 @@ CMD="$CMD $EXTRA"
echo $CMD
eval $CMD || exit 1

if [[ ${USE_CONDA} == "true" ]]; then
# After the conda packages, so that pip keeps the numpy from conda-forge
echo python -m pip install "${DEP_GROUPS[@]}"
python -m pip install "${DEP_GROUPS[@]}" || exit 1
fi

if [[ ${NO_MATPLOTLIB,,} == true ]]; then
# Fail if another package installed matplotlib, so that the job really tests without it
if python -c "import importlib.util, sys; sys.exit(importlib.util.find_spec('matplotlib') is None)"; then
Expand Down
25 changes: 0 additions & 25 deletions doc/requirements.txt

This file was deleted.

7 changes: 7 additions & 0 deletions doc/source/changes/9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,13 @@ Documentation and maintenance
test suite, including the slow tests, on Python 3.13 to 3.15. Unlike the other jobs,
it does not limit the number of BLAS threads, because NumPy's OpenBLAS on this
platform crashes with one thread (see "Compatibility") (:issue:`1003`).
- The development requirements are dependency groups in ``pyproject.toml``, which pip
25.1 or later installs, for example with ``python -m pip install --group dev`` (see
the contributing guide). They replace ``requirements.txt``, ``requirements-dev.txt``
and ``doc/requirements.txt``, and the ``test``, ``doc`` and ``dev`` extras, which have
been removed. The settings of coverage moved from ``.coveragerc`` to
``pyproject.toml``, and ruff replaces flake8 in the style checks, with the same limit
of 99 characters on comments, docstrings and long strings (:issue:`1021`).

Deprecations and removals
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
45 changes: 43 additions & 2 deletions doc/source/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
Contributing
============

Development environment
-----------------------

The development requirements are dependency groups (PEP 735) in ``pyproject.toml``,
which pip 25.1 or later installs. From the root of a clone of the repository,

.. code-block:: bash

python -m pip install --group dev
python -m pip install -e . --no-build-isolation

installs the build tools, the test runner, the linters and the packages that the example
notebooks need, and then builds and installs arch in place. Add ``--group doc`` to the
first command to also build the documentation. The groups are:

* ``build``: what ``python -m pip install -e . --no-build-isolation`` needs (Cython,
meson, meson-python, ninja, NumPy and setuptools-scm).
* ``test``: pytest, pytest-xdist, pytest-cov and numpydoc.
* ``notebooks``: jupyter and nbconvert, which the slow tests use to run the example
notebooks.
* ``lint``: ruff, black, isort, numpydoc, mypy and the pandas and SciPy stubs.
* ``docstrings``: numpydoc, which ``test`` and ``lint`` include.
* ``dev``: ``build``, ``test``, ``lint`` and ``notebooks``, with matplotlib, seaborn and
pytest-randomly.
* ``doc``: Sphinx, sphinx-immaterial and nbsphinx, in addition to ``dev``.
* ``simulation``: the packages that the scripts in
``arch/unitroot/critical_values/simulation`` need in addition to ``dev``.

The groups do not include the dependencies of arch, which pip installs with arch. The
tests and the checks that CI runs are

.. code-block:: bash

python -m pytest arch/tests -n auto -m "not slow"
ruff check arch
black --check arch
isort --check arch
python -m numpydoc lint $(git ls-files "arch/*.py")

and the settings of all of these tools are in ``pyproject.toml``.

Docstrings
----------

Expand Down Expand Up @@ -115,8 +156,8 @@ The rules are configured in the ``[tool.numpydoc_validation]`` table of
python -m numpydoc lint $(git ls-files "arch/*.py")
python -m pytest arch/tests/test_docstrings.py

Both need numpydoc 1.10 or later, which ``requirements-dev.txt`` and the ``dev`` extra
install. The Lint workflow runs the first command, and the second is skipped when
Both need numpydoc 1.10 or later, which the ``test``, ``lint`` and ``dev`` dependency
groups install. The Lint workflow runs the first command, and the second is skipped when
numpydoc is not installed.

``numpydoc lint`` reads the source files. It cannot see a docstring that a class
Expand Down
Loading
Loading