diff --git a/.copier-answers.yml b/.copier-answers.yml index 92bb25b..d5b69b7 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,8 +1,8 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: a052529 +_commit: '2247096' _src_path: gh:scipp/copier_template description: Validate and check NeXus files -max_python: '3.12' +max_python: '3.13' min_python: '3.10' namespace_package: '' nightly_deps: scipp @@ -10,4 +10,4 @@ orgname: scipp prettyname: Chexus projectname: chexus related_projects: ScippNexus -year: 2024 +year: 2025 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 356700a..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.3 + - 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 c6a413e..47294b9 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,18 +58,20 @@ 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 == '' }} - run: tox -e linkcheck if: ${{ inputs.linkcheck }} - uses: actions/upload-artifact@v4 + id: artifact-upload-step with: name: docs_html path: html/ + - run: echo "::notice::https://remote-unzip.deno.dev/${{ github.repository }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}" - - uses: JamesIves/github-pages-deploy-action@v4.6.4 + - uses: JamesIves/github-pages-deploy-action@v4.7.3 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..f88b344 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,19 +61,19 @@ 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 if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 - - uses: pypa/gh-action-pypi-publish@v1.8.14 + - uses: pypa/gh-action-pypi-publish@v1.12.4 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 e98ed7c..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 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/.github/workflows/weekly_windows_macos.yml b/.github/workflows/weekly_windows_macos.yml new file mode 100644 index 0000000..1544d7f --- /dev/null +++ b/.github/workflows/weekly_windows_macos.yml @@ -0,0 +1,42 @@ +name: Windows and MacOS weekly tests + +on: + workflow_dispatch: + schedule: + - cron: '0 2 * * 1' + +jobs: + pytox: + name: Python and Tox env + runs-on: 'ubuntu-24.04' + outputs: + min_python: ${{ steps.vars.outputs.min_python }} + min_tox_env: ${{ steps.vars.outputs.min_tox_env }} + 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 + echo "min_tox_env=py$(cat .github/workflows/python-version-ci | sed 's/\.//g')" >> $GITHUB_OUTPUT + tests: + name: Tests + needs: pytox + strategy: + matrix: + os: ['macos-latest', 'windows-latest'] + python: + - version: '${{needs.pytox.outputs.min_python}}' + tox-env: '${{needs.pytox.outputs.min_tox_env}}' + uses: ./.github/workflows/test.yml + with: + os-variant: ${{ matrix.os }} + python-version: ${{ matrix.python.version }} + tox-env: ${{ matrix.python.tox-env }} + + docs: + needs: tests + uses: ./.github/workflows/docs.yml + with: + publish: false + branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }} diff --git a/.gitignore b/.gitignore index cc2a0f8..720318b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,8 @@ dist html .tox *.egg-info -uv.lock # we lock dependencies with pip-compile, not uv +# we lock dependencies with pip-compile, not uv +uv.lock *.sw? @@ -13,6 +14,7 @@ venv .venv # Caches +*.DS_Store .clangd/ *.ipynb_checkpoints __pycache__/ @@ -42,3 +44,5 @@ docs/generated/ *.rcif *.ort *.zip +*.sqw +*.nxspe diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0c499e..0f3f9a9 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.6.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 @@ -21,7 +23,7 @@ repos: 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.6.2 + rev: v0.8.0 hooks: - id: ruff args: [ --fix ] @@ -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/LICENSE b/LICENSE index 54b3cf4..7d62083 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2024, Scipp contributors (https://github.com/scipp) +Copyright (c) 2025, Scipp contributors (https://github.com/scipp) All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/docs/conf.py b/docs/conf.py index 1da2848..92c07db 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) +# Copyright (c) 2025 Scipp contributors (https://github.com/scipp) import doctest import os @@ -15,7 +15,7 @@ # General information about the project. project = 'Chexus' -copyright = '2024 Scipp contributors' +copyright = '2025 Scipp contributors' author = 'Scipp contributors' html_show_sourcelink = True @@ -261,4 +261,7 @@ def do_not_plot(*args, **kwargs): linkcheck_ignore = [ # Specific lines in Github blobs cannot be found by linkcheck. r'https?://github\.com/.*?/blob/[a-f0-9]+/.+?#', + # Linkcheck seems to be denied access by some DOI resolvers. + # Since DOIs are supposed to be permanent, we don't need to check them.' + r'https://doi\.org/', ] diff --git a/docs/index.md b/docs/index.md index 453021e..ac0be5f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,6 @@ :width: 60% :align: center ::: - :::{image} _static/logo-dark.svg :class: only-dark :alt: Chexus @@ -12,14 +11,26 @@ :align: center ::: -# +```{raw} html + +``` + +```{role} transparent +``` + +# {transparent}`Chexus` -
- Validate and check NeXus files -

+
+ Validate and check NeXus files +

-## Install +## Installation + +To install Chexus and all of its dependencies, use `````{tab-set} ````{tab-item} pip @@ -50,6 +61,11 @@ There is also a Python API, but this is under construction and unstable. - `--exit-on-fail`: Return a non-zero exit code if validation fails. - `-r`, `--root-path`: Path to the top-level group to validate. Default is `''`. +## Get in touch + +- If you have questions that are not answered by these documentation pages, ask on [discussions](https://github.com/scipp/chexus/discussions). Please include a self-contained reproducible example if possible. +- Report bugs (including unclear, missing, or wrong documentation!), suggest features or view the source code [on GitHub](https://github.com/scipp/chexus). + ```{toctree} --- hidden: diff --git a/pyproject.toml b/pyproject.toml index 99fcd08..7c344bc 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", ] @@ -80,13 +81,12 @@ 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 = ["B010", "I001", "PT001"] +fixable = ["B010", "I001", "PT001", "RUF022"] isort.known-first-party = ["chexus"] pydocstyle.convention = "numpy" [tool.ruff.lint.per-file-ignores] # those files have an increased risk of relying on import order -"__init__.py" = ["I"] "tests/*" = [ "S101", # asserts are fine in tests "B018", # 'useless expressions' are ok because some tests just check for exceptions diff --git a/requirements/make_base.py b/requirements/make_base.py index ccbab00..2cda547 100644 --- a/requirements/make_base.py +++ b/requirements/make_base.py @@ -1,4 +1,3 @@ -import sys from argparse import ArgumentParser from pathlib import Path @@ -58,16 +57,22 @@ def as_nightly(repo: str) -> str: else: org = "scipp" if repo == "scipp": - version = f"cp{sys.version_info.major}{sys.version_info.minor}" - base = "https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly" - suffix = "manylinux_2_17_x86_64.manylinux2014_x86_64.whl" - prefix = "scipp @ " - return prefix + "-".join([base, version, version, suffix]) + # With the standard pip resolver index-url takes precedence over + # extra-index-url but with uv it's reversed, so if we move to tox-uv + # this needs to be reversed. + return ( + "scipp\n" + "--index-url=https://pypi.anaconda.org/scipp-nightly-wheels/simple/\n" + "--extra-index-url=https://pypi.org/simple\n" + "--pre" + ) return f"{repo} @ git+https://github.com/{org}/{repo}@main" 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/nightly.in b/requirements/nightly.in index e06d2a9..0536b92 100644 --- a/requirements/nightly.in +++ b/requirements/nightly.in @@ -1,4 +1,3 @@ --r basetest.in # --- END OF CUSTOM SECTION --- # The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! h5py diff --git a/src/chexus/__init__.py b/src/chexus/__init__.py index 38fd077..c3840a4 100644 --- a/src/chexus/__init__.py +++ b/src/chexus/__init__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) -# ruff: noqa: E402, F401 +# Copyright (c) 2025 Scipp contributors (https://github.com/scipp) +# ruff: noqa: E402, F401, I import importlib.metadata diff --git a/tests/package_test.py b/tests/package_test.py index 0ba42e4..6931e49 100644 --- a/tests/package_test.py +++ b/tests/package_test.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) +# Copyright (c) 2025 Scipp contributors (https://github.com/scipp) """Tests of package integrity. diff --git a/tox.ini b/tox.ini index 19022c6..2aef2be 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,9 @@ commands = pytest {posargs} [testenv:nightly] deps = -r requirements/nightly.txt +setenv = + PIP_INDEX_URL = https://pypi.anaconda.org/scipp-nightly-wheels/simple + PIP_EXTRA_INDEX_URL = https://pypi.org/simple commands = pytest {posargs} [testenv:unpinned] @@ -61,7 +64,9 @@ description = Update dependencies by running pip-compile-multi deps = pip-compile-multi tomli + # Avoid https://github.com/jazzband/pip-tools/issues/2131 + pip==24.2 skip_install = true changedir = requirements commands = python ./make_base.py --nightly scipp - pip-compile-multi -d . --backtracking + pip-compile-multi -d . --backtracking --annotate-index