diff --git a/.copier-answers.yml b/.copier-answers.yml index ef43bf0..f758cf3 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,8 +1,8 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 101e594 +_commit: aa5dc5e _src_path: gh:scipp/copier_template description: Data reduction for NMX at the European Spallation Source. -max_python: '3.12' +max_python: '3.13' min_python: '3.10' namespace_package: ess nightly_deps: scipp,sciline,scippnexus,plopp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8234bc9..b273e68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: jobs: formatting: name: Formatting and static analysis - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} min_tox_env: ${{ steps.vars.outputs.min_tox_env }} @@ -19,15 +19,15 @@ jobs: - name: Get Python version for other CI jobs id: vars run: | - echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT - echo "min_tox_env=py$(cat .github/workflows/python-version-ci | sed 's/\.//g')" >> $GITHUB_OUTPUT + echo "min_python=$(< .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT" + echo "min_tox_env=py$(sed 's/\.//g' < .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT" - uses: actions/setup-python@v5 with: python-version-file: '.github/workflows/python-version-ci' - uses: pre-commit/action@v3.0.1 with: extra_args: --all-files - - uses: pre-commit-ci/lite-action@v1.0.2 + - uses: pre-commit-ci/lite-action@v1.1.0 if: always() with: msg: Apply automatic formatting @@ -37,7 +37,7 @@ jobs: needs: formatting strategy: matrix: - os: ['ubuntu-22.04'] + os: ['ubuntu-24.04'] python: - version: '${{needs.formatting.outputs.min_python}}' tox-env: '${{needs.formatting.outputs.min_tox_env}}' @@ -53,6 +53,6 @@ jobs: uses: ./.github/workflows/docs.yml with: publish: false - linkcheck: ${{ contains(matrix.variant.os, 'ubuntu') && github.ref == 'refs/heads/main' }} + linkcheck: ${{ github.ref == 'refs/heads/main' }} branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }} secrets: inherit diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a5ea2b0..72659cb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -41,7 +41,7 @@ env: jobs: docs: name: Build documentation - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' env: ESS_PROTECTED_FILESTORE_USERNAME: ${{ secrets.ESS_PROTECTED_FILESTORE_USERNAME }} ESS_PROTECTED_FILESTORE_PASSWORD: ${{ secrets.ESS_PROTECTED_FILESTORE_PASSWORD }} @@ -58,7 +58,7 @@ jobs: python-version-file: '.github/workflows/python-version-ci' - run: python -m pip install --upgrade pip - run: python -m pip install -r requirements/ci.txt - - run: tox -e releasedocs -- ${VERSION} + - run: tox -e releasedocs -- "${VERSION}" if: ${{ inputs.version != '' }} - run: tox -e docs if: ${{ inputs.version == '' }} @@ -69,7 +69,7 @@ jobs: name: docs_html path: html/ - - uses: JamesIves/github-pages-deploy-action@v4.6.3 + - uses: JamesIves/github-pages-deploy-action@v4.6.9 if: ${{ inputs.publish }} with: branch: gh-pages diff --git a/.github/workflows/nightly_at_main.yml b/.github/workflows/nightly_at_main.yml index c2b9d33..20e9ee4 100644 --- a/.github/workflows/nightly_at_main.yml +++ b/.github/workflows/nightly_at_main.yml @@ -8,21 +8,21 @@ on: jobs: setup: name: Setup variables - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} steps: - uses: actions/checkout@v4 - name: Get Python version for other CI jobs id: vars - run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT + run: echo "min_python=$(< .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT" tests: name: Tests needs: setup strategy: matrix: - os: ['ubuntu-22.04'] + os: ['ubuntu-24.04'] python: - version: '${{needs.setup.outputs.min_python}}' tox-env: 'nightly' diff --git a/.github/workflows/nightly_at_release.yml b/.github/workflows/nightly_at_release.yml index 3faa1c2..14b7521 100644 --- a/.github/workflows/nightly_at_release.yml +++ b/.github/workflows/nightly_at_release.yml @@ -8,7 +8,7 @@ on: jobs: setup: name: Setup variables - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} release_tag: ${{ steps.release.outputs.release_tag }} @@ -18,17 +18,17 @@ jobs: fetch-depth: 0 # history required so we can determine latest release tag - name: Get last release tag from git id: release - run: echo "release_tag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*')" >> $GITHUB_OUTPUT + run: echo "release_tag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*')" >> "$GITHUB_OUTPUT" - name: Get Python version for other CI jobs id: vars - run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT + run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT" tests: name: Tests needs: setup strategy: matrix: - os: ['ubuntu-22.04'] + os: ['ubuntu-24.04'] python: - version: '${{needs.setup.outputs.min_python}}' tox-env: 'nightly' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1317a7..fe8ef23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ defaults: jobs: build_conda: name: Conda build - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' steps: - uses: actions/checkout@v4 @@ -35,7 +35,7 @@ jobs: build_wheels: name: Wheels - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' steps: - uses: actions/checkout@v4 @@ -61,7 +61,7 @@ jobs: upload_pypi: name: Deploy PyPI needs: [build_wheels, build_conda] - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' environment: release permissions: id-token: write @@ -73,7 +73,7 @@ jobs: upload_conda: name: Deploy Conda needs: [build_wheels, build_conda] - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' if: github.event_name == 'release' && github.event.action == 'published' steps: @@ -97,7 +97,7 @@ jobs: assets: name: Upload docs needs: docs - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' permissions: contents: write # This is needed so that the action can upload the asset steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 373ea4a..ca40b25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: os-variant: - default: 'ubuntu-22.04' + default: 'ubuntu-24.04' type: string python-version: type: string @@ -23,7 +23,7 @@ on: workflow_call: inputs: os-variant: - default: 'ubuntu-22.04' + default: 'ubuntu-24.04' type: string python-version: type: string @@ -41,6 +41,21 @@ on: type: string jobs: + package-test: + runs-on: ${{ inputs.os-variant }} + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.checkout_ref }} + - uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + - run: python -m pip install --upgrade pip + - run: python -m pip install . + - run: python tests/package_test.py + name: Run package tests + test: runs-on: ${{ inputs.os-variant }} env: diff --git a/.github/workflows/unpinned.yml b/.github/workflows/unpinned.yml index 3f49f72..ff03faa 100644 --- a/.github/workflows/unpinned.yml +++ b/.github/workflows/unpinned.yml @@ -8,7 +8,7 @@ on: jobs: setup: name: Setup variables - runs-on: 'ubuntu-22.04' + runs-on: 'ubuntu-24.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} release_tag: ${{ steps.release.outputs.release_tag }} @@ -18,17 +18,17 @@ jobs: fetch-depth: 0 # history required so we can determine latest release tag - name: Get last release tag from git id: release - run: echo "release_tag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*')" >> $GITHUB_OUTPUT + run: echo "release_tag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*')" >> "$GITHUB_OUTPUT" - name: Get Python version for other CI jobs id: vars - run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT + run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT" tests: name: Tests needs: setup strategy: matrix: - os: ['ubuntu-22.04'] + os: ['ubuntu-24.04'] python: - version: '${{needs.setup.outputs.min_python}}' tox-env: 'unpinned' diff --git a/.gitignore b/.gitignore index 46c5ae8..3e02ecc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,13 @@ dist html .tox *.egg-info +uv.lock # we lock dependencies with pip-compile, not uv *.sw? # Environments venv +.venv # Caches .clangd/ @@ -39,3 +41,6 @@ docs/generated/ *.cif *.rcif *.ort +*.zip +*.sqw +*.nxspe diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4442b1b..f83362c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,10 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-added-large-files + - id: check-case-conflict + - id: check-illegal-windows-names - id: check-json exclude: asv.conf.json - id: check-merge-conflict @@ -14,14 +16,14 @@ repos: args: [ --markdown-linebreak-ext=md ] exclude: '\.svg' - repo: https://github.com/kynan/nbstripout - rev: 0.6.0 + rev: 0.7.1 hooks: - id: nbstripout types: [ "jupyter" ] args: [ "--drop-empty-cells", "--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.3 + rev: v0.6.9 hooks: - id: ruff args: [ --fix ] @@ -29,7 +31,7 @@ repos: - id: ruff-format types_or: [ python, pyi ] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: @@ -44,3 +46,9 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - id: text-unicode-replacement-char + - repo: https://github.com/rhysd/actionlint + rev: v1.7.3 + hooks: + - id: actionlint + # Disable because of false-positive SC2046 + args: ["-shellcheck="] diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..c8cfe39 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10 diff --git a/conda/meta.yaml b/conda/meta.yaml index 1043461..08c4160 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -9,6 +9,7 @@ source: {% set pyproject = load_file_data('pyproject.toml') %} {% set dependencies = pyproject.get('project', {}).get('dependencies', {}) %} +{% set test_dependencies = pyproject.get('project', {}).get('optional-dependencies', {}).get('test', {}) %} requirements: @@ -38,7 +39,13 @@ test: imports: - ess.nmx requires: - - pytest + + {# Conda does not allow spaces between package name and version, so remove them #} + {% for package in test_dependencies %} + - {% if package == "graphviz" %}python-graphviz{% else %}{{ package|replace(" ", "") }}{% endif %} + {% endfor %} + + source_files: - pyproject.toml - tests/ diff --git a/docs/conf.py b/docs/conf.py index adc0f23..5dd75d9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) + import doctest import os import sys diff --git a/pyproject.toml b/pyproject.toml index d538404..ef14360 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering", "Typing :: Typed", ] @@ -44,6 +45,11 @@ dependencies = [ dynamic = ["version"] +[project.optional-dependencies] +test = [ + "pytest", +] + [project.urls] "Bug Tracker" = "https://github.com/scipp/essnmx/issues" "Documentation" = "https://scipp.github.io/essnmx" @@ -80,8 +86,8 @@ ignore = [ # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "COM812", "COM819", "D206", "D300", "E111", "E114", "E117", "ISC001", "ISC002", "Q000", "Q001", "Q002", "Q003", "W191", ] -fixable = ["I001", "B010"] -isort.known-first-party = ["essnmx"] +fixable = ["B010", "I001", "PT001"] +isort.known-first-party = ["ess.nmx"] pydocstyle.convention = "numpy" [tool.ruff.lint.per-file-ignores] @@ -112,3 +118,11 @@ enable_error_code = [ "truthy-bool", ] warn_unreachable = true + +[tool.codespell] +ignore-words-list = [ + # Codespell wants "socioeconomic" which seems to be the standard spelling. + # But we use the word in our code of conduct which is the contributor covenant. + # Let's not modify it if we don't have to. + "socio-economic", +] diff --git a/requirements/base.txt b/requirements/base.txt index 08691c4..67d7d68 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -5,45 +5,47 @@ # # pip-compile-multi # -certifi==2024.7.4 +certifi==2024.8.30 # via requests -charset-normalizer==3.3.2 +charset-normalizer==3.4.0 # via requests click==8.1.7 # via dask -cloudpickle==3.0.0 +cloudpickle==3.1.0 # via dask -contourpy==1.2.1 +contourpy==1.3.1 # via matplotlib -cyclebane==24.6.0 +cyclebane==24.10.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2024.7.1 +dask==2024.11.2 # via -r base.in defusedxml==0.7.1 # via -r base.in -fonttools==4.53.1 +fonttools==4.55.0 # via matplotlib -fsspec==2024.6.1 +fsspec==2024.10.0 # via dask -gemmi==0.6.6 +gemmi==0.6.7 # via -r base.in graphviz==0.20.3 # via -r base.in -h5py==3.11.0 +h5py==3.12.1 # via scippnexus -idna==3.7 +idna==3.10 # via requests -kiwisolver==1.4.5 +importlib-metadata==8.5.0 + # via dask +kiwisolver==1.4.7 # via matplotlib locket==1.0.0 # via partd -matplotlib==3.9.1 +matplotlib==3.9.2 # via plopp -networkx==3.3 +networkx==3.4.2 # via cyclebane -numpy==2.0.1 +numpy==2.1.3 # via # contourpy # h5py @@ -51,53 +53,55 @@ numpy==2.0.1 # pandas # scipp # scipy -packaging==24.1 +packaging==24.2 # via # dask # matplotlib # pooch -pandas==2.2.2 +pandas==2.2.3 # via -r base.in partd==1.4.2 # via dask -pillow==10.4.0 +pillow==11.0.0 # via matplotlib -platformdirs==4.2.2 +platformdirs==4.3.6 # via pooch -plopp==24.6.0 +plopp==24.10.0 # via -r base.in pooch==1.8.2 # via -r base.in -pyparsing==3.1.2 +pyparsing==3.2.0 # via matplotlib python-dateutil==2.9.0.post0 # via # matplotlib # pandas # scippnexus -pytz==2024.1 +pytz==2024.2 # via pandas -pyyaml==6.0.1 +pyyaml==6.0.2 # via dask requests==2.32.3 # via pooch -sciline==24.6.2 +sciline==24.10.0 # via -r base.in scipp==24.11.1 # via # -r base.in # scippnexus -scippnexus==24.6.0 +scippnexus==24.11.0 # via -r base.in -scipy==1.14.0 +scipy==1.14.1 # via scippnexus six==1.16.0 # via python-dateutil -toolz==0.12.1 +toolz==1.0.0 # via # dask # partd -tzdata==2024.1 +tzdata==2024.2 # via pandas -urllib3==2.2.2 +urllib3==2.2.3 # via requests +zipp==3.21.0 + # via importlib-metadata diff --git a/requirements/basetest.in b/requirements/basetest.in index e4a48b2..5b3942e 100644 --- a/requirements/basetest.in +++ b/requirements/basetest.in @@ -1,4 +1,10 @@ # Dependencies that are only used by tests. # Do not make an environment from this file, use test.txt instead! +# Add more dependencies in the ``test`` list +# under ``[project.optional-dependencies]`` section, in ``pyproject.toml`` +# Anything above "--- END OF CUSTOM SECTION ---" +# will not be touched by ``make_base.py`` +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! pytest diff --git a/requirements/basetest.txt b/requirements/basetest.txt index 01f19d1..66970e0 100644 --- a/requirements/basetest.txt +++ b/requirements/basetest.txt @@ -9,11 +9,11 @@ exceptiongroup==1.2.2 # via pytest iniconfig==2.0.0 # via pytest -packaging==24.1 +packaging==24.2 # via pytest pluggy==1.5.0 # via pytest -pytest==8.3.1 +pytest==8.3.3 # via -r basetest.in -tomli==2.0.1 +tomli==2.1.0 # via pytest diff --git a/requirements/ci.txt b/requirements/ci.txt index 4bad3ae..14921a2 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -5,19 +5,19 @@ # # pip-compile-multi # -cachetools==5.4.0 +cachetools==5.5.0 # via tox -certifi==2024.7.4 +certifi==2024.8.30 # via requests chardet==5.2.0 # via tox -charset-normalizer==3.3.2 +charset-normalizer==3.4.0 # via requests colorama==0.4.6 # via tox -distlib==0.3.8 +distlib==0.3.9 # via virtualenv -filelock==3.15.4 +filelock==3.16.1 # via # tox # virtualenv @@ -25,32 +25,34 @@ gitdb==4.0.11 # via gitpython gitpython==3.1.43 # via -r ci.in -idna==3.7 +idna==3.10 # via requests -packaging==24.1 +packaging==24.2 # via # -r ci.in # pyproject-api # tox -platformdirs==4.2.2 +platformdirs==4.3.6 # via # tox # virtualenv pluggy==1.5.0 # via tox -pyproject-api==1.7.1 +pyproject-api==1.8.0 # via tox requests==2.32.3 # via -r ci.in smmap==5.0.1 # via gitdb -tomli==2.0.1 +tomli==2.1.0 # via # pyproject-api # tox -tox==4.16.0 +tox==4.23.2 # via -r ci.in -urllib3==2.2.2 +typing-extensions==4.12.2 + # via tox +urllib3==2.2.3 # via requests -virtualenv==20.26.3 +virtualenv==20.27.1 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index f0b20ea..f9cab17 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -14,7 +14,7 @@ -r wheels.txt annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.6.2.post1 # via # httpx # jupyter-server @@ -26,11 +26,11 @@ arrow==1.3.0 # via isoduration async-lru==2.0.4 # via jupyterlab -cffi==1.16.0 +cffi==1.17.1 # via argon2-cffi-bindings -copier==9.3.1 +copier==9.4.1 # via -r dev.in -dunamai==1.21.2 +dunamai==1.23.0 # via copier fqdn==1.5.1 # via jsonschema @@ -38,15 +38,15 @@ funcy==2.0 # via copier h11==0.14.0 # via httpcore -httpcore==1.0.5 +httpcore==1.0.7 # via httpx -httpx==0.27.0 +httpx==0.27.2 # via jupyterlab isoduration==20.11.0 # via jsonschema jinja2-ansible-filters==1.3.2 # via copier -json5==0.9.25 +json5==0.9.28 # via jupyterlab-server jsonpointer==3.0.0 # via jsonschema @@ -67,7 +67,7 @@ jupyter-server==2.14.2 # notebook-shim jupyter-server-terminals==0.5.3 # via jupyter-server -jupyterlab==4.2.4 +jupyterlab==4.3.1 # via -r dev.in jupyterlab-server==2.27.3 # via jupyterlab @@ -81,15 +81,15 @@ pip-compile-multi==2.6.4 # via -r dev.in pip-tools==7.4.1 # via pip-compile-multi -plumbum==1.8.3 +plumbum==1.9.0 # via copier -prometheus-client==0.20.0 +prometheus-client==0.21.0 # via jupyter-server pycparser==2.22 # via cffi -pydantic==2.8.2 +pydantic==2.10.1 # via copier -pydantic-core==2.20.1 +pydantic-core==2.27.1 # via pydantic python-json-logger==2.0.7 # via jupyter-events @@ -115,15 +115,15 @@ terminado==0.18.1 # jupyter-server-terminals toposort==1.10 # via pip-compile-multi -types-python-dateutil==2.9.0.20240316 +types-python-dateutil==2.9.0.20241003 # via arrow uri-template==1.3.0 # via jsonschema -webcolors==24.6.0 +webcolors==24.11.1 # via jsonschema websocket-client==1.8.0 # via jupyter-server -wheel==0.43.0 +wheel==0.45.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/docs.txt b/requirements/docs.txt index 8de8030..5dd4a56 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -8,15 +8,17 @@ -r base.txt accessible-pygments==0.0.5 # via pydata-sphinx-theme -alabaster==0.7.16 +alabaster==1.0.0 # via sphinx +appnope==0.1.4 + # via ipykernel asttokens==2.4.1 # via stack-data -attrs==23.2.0 +attrs==24.2.0 # via # jsonschema # referencing -babel==2.15.0 +babel==2.16.0 # via # pydata-sphinx-theme # sphinx @@ -24,13 +26,13 @@ beautifulsoup4==4.12.3 # via # nbconvert # pydata-sphinx-theme -bleach==6.1.0 +bleach==6.2.0 # via nbconvert comm==0.2.2 # via # ipykernel # ipywidgets -debugpy==1.8.2 +debugpy==1.8.9 # via ipykernel decorator==5.1.1 # via ipython @@ -42,7 +44,7 @@ docutils==0.21.2 # sphinx exceptiongroup==1.2.2 # via ipython -executing==2.0.1 +executing==2.1.0 # via stack-data fastjsonschema==2.20.0 # via nbformat @@ -52,16 +54,16 @@ ipydatawidgets==4.3.5 # via pythreejs ipykernel==6.29.5 # via -r docs.in -ipython==8.26.0 +ipython==8.29.0 # via # -r docs.in # ipykernel # ipywidgets -ipywidgets==8.1.3 +ipywidgets==8.1.5 # via # ipydatawidgets # pythreejs -jedi==0.19.1 +jedi==0.19.2 # via ipython jinja2==3.1.4 # via @@ -71,9 +73,9 @@ jinja2==3.1.4 # sphinx jsonschema==4.23.0 # via nbformat -jsonschema-specifications==2023.12.1 +jsonschema-specifications==2024.10.1 # via jsonschema -jupyter-client==8.6.2 +jupyter-client==8.6.3 # via # ipykernel # nbclient @@ -86,13 +88,13 @@ jupyter-core==5.7.2 # nbformat jupyterlab-pygments==0.3.0 # via nbconvert -jupyterlab-widgets==3.0.11 +jupyterlab-widgets==3.0.13 # via ipywidgets markdown-it-py==3.0.0 # via # mdit-py-plugins # myst-parser -markupsafe==2.1.5 +markupsafe==3.0.2 # via # jinja2 # nbconvert @@ -100,7 +102,7 @@ matplotlib-inline==0.1.7 # via # ipykernel # ipython -mdit-py-plugins==0.4.1 +mdit-py-plugins==0.4.2 # via myst-parser mdurl==0.1.2 # via markdown-it-py @@ -108,7 +110,7 @@ mistune==3.0.2 # via nbconvert mpltoolbox==24.5.1 # via scippneutron -myst-parser==3.0.1 +myst-parser==4.0.0 # via -r docs.in nbclient==0.10.0 # via nbconvert @@ -119,7 +121,7 @@ nbformat==5.10.4 # nbclient # nbconvert # nbsphinx -nbsphinx==0.9.4 +nbsphinx==0.9.5 # via -r docs.in nest-asyncio==1.6.0 # via ipykernel @@ -129,15 +131,15 @@ parso==0.8.4 # via jedi pexpect==4.9.0 # via ipython -prompt-toolkit==3.0.47 +prompt-toolkit==3.0.48 # via ipython -psutil==6.0.0 +psutil==6.1.0 # via ipykernel ptyprocess==0.7.0 # via pexpect pure-eval==0.2.3 # via stack-data -pydata-sphinx-theme==0.15.4 +pydata-sphinx-theme==0.16.0 # via -r docs.in pygments==2.18.0 # via @@ -148,7 +150,7 @@ pygments==2.18.0 # sphinx pythreejs==2.4.2 # via -r docs.in -pyzmq==26.0.3 +pyzmq==26.2.0 # via # ipykernel # jupyter-client @@ -156,17 +158,17 @@ referencing==0.35.1 # via # jsonschema # jsonschema-specifications -rpds-py==0.19.0 +rpds-py==0.21.0 # via # jsonschema # referencing -scippneutron==24.7.0 +scippneutron==24.11.0 # via -r docs.in snowballstemmer==2.2.0 # via sphinx -soupsieve==2.5 +soupsieve==2.6 # via beautifulsoup4 -sphinx==7.4.7 +sphinx==8.1.3 # via # -r docs.in # myst-parser @@ -175,31 +177,31 @@ sphinx==7.4.7 # sphinx-autodoc-typehints # sphinx-copybutton # sphinx-design -sphinx-autodoc-typehints==2.2.3 +sphinx-autodoc-typehints==2.5.0 # via -r docs.in sphinx-copybutton==0.5.2 # via -r docs.in -sphinx-design==0.6.0 +sphinx-design==0.6.1 # via -r docs.in -sphinxcontrib-applehelp==1.0.8 +sphinxcontrib-applehelp==2.0.0 # via sphinx -sphinxcontrib-devhelp==1.0.6 +sphinxcontrib-devhelp==2.0.0 # via sphinx -sphinxcontrib-htmlhelp==2.0.6 +sphinxcontrib-htmlhelp==2.1.0 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.8 +sphinxcontrib-qthelp==2.0.0 # via sphinx -sphinxcontrib-serializinghtml==1.1.10 +sphinxcontrib-serializinghtml==2.0.0 # via sphinx stack-data==0.6.3 # via ipython -tinycss2==1.3.0 +tinycss2==1.4.0 # via nbconvert -tomli==2.0.1 +tomli==2.1.0 # via sphinx -tornado==6.4.1 +tornado==6.4.2 # via # ipykernel # jupyter-client @@ -230,5 +232,5 @@ webencodings==0.5.1 # via # bleach # tinycss2 -widgetsnbextension==4.0.11 +widgetsnbextension==4.0.13 # via ipywidgets diff --git a/requirements/make_base.py b/requirements/make_base.py index 493ede1..01cd458 100644 --- a/requirements/make_base.py +++ b/requirements/make_base.py @@ -42,8 +42,14 @@ def write_dependencies(dependency_name: str, dependencies: list[str]) -> None: if dependencies is None: raise RuntimeError("No dependencies found in pyproject.toml") dependencies = [dep.strip().strip('"') for dep in dependencies] + test_dependencies = ( + pyproject["project"].get("optional-dependencies", {}).get("test", []) + ) + test_dependencies = [dep.strip().strip('"') for dep in test_dependencies] + write_dependencies("base", dependencies) +write_dependencies("basetest", test_dependencies) def as_nightly(repo: str) -> str: @@ -61,7 +67,9 @@ def as_nightly(repo: str) -> str: nightly = tuple(args.nightly.split(",") if args.nightly else []) -nightly_dependencies = [dep for dep in dependencies if not dep.startswith(nightly)] +nightly_dependencies = [ + dep for dep in dependencies + test_dependencies if not dep.startswith(nightly) +] nightly_dependencies += [as_nightly(arg) for arg in nightly] write_dependencies("nightly", nightly_dependencies) diff --git a/requirements/mypy.txt b/requirements/mypy.txt index b9863cd..6ffc9ba 100644 --- a/requirements/mypy.txt +++ b/requirements/mypy.txt @@ -6,7 +6,7 @@ # pip-compile-multi # -r test.txt -mypy==1.11.0 +mypy==1.13.0 # via -r mypy.in mypy-extensions==1.0.0 # via mypy diff --git a/requirements/nightly.in b/requirements/nightly.in index 6f38c4b..bca1127 100644 --- a/requirements/nightly.in +++ b/requirements/nightly.in @@ -1,4 +1,4 @@ --r basetest.in + # --- END OF CUSTOM SECTION --- # The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! dask @@ -7,6 +7,7 @@ pooch pandas gemmi defusedxml +pytest scipp @ https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl sciline @ git+https://github.com/scipp/sciline@main scippnexus @ git+https://github.com/scipp/scippnexus@main diff --git a/requirements/nightly.txt b/requirements/nightly.txt index ad24d9a..daf1fd6 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -1,52 +1,55 @@ -# SHA1:ddc214997f19196de8428e2c570655767569ae87 +# SHA1:5567d188ad845d7f7faf225ea3ed89fbc989745b # # This file is autogenerated by pip-compile-multi # To update, run: # # pip-compile-multi # --r basetest.txt -certifi==2024.7.4 +certifi==2024.8.30 # via requests -charset-normalizer==3.3.2 +charset-normalizer==3.4.0 # via requests click==8.1.7 # via dask -cloudpickle==3.0.0 +cloudpickle==3.1.0 # via dask -contourpy==1.2.1 +contourpy==1.3.1 # via matplotlib -cyclebane==24.6.0 +cyclebane==24.10.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2024.7.1 +dask==2024.11.2 # via -r nightly.in defusedxml==0.7.1 # via -r nightly.in -fonttools==4.53.1 +exceptiongroup==1.2.2 + # via pytest +fonttools==4.55.0 # via matplotlib -fsspec==2024.6.1 +fsspec==2024.10.0 # via dask -gemmi==0.6.6 +gemmi==0.6.7 # via -r nightly.in graphviz==0.20.3 # via -r nightly.in -h5py==3.11.0 +h5py==3.12.1 # via scippnexus -idna==3.7 +idna==3.10 # via requests -importlib-metadata==8.0.0 +importlib-metadata==8.5.0 # via dask -kiwisolver==1.4.5 +iniconfig==2.0.0 + # via pytest +kiwisolver==1.4.7 # via matplotlib locket==1.0.0 # via partd -matplotlib==3.9.1 +matplotlib==3.9.2 # via plopp -networkx==3.3 +networkx==3.4.2 # via cyclebane -numpy==2.0.1 +numpy==2.1.3 # via # contourpy # h5py @@ -54,28 +57,38 @@ numpy==2.0.1 # pandas # scipp # scipy -pandas==2.2.2 +packaging==24.2 + # via + # dask + # matplotlib + # pooch + # pytest +pandas==2.2.3 # via -r nightly.in partd==1.4.2 # via dask -pillow==10.4.0 +pillow==11.0.0 # via matplotlib -platformdirs==4.2.2 +platformdirs==4.3.6 # via pooch plopp @ git+https://github.com/scipp/plopp@main # via -r nightly.in +pluggy==1.5.0 + # via pytest pooch==1.8.2 # via -r nightly.in -pyparsing==3.1.2 +pyparsing==3.2.0 # via matplotlib +pytest==8.3.3 + # via -r nightly.in python-dateutil==2.9.0.post0 # via # matplotlib # pandas # scippnexus -pytz==2024.1 +pytz==2024.2 # via pandas -pyyaml==6.0.1 +pyyaml==6.0.2 # via dask requests==2.32.3 # via pooch @@ -87,17 +100,19 @@ scipp @ https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly-c # scippnexus scippnexus @ git+https://github.com/scipp/scippnexus@main # via -r nightly.in -scipy==1.14.0 +scipy==1.14.1 # via scippnexus six==1.16.0 # via python-dateutil -toolz==0.12.1 +tomli==2.1.0 + # via pytest +toolz==1.0.0 # via # dask # partd -tzdata==2024.1 +tzdata==2024.2 # via pandas -urllib3==2.2.2 +urllib3==2.2.3 # via requests -zipp==3.19.2 +zipp==3.21.0 # via importlib-metadata diff --git a/requirements/static.txt b/requirements/static.txt index e106d60..e107d91 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -7,19 +7,19 @@ # cfgv==3.4.0 # via pre-commit -distlib==0.3.8 +distlib==0.3.9 # via virtualenv -filelock==3.15.4 +filelock==3.16.1 # via virtualenv -identify==2.6.0 +identify==2.6.2 # via pre-commit nodeenv==1.9.1 # via pre-commit -platformdirs==4.2.2 +platformdirs==4.3.6 # via virtualenv -pre-commit==3.7.1 +pre-commit==4.0.1 # via -r static.in -pyyaml==6.0.1 +pyyaml==6.0.2 # via pre-commit -virtualenv==20.26.3 +virtualenv==20.27.1 # via pre-commit diff --git a/requirements/wheels.txt b/requirements/wheels.txt index a1fa46e..6a1c060 100644 --- a/requirements/wheels.txt +++ b/requirements/wheels.txt @@ -5,11 +5,11 @@ # # pip-compile-multi # -build==1.2.1 +build==1.2.2.post1 # via -r wheels.in -packaging==24.1 +packaging==24.2 # via build -pyproject-hooks==1.1.0 +pyproject-hooks==1.2.0 # via build -tomli==2.0.1 +tomli==2.1.0 # via build diff --git a/src/ess/nmx/__init__.py b/src/ess/nmx/__init__.py index d481b0a..76f6c76 100644 --- a/src/ess/nmx/__init__.py +++ b/src/ess/nmx/__init__.py @@ -5,7 +5,7 @@ import importlib.metadata try: - __version__ = importlib.metadata.version(__package__ or __name__) + __version__ = importlib.metadata.version("essnmx") except importlib.metadata.PackageNotFoundError: __version__ = "0.0.0" diff --git a/src/ess/nmx/scaling.py b/src/ess/nmx/scaling.py index 5d135b6..837ebcb 100644 --- a/src/ess/nmx/scaling.py +++ b/src/ess/nmx/scaling.py @@ -139,7 +139,7 @@ def estimate_scale_factor_per_hkl_asu_from_reference( ) -> EstimatedScaleFactor: """Calculate the estimated scale factor per ``hkl_asu``. - The estimated scale factor is calculatd as the average + The estimated scale factor is calculated as the average of the inverse of the non-empty reference intensities. It is part of the calculation of estimated scaled intensities diff --git a/tests/conftest.py b/tests/conftest.py index cebcd9e..33d8e05 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,6 +8,6 @@ import pytest -@pytest.fixture() +@pytest.fixture def mcstas_2_deprecation_warning_context() -> partial[AbstractContextManager]: return partial(pytest.warns, DeprecationWarning, match="McStas") diff --git a/tests/exporter_test.py b/tests/exporter_test.py index aab78aa..80b8f49 100644 --- a/tests/exporter_test.py +++ b/tests/exporter_test.py @@ -5,11 +5,12 @@ import numpy as np import pytest import scipp as sc + from ess.nmx.nexus import export_as_nexus from ess.nmx.reduction import NMXReducedData -@pytest.fixture() +@pytest.fixture def reduced_data() -> NMXReducedData: rng = np.random.default_rng(42) id_list = sc.array(dims=['event'], values=rng.integers(0, 12, size=100)) diff --git a/tests/loader_test.py b/tests/loader_test.py index 1e8cca9..d3dadc4 100644 --- a/tests/loader_test.py +++ b/tests/loader_test.py @@ -8,6 +8,8 @@ import sciline as sl import scipp as sc import scippnexus as snx +from scipp.testing import assert_allclose, assert_identical + from ess.nmx import default_parameters from ess.nmx.data import small_mcstas_2_sample, small_mcstas_3_sample from ess.nmx.mcstas.load import bank_names_to_detector_names, load_crystal_rotation @@ -19,7 +21,6 @@ FilePath, MaximumProbability, ) -from scipp.testing import assert_allclose, assert_identical sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent)) from mcstas_description_examples import ( @@ -192,7 +193,7 @@ def test_file_reader_mcstas_additional_fields(tmp_mcstas_file: pathlib.Path) -> assert isinstance(dg, sc.DataGroup) -@pytest.fixture() +@pytest.fixture def rotation_mission_tmp_file(tmp_mcstas_file: pathlib.Path) -> pathlib.Path: import h5py diff --git a/tests/mtz_io_test.py b/tests/mtz_io_test.py index 4887d02..3398135 100644 --- a/tests/mtz_io_test.py +++ b/tests/mtz_io_test.py @@ -5,6 +5,7 @@ import gemmi import pytest import scipp as sc + from ess.nmx import mtz_io from ess.nmx.data import get_small_mtz_samples from ess.nmx.mtz_io import ( @@ -34,7 +35,7 @@ def test_gemmi_mtz(file_path: pathlib.Path) -> None: assert len(mtz.columns[0]) == 100 # Number of samples, hard-coded value -@pytest.fixture() +@pytest.fixture def gemmi_mtz_object(file_path: pathlib.Path) -> gemmi.Mtz: return read_mtz_file(MTZFilePath(file_path)) @@ -64,7 +65,7 @@ def test_mtz_to_process_pandas_dataframe(gemmi_mtz_object: gemmi.Mtz) -> None: assert "hkl_asu" not in df.columns # It should be done on merged dataframes -@pytest.fixture() +@pytest.fixture def mtz_list() -> list[gemmi.Mtz]: return [ read_mtz_file(MTZFilePath(file_path)) for file_path in get_small_mtz_samples() @@ -78,7 +79,7 @@ def test_get_space_group_with_spacegroup_desc() -> None: ) -@pytest.fixture() +@pytest.fixture def conflicting_mtz_series( mtz_list: list[gemmi.Mtz], ) -> list[gemmi.Mtz]: @@ -103,14 +104,14 @@ def test_get_unique_space_group_raises_on_conflict( mtz_io.get_unique_space_group(*space_groups) -@pytest.fixture() +@pytest.fixture def merged_mtz_dataframe(mtz_list: list[gemmi.Mtz]) -> MtzDataFrame: """Tests if the merged data frame has the expected columns.""" reduced_mtz = [process_single_mtz_to_dataframe(mtz) for mtz in mtz_list] return mtz_io.merge_mtz_dataframes(*reduced_mtz) -@pytest.fixture() +@pytest.fixture def nmx_data_frame( mtz_list: list[gemmi.Mtz], merged_mtz_dataframe: MtzDataFrame, @@ -134,7 +135,7 @@ def test_process_merged_mtz_dataframe( assert "hkl_asu" in nmx_data_frame.columns -@pytest.fixture() +@pytest.fixture def nmx_data_array(nmx_data_frame: NMXMtzDataFrame) -> NMXMtzDataArray: return nmx_mtz_dataframe_to_scipp_dataarray(nmx_data_frame) diff --git a/tests/package_test.py b/tests/package_test.py index 5e6fc24..0bf3d35 100644 --- a/tests/package_test.py +++ b/tests/package_test.py @@ -1,7 +1,20 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2024 Scipp contributors (https://github.com/scipp) + +"""Tests of package integrity. + +Note that additional imports need to be added for repositories that +contain multiple packages. +""" + from ess import nmx as pkg def test_has_version(): assert hasattr(pkg, '__version__') + + +# This is for CI package tests. They need to run tests with minimal dependencies, +# that is, without installing pytest. This code does not affect pytest. +if __name__ == '__main__': + test_has_version() diff --git a/tests/scaling_test.py b/tests/scaling_test.py index 0c5fa34..219603b 100644 --- a/tests/scaling_test.py +++ b/tests/scaling_test.py @@ -2,6 +2,7 @@ # Copyright (c) 2024 Scipp contributors (https://github.com/scipp) import pytest import scipp as sc + from ess.nmx.scaling import ( ReferenceIntensities, estimate_scale_factor_per_hkl_asu_from_reference, @@ -10,7 +11,7 @@ ) -@pytest.fixture() +@pytest.fixture def nmx_data_array() -> sc.DataArray: da = sc.DataArray( data=sc.array(dims=["row"], values=[1, 2, 3, 4, 5, 3.1, 3.2]), @@ -52,7 +53,7 @@ def test_get_reference_bin_middle(nmx_data_array: sc.DataArray) -> None: ) -@pytest.fixture() +@pytest.fixture def reference_bin(nmx_data_array: sc.DataArray) -> ReferenceIntensities: binned = nmx_data_array.bin({"wavelength": 6}) reference_wavelength = get_reference_wavelength(binned, reference_wavelength=None) diff --git a/tests/workflow_test.py b/tests/workflow_test.py index 6f38c04..cf8e14d 100644 --- a/tests/workflow_test.py +++ b/tests/workflow_test.py @@ -4,6 +4,7 @@ import pytest import sciline as sl import scipp as sc + from ess.nmx import default_parameters from ess.nmx.data import small_mcstas_2_sample, small_mcstas_3_sample from ess.nmx.mcstas.load import providers as load_providers @@ -22,7 +23,7 @@ def mcstas_file_path( return request.param() -@pytest.fixture() +@pytest.fixture def mcstas_workflow(mcstas_file_path: str) -> sl.Pipeline: return sl.Pipeline( [*load_providers, bin_time_of_arrival], @@ -34,7 +35,7 @@ def mcstas_workflow(mcstas_file_path: str) -> sl.Pipeline: ) -@pytest.fixture() +@pytest.fixture def multi_bank_mcstas_workflow(mcstas_workflow: sl.Pipeline) -> sl.Pipeline: pl = mcstas_workflow.copy() pl[NMXReducedData] = (