From ee72cf1bd86901fcc19e798221b91019022b491a Mon Sep 17 00:00:00 2001 From: Simon Heybrock Date: Thu, 7 Dec 2023 09:13:34 +0100 Subject: [PATCH 1/4] copier update --- .copier-answers.yml | 5 +- .github/workflows/ci.yml | 5 +- .github/workflows/docs.yml | 10 ++- .github/workflows/nightly_at_main.yml | 4 +- .github/workflows/nightly_at_release.yml | 4 +- .github/workflows/python-version-ci | 2 +- .github/workflows/release.yml | 10 +-- .github/workflows/test.yml | 4 +- .github/workflows/unpinned.yml | 4 +- .gitignore | 27 +++++- .pre-commit-config.yaml | 16 ++-- CONTRIBUTING.md | 8 +- conda/meta.yaml | 4 +- docs/_static/anaconda-icon.js | 13 +++ docs/_static/anaconda-logo.svg | 103 ----------------------- docs/_static/css/custom.css | 21 ----- docs/_templates/doc_version.html | 2 +- docs/about/index.md | 4 +- docs/api-reference/index.md | 2 +- docs/conf.py | 40 +++++++-- docs/developer/getting-started.md | 2 +- pyproject.toml | 11 ++- requirements/base.in | 12 +-- requirements/basetest.in | 4 + requirements/dev.in | 1 + requirements/docs.in | 5 +- requirements/make_base.py | 42 ++++++--- requirements/nightly.in | 8 +- requirements/test.in | 4 +- tox.ini | 8 +- 30 files changed, 178 insertions(+), 207 deletions(-) create mode 100644 docs/_static/anaconda-icon.js delete mode 100644 docs/_static/anaconda-logo.svg delete mode 100644 docs/_static/css/custom.css create mode 100644 requirements/basetest.in diff --git a/.copier-answers.yml b/.copier-answers.yml index 3b52651e..17eab54e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,12 +1,13 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 13cf3e6 +_commit: ec09f73 _src_path: gh:scipp/copier_template description: An h5py-like utility for NeXus files with seamless Scipp integration max_python: '3.12' -min_python: '3.8' +min_python: '3.9' namespace_package: '' nightly_deps: scipp orgname: scipp +prettyname: ScippNexus projectname: scippnexus related_projects: Scipp,ScippNeutron year: 2023 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d294d17..20c647dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ on: jobs: formatting: name: Formatting and static analysis - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} min_tox_env: ${{ steps.vars.outputs.min_tox_env }} @@ -39,7 +39,7 @@ jobs: needs: formatting strategy: matrix: - os: ['ubuntu-20.04'] + os: ['ubuntu-22.04'] python: - version: '${{needs.formatting.outputs.min_python}}' tox-env: '${{needs.formatting.outputs.min_tox_env}}' @@ -54,4 +54,5 @@ jobs: uses: ./.github/workflows/docs.yml with: publish: false + linkcheck: ${{ contains(matrix.variant.os, 'ubuntu') && github.ref == 'refs/heads/main' }} branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9dd22f19..5e189fb0 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -32,6 +32,11 @@ on: default: '' required: false type: string + linkcheck: + description: 'Run the link checker. If not set the link checker will not be run.' + default: false + required: false + type: boolean env: VERSION: ${{ inputs.version }} @@ -39,7 +44,7 @@ env: jobs: docs: name: Build documentation - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' steps: - run: sudo apt install --yes graphviz pandoc - uses: actions/checkout@v3 @@ -55,6 +60,8 @@ jobs: if: ${{ inputs.version != '' }} - run: tox -e docs if: ${{ inputs.version == '' }} + - run: tox -e linkcheck + if: ${{ inputs.linkcheck }} - uses: actions/upload-artifact@v3 with: name: docs_html @@ -66,4 +73,3 @@ jobs: branch: gh-pages folder: html single-commit: true - ssh-key: ${{ secrets.GH_PAGES_DEPLOY_KEY }} diff --git a/.github/workflows/nightly_at_main.yml b/.github/workflows/nightly_at_main.yml index f83c0c36..10730688 100644 --- a/.github/workflows/nightly_at_main.yml +++ b/.github/workflows/nightly_at_main.yml @@ -11,7 +11,7 @@ on: jobs: setup: name: Setup variables - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} steps: @@ -25,7 +25,7 @@ jobs: needs: setup strategy: matrix: - os: ['ubuntu-20.04'] + os: ['ubuntu-22.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 f9d811a0..7f1653bb 100644 --- a/.github/workflows/nightly_at_release.yml +++ b/.github/workflows/nightly_at_release.yml @@ -11,7 +11,7 @@ on: jobs: setup: name: Setup variables - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} release_tag: ${{ steps.release.outputs.release_tag }} @@ -31,7 +31,7 @@ jobs: needs: setup strategy: matrix: - os: ['ubuntu-20.04'] + os: ['ubuntu-22.04'] python: - version: '${{needs.setup.outputs.min_python}}' tox-env: 'nightly' diff --git a/.github/workflows/python-version-ci b/.github/workflows/python-version-ci index cc1923a4..bd28b9c5 100644 --- a/.github/workflows/python-version-ci +++ b/.github/workflows/python-version-ci @@ -1 +1 @@ -3.8 +3.9 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 223dd5af..e492978a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ defaults: jobs: build_conda: name: Conda build - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' steps: - uses: actions/checkout@v3 @@ -38,7 +38,7 @@ jobs: build_wheels: name: Wheels - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' steps: - uses: actions/checkout@v3 @@ -64,7 +64,7 @@ jobs: upload_pypi: name: Deploy PyPI needs: [build_wheels, build_conda] - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' environment: release permissions: id-token: write @@ -76,7 +76,7 @@ jobs: upload_conda: name: Deploy Conda needs: [build_wheels, build_conda] - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' if: github.event_name == 'release' && github.event.action == 'published' steps: @@ -100,7 +100,7 @@ jobs: assets: name: Upload docs needs: docs - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.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 8ce71be0..3cfb75de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: os-variant: - default: 'ubuntu-20.04' + default: 'ubuntu-22.04' type: string python-version: type: string @@ -26,7 +26,7 @@ on: workflow_call: inputs: os-variant: - default: 'ubuntu-20.04' + default: 'ubuntu-22.04' type: string python-version: type: string diff --git a/.github/workflows/unpinned.yml b/.github/workflows/unpinned.yml index dbb546f4..853c1ec5 100644 --- a/.github/workflows/unpinned.yml +++ b/.github/workflows/unpinned.yml @@ -11,7 +11,7 @@ on: jobs: setup: name: Setup variables - runs-on: 'ubuntu-20.04' + runs-on: 'ubuntu-22.04' outputs: min_python: ${{ steps.vars.outputs.min_python }} release_tag: ${{ steps.release.outputs.release_tag }} @@ -31,7 +31,7 @@ jobs: needs: setup strategy: matrix: - os: ['ubuntu-20.04'] + os: ['ubuntu-22.04'] python: - version: '${{needs.setup.outputs.min_python}}' tox-env: 'unpinned' diff --git a/.gitignore b/.gitignore index 9bd926bc..e8b1ec78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,17 @@ +# Build artifacts +build dist html .tox -src/scippnexus.egg-info +*.egg-info *.sw? +# Environments +venv + +# Caches .clangd/ -.idea/ -.vscode/ *.ipynb_checkpoints __pycache__/ .vs/ @@ -16,3 +20,20 @@ __pycache__/ .pytest_cache .mypy_cache docs/generated/ + +# Editor settings +.idea/ +.vscode/ + +# Data files +*.data +*.dat +*.csv +*.xye +*.h5 +*.hdf5 +*.hdf +*.nxs +*.raw +*.cif +*.rcif diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8b47569..19830db7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,11 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.5.0 hooks: - id: check-added-large-files - id: check-json exclude: asv.conf.json + - id: check-merge-conflict - id: check-toml - id: check-yaml exclude: conda/meta.yaml @@ -18,7 +19,7 @@ repos: - id: isort name: isort (python) - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.9.0 + rev: 23.11.0 hooks: - id: black - repo: https://github.com/kynan/nbstripout @@ -29,28 +30,27 @@ repos: args: [ "--drop-empty-cells", "--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ] - repo: https://github.com/pycqa/flake8 - rev: 4.0.1 + rev: 6.1.0 hooks: - id: flake8 types: ["python"] - additional_dependencies: ["flake8-bugbear==22.10.27"] + additional_dependencies: ["flake8-bugbear==23.9.16"] - repo: https://github.com/pycqa/bandit - rev: 1.7.4 + rev: 1.7.5 hooks: - id: bandit additional_dependencies: ["bandit[toml]"] args: ["-c", "pyproject.toml"] - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell additional_dependencies: - tomli - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-no-eval - exclude: "object_list.py" - id: python-no-log-warn - id: python-use-type-annotations - id: rst-backticks diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6f184cc..947b0e76 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,18 +1,18 @@ -## Contributing to Scippnexus +## Contributing to ScippNexus -Welcome to the developer side of Scippnexus! +Welcome to the developer side of ScippNexus! Contributions are always welcome. This includes reporting bugs or other issues, submitting pull requests, requesting new features, etc. -If you need help with using Scippnexus or contributing to it, have a look at the GitHub [discussions](https://github.com/scipp/scippnexus/discussions) and start a new [Q&A discussion](https://github.com/scipp/scippnexus/discussions/categories/q-a) if you can't find what you are looking for. +If you need help with using ScippNexus or contributing to it, have a look at the GitHub [discussions](https://github.com/scipp/scippnexus/discussions) and start a new [Q&A discussion](https://github.com/scipp/scippnexus/discussions/categories/q-a) if you can't find what you are looking for. For bug reports and other problems, please open an [issue](https://github.com/scipp/scippnexus/issues/new) in GitHub. You are welcome to submit pull requests at any time. But to avoid having to make large modifications during review or even have your PR rejected, please first open an issue first to discuss your idea! -Check out the subsections of the [Developer documentation](https://scipp.github.io/scippnexus/developer/index.html) for details on how Scippnexus is developed. +Check out the subsections of the [Developer documentation](https://scipp.github.io/scippnexus/developer/index.html) for details on how ScippNexus is developed. ## Code of conduct diff --git a/conda/meta.yaml b/conda/meta.yaml index 34a28974..b04c16f1 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -11,7 +11,7 @@ requirements: - setuptools - setuptools_scm run: - - python>=3.8 + - python>=3.9 - python-dateutil - scipp>=23.07.0 - scipy @@ -31,7 +31,7 @@ test: build: noarch: python script: - - pip install . + - python -m pip install . about: home: https://github.com/scipp/scippnexus diff --git a/docs/_static/anaconda-icon.js b/docs/_static/anaconda-icon.js new file mode 100644 index 00000000..024350ec --- /dev/null +++ b/docs/_static/anaconda-icon.js @@ -0,0 +1,13 @@ +FontAwesome.library.add( + (faListOldStyle = { + prefix: "fa-custom", + iconName: "anaconda", + icon: [ + 67.65, // viewBox width + 67.500267, // viewBox height + [], // ligature + "e001", // unicode codepoint - private use area + "M 33.900391 0 C 32.600392 0 31.299608 0.09921885 30.099609 0.19921875 A 39.81 39.81 0 0 1 35.199219 4.3007812 L 36.5 5.5 L 35.199219 6.8007812 A 34.65 34.65 0 0 0 32 10.199219 L 32 10.300781 A 6.12 6.12 0 0 0 31.5 10.900391 A 19.27 19.27 0 0 1 33.900391 10.800781 A 23 23 0 0 1 33.900391 56.800781 A 22.39 22.39 0 0 1 21.900391 53.400391 A 45.33 45.33 0 0 1 16.699219 53.699219 A 19.27 19.27 0 0 1 14.300781 53.599609 A 78.24 78.24 0 0 0 15 61.699219 A 33.26 33.26 0 0 0 33.900391 67.5 A 33.75 33.75 0 0 0 33.900391 0 z M 23 1.8007812 A 33.78 33.78 0 0 0 15.599609 5.4003906 A 47 47 0 0 1 20.699219 6.5996094 A 52.38 52.38 0 0 1 23 1.8007812 z M 26.5 2 A 41.8 41.8 0 0 0 23.699219 7.5996094 C 25.199217 8.1996088 26.69922 8.8000007 28.199219 9.5 C 28.799218 8.7000008 29.300391 8.0999999 29.400391 8 C 30.10039 7.2000008 30.800001 6.399218 31.5 5.6992188 A 58.59 58.59 0 0 0 26.5 2 z M 13.199219 8.1992188 A 48.47 48.47 0 0 0 13.099609 14.800781 A 44.05 44.05 0 0 1 18.300781 14.5 A 39.43 39.43 0 0 1 19.699219 9.5996094 A 46.94 46.94 0 0 0 13.199219 8.1992188 z M 10.099609 9.8007812 A 33.47 33.47 0 0 0 4.9003906 16.5 C 6.6003889 16 8.3992205 15.599218 10.199219 15.199219 C 10.099219 13.399221 10.099609 11.600779 10.099609 9.8007812 z M 22.599609 10.599609 C 22.19961 11.799608 21.8 13.100392 21.5 14.400391 A 29.18 29.18 0 0 1 26.199219 12.099609 A 27.49 27.49 0 0 0 22.599609 10.599609 z M 17.699219 17.5 C 16.19922 17.5 14.80078 17.599219 13.300781 17.699219 A 33.92 33.92 0 0 0 14.099609 22.099609 A 20.36 20.36 0 0 1 17.699219 17.5 z M 10.599609 17.900391 A 43.62 43.62 0 0 0 3.3007812 19.900391 L 3.0996094 20 L 3.1992188 20.199219 A 30.3 30.3 0 0 0 6.5 27.300781 L 6.5996094 27.5 L 6.8007812 27.400391 A 50.41 50.41 0 0 1 11.699219 24.300781 L 11.900391 24.199219 L 11.900391 24 A 38.39 38.39 0 0 1 10.800781 18.099609 L 10.800781 17.900391 L 10.599609 17.900391 z M 1.8007812 22.800781 L 1.5996094 23.400391 A 33.77 33.77 0 0 0 0 32.900391 L 0 33.5 L 0.40039062 33.099609 A 24.93 24.93 0 0 1 4.8007812 28.900391 L 5 28.800781 L 4.9003906 28.599609 A 54.49 54.49 0 0 1 2 23.300781 L 1.8007812 22.800781 z M 12.300781 26.300781 L 11.800781 26.599609 C 10.500783 27.399609 9.2003893 28.19961 7.9003906 29.099609 L 7.6992188 29.199219 L 8 29.400391 C 8.8999991 30.600389 9.8007822 31.900001 10.800781 33 L 11.099609 33.5 L 11.099609 32.900391 A 23.54 23.54 0 0 1 12.099609 26.900391 L 12.300781 26.300781 z M 6.0996094 30.5 L 5.9003906 30.699219 A 47 47 0 0 0 0.80078125 35.599609 L 0.59960938 35.800781 L 0.80078125 36 A 58.38 58.38 0 0 0 6.4003906 40.199219 L 6.5996094 40.300781 L 6.6992188 40.099609 A 45.3 45.3 0 0 1 9.6992188 35.5 L 9.8007812 35.300781 L 9.6992188 35.199219 A 52 52 0 0 1 6.1992188 30.800781 L 6.0996094 30.5 z M 11.300781 36.400391 L 11 36.900391 C 10.100001 38.200389 9.2003898 39.600001 8.4003906 41 L 8.3007812 41.199219 L 8.5 41.300781 C 9.8999986 42.10078 11.400392 42.800001 12.900391 43.5 L 13.400391 43.699219 L 13.199219 43.199219 A 23.11 23.11 0 0 1 11.400391 37 L 11.300781 36.400391 z M 0.099609375 37.699219 L 0.19921875 38.300781 A 31.56 31.56 0 0 0 2.9003906 47.699219 L 3.0996094 48.199219 L 3.3007812 47.699219 A 55.47 55.47 0 0 1 5.6992188 42.099609 L 5.8007812 41.800781 L 5.5996094 41.699219 A 57.36 57.36 0 0 1 0.59960938 38.099609 L 0.099609375 37.699219 z M 7.4003906 42.800781 L 7.3007812 43 A 53.76 53.76 0 0 0 4.5 50 L 4.4003906 50.199219 L 4.5996094 50.300781 A 39.14 39.14 0 0 0 12.199219 51.699219 L 12.5 51.699219 L 12.5 51.5 A 36.79 36.79 0 0 1 13 45.699219 L 13 45.5 L 12.800781 45.400391 A 49.67 49.67 0 0 1 7.5996094 42.900391 L 7.4003906 42.800781 z M 14.5 45.900391 L 14.5 46.199219 A 45.53 45.53 0 0 0 14.099609 51.5 L 14.099609 51.699219 L 14.300781 51.699219 C 15.10078 51.699219 15.89922 51.800781 16.699219 51.800781 A 12.19 12.19 0 0 0 19.400391 51.800781 L 20 51.800781 L 19.5 51.400391 A 20.73 20.73 0 0 1 14.900391 46.199219 L 14.900391 46.099609 L 14.5 45.900391 z M 5.1992188 52.099609 L 5.5 52.599609 A 34.87 34.87 0 0 0 12.599609 60.400391 L 13 60.800781 L 13 60.099609 A 51.43 51.43 0 0 1 12.5 53.5 L 12.5 53.300781 L 12.300781 53.300781 A 51.94 51.94 0 0 1 5.8007812 52.199219 L 5.1992188 52.099609 z" + ], + }) +); diff --git a/docs/_static/anaconda-logo.svg b/docs/_static/anaconda-logo.svg deleted file mode 100644 index 67bd68d9..00000000 --- a/docs/_static/anaconda-logo.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css deleted file mode 100644 index d7fabbbb..00000000 --- a/docs/_static/css/custom.css +++ /dev/null @@ -1,21 +0,0 @@ -html[data-theme="light"] { - /* match pst-color-text-muted (used in header buttons) */ - --scipp-filter-header-icon: saturate(0) brightness(0.696); -} - -html[data-theme="dark"] { - /* match pst-color-text-muted (used in header buttons) */ - --scipp-filter-header-icon: saturate(0) brightness(1.161); -} - -/* This selects custom icon links in the header but not the builtin ones. - * Currently, this is only the anaconda logo and the filters are adjusted to it. - */ -.bd-header .navbar-nav li a.nav-link .icon-link-image { - filter: var(--scipp-filter-header-icon); -} - -.bd-header .navbar-nav li a.nav-link .icon-link-image:hover { - /* match primary color */ - filter: hue-rotate(85deg) saturate(0.829) brightness(0.945); -} diff --git a/docs/_templates/doc_version.html b/docs/_templates/doc_version.html index 7fd881ac..a348e28c 100644 --- a/docs/_templates/doc_version.html +++ b/docs/_templates/doc_version.html @@ -1,2 +1,2 @@ -Current {{ project }} version: {{ version }} (older versions). +Current {{ project }} version: {{ version }} (older versions). diff --git a/docs/about/index.md b/docs/about/index.md index 292cafdb..1a9a4cc6 100644 --- a/docs/about/index.md +++ b/docs/about/index.md @@ -1,4 +1,4 @@ -# About ScippNexus +# About ## Development @@ -14,7 +14,7 @@ Please cite the following: [![DOI](https://zenodo.org/badge/475453428.svg)](https://zenodo.org/doi/10.5281/zenodo.7408075) -To cite a specific version of ScippNeXus select the desired version on Zenodo to get the corresponding DOI. +To cite a specific version of ScippNexus, select the desired version on Zenodo to get the corresponding DOI. ## Older versions of the documentation diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index f758a038..16c449f1 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -122,4 +122,4 @@ :toctree: ../generated/modules :template: module-template.rst :recursive: -``` \ No newline at end of file +``` diff --git a/docs/conf.py b/docs/conf.py index e42480c6..d5c970a3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,7 +9,7 @@ sys.path.insert(0, os.path.abspath('.')) # General information about the project. -project = u'scippnexus' +project = u'ScippNexus' copyright = u'2023 Scipp contributors' author = u'Scipp contributors' @@ -25,7 +25,7 @@ 'sphinx.ext.napoleon', 'sphinx_autodoc_typehints', 'sphinx_copybutton', - "sphinx_design", + 'sphinx_design', 'nbsphinx', 'myst_parser', ] @@ -130,6 +130,7 @@ html_theme_options = { "primary_sidebar_end": ["edit-this-page", "sourcelink"], "secondary_sidebar_items": [], + "navbar_persistent": ["search-button"], "show_nav_level": 1, # Adjust this to ensure external links are moved to "Move" menu "header_links_before_dropdown": 4, @@ -158,9 +159,9 @@ }, { "name": "Conda", - "url": "https://anaconda.org/conda-forge/scippnexus", - "icon": "_static/anaconda-logo.svg", - "type": "local", + "url": "https://anaconda.org/scipp/scippnexus", + "icon": "fa-custom fa-anaconda", + "type": "fontawesome", }, ], "footer_start": ["copyright", "sphinx-version"], @@ -173,7 +174,7 @@ "**": ["sidebar-nav-bs", "page-toc"], } -html_title = "scippnexus" +html_title = "ScippNexus" html_logo = "_static/logo.svg" html_favicon = "_static/favicon.ico" @@ -181,7 +182,8 @@ # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] -html_css_files = ["css/custom.css"] +html_css_files = [] +html_js_files = ["anaconda-icon.js"] # -- Options for HTMLHelp output ------------------------------------------ @@ -191,14 +193,34 @@ # -- Options for Matplotlib in notebooks ---------------------------------- nbsphinx_execute_arguments = [ - "--Session.metadata=scipp_docs_build=True", + "--Session.metadata=scipp_sphinx_build=True", ] # -- Options for doctest -------------------------------------------------- +# sc.plot returns a Figure object and doctest compares that against the +# output written in the docstring. But we only want to show an image of the +# figure, not its `repr`. +# In addition, there is no need to make plots in doctest as the documentation +# build already tests if those plots can be made. +# So we simply disable plots in doctests. doctest_global_setup = ''' import numpy as np -import scipp as sc + +try: + import scipp as sc + + def do_not_plot(*args, **kwargs): + pass + + sc.plot = do_not_plot + sc.Variable.plot = do_not_plot + sc.DataArray.plot = do_not_plot + sc.DataGroup.plot = do_not_plot + sc.Dataset.plot = do_not_plot +except ImportError: + # Scipp is not needed by docs if it is not installed. + pass ''' # Using normalize whitespace because many __str__ functions in scipp produce diff --git a/docs/developer/getting-started.md b/docs/developer/getting-started.md index 1f0f5950..046d5978 100644 --- a/docs/developer/getting-started.md +++ b/docs/developer/getting-started.md @@ -40,7 +40,7 @@ Alternatively, if you want a different workflow, take a look at ``tox.ini`` or ` Run the tests using ```sh -tox -e py38 +tox -e py39 ``` (or just `tox` if you want to run all environments). diff --git a/pyproject.toml b/pyproject.toml index 43ff08f9..08e11c1f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -26,7 +25,7 @@ classifiers = [ "Topic :: Scientific/Engineering", "Typing :: Typed", ] -requires-python = ">=3.8" +requires-python = ">=3.9" # IMPORTANT: # Run 'tox -e deps' after making changes here. This will update requirement files. @@ -52,7 +51,13 @@ minversion = "7.0" # The custom `externalfile` marker runs tests that require passwordless # SSH access to login.esss.dk. We do not run it by default. Make sure to # setup keys in your SSH agent before running `pytest -m externalfile`. -addopts = "-ra -v --strict-markers -m 'not externalfile'" +addopts = """ +--strict-config +--strict-markers +-ra +-v +-m 'not externalfile' +""" testpaths = "tests" filterwarnings = [ "error", diff --git a/requirements/base.in b/requirements/base.in index bc499175..991580f0 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1,5 +1,7 @@ -# Generated by 'tox -e deps', DO NOT EDIT MANUALLY!' -python-dateutil -scipp>=23.07.0 -scipy -h5py \ No newline at end of file +# Temporary until questionary (dep of copier) updates +# See https://github.com/tmbo/questionary/blob/2df265534f3eb77aafcf70902e53e80beb1793e0/pyproject.toml#L36C43-L36C110 +prompt-toolkit==3.0.36 +# Temporary pinned until prompt-tookit conflict is resolved. +ipython==8.9.0 +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! diff --git a/requirements/basetest.in b/requirements/basetest.in new file mode 100644 index 00000000..e4a48b29 --- /dev/null +++ b/requirements/basetest.in @@ -0,0 +1,4 @@ +# Dependencies that are only used by tests. +# Do not make an environment from this file, use test.txt instead! + +pytest diff --git a/requirements/dev.in b/requirements/dev.in index 1c747e48..53ddf47e 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -5,6 +5,7 @@ -r static.in -r test.in -r wheels.in +copier jupyterlab pip-compile-multi pre-commit diff --git a/requirements/docs.in b/requirements/docs.in index f3aebbc6..d8d94964 100644 --- a/requirements/docs.in +++ b/requirements/docs.in @@ -1,12 +1,11 @@ -r base.in -autodoc_pydantic ipykernel ipython!=8.7.0 # Breaks syntax highlighting in Jupyter code cells. myst-parser nbsphinx -pydata-sphinx-theme>=0.13 +pydata-sphinx-theme>=0.14 sphinx -sphinx-autodoc-typehints==1.23.0 # Higher versions require sphinx-7, which is not supported by sphinx-design yet +sphinx-autodoc-typehints sphinx-copybutton sphinx-design plopp diff --git a/requirements/make_base.py b/requirements/make_base.py index 27a23c2f..b26a1c2e 100644 --- a/requirements/make_base.py +++ b/requirements/make_base.py @@ -1,5 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) + import sys from argparse import ArgumentParser +from pathlib import Path +from typing import List import tomli @@ -12,7 +17,28 @@ ) args = parser.parse_args() -header = "# Generated by 'tox -e deps', DO NOT EDIT MANUALLY!'\n" +CUSTOM_AUTO_SEPARATOR = """ +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! +""" + + +def write_dependencies(dependency_name: str, dependencies: List[str]) -> None: + path = Path(f"{dependency_name}.in") + if path.exists(): + sections = path.read_text().split(CUSTOM_AUTO_SEPARATOR) + if len(sections) > 1: + custom = sections[0] + else: + custom = "" + else: + custom = "" + with path.open("w") as f: + f.write(custom) + f.write(CUSTOM_AUTO_SEPARATOR) + f.write("\n".join(dependencies)) + f.write("\n") + with open("../pyproject.toml", "rb") as toml_file: pyproject = tomli.load(toml_file) @@ -21,9 +47,7 @@ raise RuntimeError("No dependencies found in pyproject.toml") dependencies = [dep.strip().strip('"') for dep in dependencies] -with open("base.in", "w") as f: - f.write(header) - f.write("\n".join(dependencies)) +write_dependencies("base", dependencies) def as_nightly(repo: str) -> str: @@ -39,10 +63,8 @@ def as_nightly(repo: str) -> str: return f"{repo} @ git+https://github.com/{org}/{repo}@main" -nightly = args.nightly.split(",") if args.nightly else [] -dependencies = [dep for dep in dependencies if not dep.startswith(tuple(nightly))] -dependencies += [as_nightly(arg) for arg in nightly] +nightly = tuple(args.nightly.split(",") if args.nightly else []) +nightly_dependencies = [dep for dep in dependencies if not dep.startswith(nightly)] +nightly_dependencies += [as_nightly(arg) for arg in nightly] -with open("nightly.in", "w") as f: - f.write(header) - f.write("\n".join(dependencies)) +write_dependencies("nightly", nightly_dependencies) diff --git a/requirements/nightly.in b/requirements/nightly.in index 609114c2..260e2689 100644 --- a/requirements/nightly.in +++ b/requirements/nightly.in @@ -1,5 +1,3 @@ -# Generated by 'tox -e deps', DO NOT EDIT MANUALLY!' -python-dateutil -scipy -h5py -https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl \ No newline at end of file +-r basetest.in +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! diff --git a/requirements/test.in b/requirements/test.in index 1cf404d7..7b409792 100644 --- a/requirements/test.in +++ b/requirements/test.in @@ -1,2 +1,4 @@ +# Add test dependencies in basetest.in + -r base.in -pytest +-r basetest.in diff --git a/tox.ini b/tox.ini index 42b826f3..83e6f4ad 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,39,310} +envlist = py39 isolated_build = true [testenv] @@ -9,9 +9,7 @@ setenv = commands = pytest {posargs} [testenv:nightly] -deps = - -r requirements/nightly.txt - pytest +deps = -r requirements/nightly.txt commands = pytest [testenv:unpinned] @@ -66,4 +64,4 @@ deps = skip_install = true changedir = requirements commands = python ./make_base.py --nightly scipp - pip-compile-multi -d . + pip-compile-multi -d . --backtracking From a689a05c4e36ebe9b1c4c56f8d8850b6ac3a62ac Mon Sep 17 00:00:00 2001 From: Simon Heybrock Date: Thu, 7 Dec 2023 09:16:29 +0100 Subject: [PATCH 2/4] tox -e deps --- requirements/base.in | 4 + requirements/base.txt | 48 +++++++++++- requirements/basetest.txt | 19 +++++ requirements/ci.txt | 16 ++-- requirements/dev.txt | 46 ++++++++--- requirements/docs.txt | 160 ++++++++++---------------------------- requirements/mypy.txt | 2 +- requirements/nightly.in | 4 + requirements/nightly.txt | 9 ++- requirements/static.txt | 8 +- requirements/test.txt | 15 +--- requirements/wheels.txt | 2 +- 12 files changed, 169 insertions(+), 164 deletions(-) create mode 100644 requirements/basetest.txt diff --git a/requirements/base.in b/requirements/base.in index 991580f0..d370d1d6 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -5,3 +5,7 @@ prompt-toolkit==3.0.36 ipython==8.9.0 # --- END OF CUSTOM SECTION --- # The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! +python-dateutil +scipp>=23.07.0 +scipy +h5py diff --git a/requirements/base.txt b/requirements/base.txt index f59679e5..2fbe27b0 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,24 +1,64 @@ -# SHA1:6c268b2fb8b0add1010c58518a8722d643aef704 +# SHA1:a15afedb603f3f93254301541bc458dd5bb1b465 # # This file is autogenerated by pip-compile-multi # To update, run: # # pip-compile-multi # +asttokens==2.4.1 + # via stack-data +backcall==0.2.0 + # via ipython +decorator==5.1.1 + # via ipython +executing==2.0.1 + # via stack-data graphlib-backport==1.0.3 # via scipp h5py==3.10.0 # via -r base.in -numpy==1.24.4 +ipython==8.9.0 + # via -r base.in +jedi==0.19.1 + # via ipython +matplotlib-inline==0.1.6 + # via ipython +numpy==1.26.2 # via # h5py # scipp # scipy +parso==0.8.3 + # via jedi +pexpect==4.9.0 + # via ipython +pickleshare==0.7.5 + # via ipython +prompt-toolkit==3.0.36 + # via + # -r base.in + # ipython +ptyprocess==0.7.0 + # via pexpect +pure-eval==0.2.2 + # via stack-data +pygments==2.17.2 + # via ipython python-dateutil==2.8.2 # via -r base.in scipp==23.11.0 # via -r base.in -scipy==1.10.1 +scipy==1.11.4 # via -r base.in six==1.16.0 - # via python-dateutil + # via + # asttokens + # python-dateutil +stack-data==0.6.3 + # via ipython +traitlets==5.14.0 + # via + # ipython + # matplotlib-inline +wcwidth==0.2.12 + # via prompt-toolkit diff --git a/requirements/basetest.txt b/requirements/basetest.txt new file mode 100644 index 00000000..6bf43fa2 --- /dev/null +++ b/requirements/basetest.txt @@ -0,0 +1,19 @@ +# SHA1:0eaa389e1fdb3a1917c0f987514bd561be5718ee +# +# This file is autogenerated by pip-compile-multi +# To update, run: +# +# pip-compile-multi +# +exceptiongroup==1.2.0 + # via pytest +iniconfig==2.0.0 + # via pytest +packaging==23.2 + # via pytest +pluggy==1.3.0 + # via pytest +pytest==7.4.3 + # via -r basetest.in +tomli==2.0.1 + # via pytest diff --git a/requirements/ci.txt b/requirements/ci.txt index 0efd86cb..279a1737 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -7,17 +7,17 @@ # cachetools==5.3.2 # via tox -certifi==2023.7.22 +certifi==2023.11.17 # via requests chardet==5.2.0 # via tox -charset-normalizer==3.3.1 +charset-normalizer==3.3.2 # via requests colorama==0.4.6 # via tox distlib==0.3.7 # via virtualenv -filelock==3.12.4 +filelock==3.13.1 # via # tox # virtualenv @@ -25,14 +25,14 @@ gitdb==4.0.11 # via gitpython gitpython==3.1.40 # via -r ci.in -idna==3.4 +idna==3.6 # via requests packaging==23.2 # via # -r ci.in # pyproject-api # tox -platformdirs==3.11.0 +platformdirs==4.1.0 # via # tox # virtualenv @@ -48,9 +48,9 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.11.3 +tox==4.11.4 # via -r ci.in -urllib3==2.0.7 +urllib3==2.1.0 # via requests -virtualenv==20.24.6 +virtualenv==20.25.0 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index f97d967f..4b3e502e 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -# SHA1:e3e8cd703eb07e0484bb54fe0e131426d458d1bc +# SHA1:efd19a3a98c69fc3d6d6233ed855de7e4a208f74 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -12,7 +12,9 @@ -r static.txt -r test.txt -r wheels.txt -anyio==4.0.0 +annotated-types==0.6.0 + # via pydantic +anyio==4.1.0 # via jupyter-server argon2-cffi==23.1.0 # via jupyter-server @@ -28,24 +30,32 @@ click==8.1.7 # via # pip-compile-multi # pip-tools +copier==9.1.0 + # via -r dev.in +dunamai==1.19.0 + # via copier fqdn==1.5.1 # via jsonschema +funcy==2.0 + # via copier isoduration==20.11.0 # via jsonschema +jinja2-ansible-filters==1.3.2 + # via copier json5==0.9.14 # via jupyterlab-server jsonpointer==2.4 # via jsonschema -jsonschema[format-nongpl]==4.19.1 +jsonschema[format-nongpl]==4.20.0 # via # jupyter-events # jupyterlab-server # nbformat -jupyter-events==0.8.0 +jupyter-events==0.9.0 # via jupyter-server -jupyter-lsp==2.2.0 +jupyter-lsp==2.2.1 # via jupyterlab -jupyter-server==2.9.0 +jupyter-server==2.12.1 # via # jupyter-lsp # jupyterlab @@ -53,24 +63,36 @@ jupyter-server==2.9.0 # notebook-shim jupyter-server-terminals==0.4.4 # via jupyter-server -jupyterlab==4.0.7 +jupyterlab==4.0.9 # via -r dev.in -jupyterlab-server==2.25.0 +jupyterlab-server==2.25.2 # via jupyterlab notebook-shim==0.2.3 # via jupyterlab overrides==7.4.0 # via jupyter-server +pathspec==0.11.2 + # via copier pip-compile-multi==2.6.3 # via -r dev.in pip-tools==7.3.0 # via pip-compile-multi -prometheus-client==0.17.1 +plumbum==1.8.2 + # via copier +prometheus-client==0.19.0 # via jupyter-server pycparser==2.21 # via cffi +pydantic==2.5.2 + # via copier +pydantic-core==2.14.5 + # via pydantic python-json-logger==2.0.7 # via jupyter-events +pyyaml-include==1.3.1 + # via copier +questionary==2.0.1 + # via copier rfc3339-validator==0.1.4 # via # jsonschema @@ -83,7 +105,7 @@ send2trash==1.8.2 # via jupyter-server sniffio==1.3.0 # via anyio -terminado==0.17.1 +terminado==0.18.0 # via # jupyter-server # jupyter-server-terminals @@ -95,9 +117,9 @@ uri-template==1.3.0 # via jsonschema webcolors==1.13 # via jsonschema -websocket-client==1.6.4 +websocket-client==1.7.0 # via jupyter-server -wheel==0.41.2 +wheel==0.42.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 4d02283c..f497722a 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,4 +1,4 @@ -# SHA1:f7408a5bf684f2df40f07d7a1b1a3e8a45c0852e +# SHA1:fc8cf16fd634213e455a1f8358d42c5e6da8c26d # # This file is autogenerated by pip-compile-multi # To update, run: @@ -10,42 +10,32 @@ accessible-pygments==0.0.4 # via pydata-sphinx-theme alabaster==0.7.13 # via sphinx -annotated-types==0.6.0 - # via pydantic -asttokens==2.4.0 - # via stack-data attrs==23.1.0 # via # jsonschema # referencing -autodoc-pydantic==2.0.1 - # via -r docs.in babel==2.13.1 # via # pydata-sphinx-theme # sphinx -backcall==0.2.0 - # via ipython beautifulsoup4==4.12.2 # via # nbconvert # pydata-sphinx-theme bleach==6.1.0 # via nbconvert -certifi==2023.7.22 +certifi==2023.11.17 # via requests -charset-normalizer==3.3.1 +charset-normalizer==3.3.2 # via requests -comm==0.1.4 +comm==0.2.0 # via ipykernel -contourpy==1.1.1 +contourpy==1.2.0 # via matplotlib cycler==0.12.1 # via matplotlib debugpy==1.8.0 # via ipykernel -decorator==5.1.1 - # via ipython defusedxml==0.7.1 # via nbconvert docutils==0.20.1 @@ -54,57 +44,45 @@ docutils==0.20.1 # nbsphinx # pydata-sphinx-theme # sphinx -executing==2.0.0 - # via stack-data -fastjsonschema==2.18.1 +fastjsonschema==2.19.0 # via nbformat -fonttools==4.43.1 +fonttools==4.46.0 # via matplotlib -idna==3.4 +idna==3.6 # via requests imagesize==1.4.1 # via sphinx -importlib-metadata==6.8.0 +importlib-metadata==7.0.0 # via - # autodoc-pydantic # jupyter-client # nbconvert # sphinx -importlib-resources==6.1.0 - # via - # jsonschema - # jsonschema-specifications - # matplotlib -ipykernel==6.26.0 +importlib-resources==6.1.1 + # via matplotlib +ipykernel==6.27.1 # via -r docs.in -ipython==8.12.3 - # via - # -r docs.in - # ipykernel -jedi==0.19.1 - # via ipython jinja2==3.1.2 # via # myst-parser # nbconvert # nbsphinx # sphinx -jsonschema==4.19.1 +jsonschema==4.20.0 # via nbformat -jsonschema-specifications==2023.7.1 +jsonschema-specifications==2023.11.2 # via jsonschema -jupyter-client==8.5.0 +jupyter-client==8.6.0 # via # ipykernel # nbclient -jupyter-core==5.4.0 +jupyter-core==5.5.0 # via # ipykernel # jupyter-client # nbclient # nbconvert # nbformat -jupyterlab-pygments==0.2.2 +jupyterlab-pygments==0.3.0 # via nbconvert kiwisolver==1.4.5 # via matplotlib @@ -116,14 +94,10 @@ markupsafe==2.1.3 # via # jinja2 # nbconvert -matplotlib==3.7.3 +matplotlib==3.8.2 # via # -r docs.in # plopp -matplotlib-inline==0.1.6 - # via - # ipykernel - # ipython mdit-py-plugins==0.4.0 # via myst-parser mdurl==0.1.2 @@ -132,9 +106,9 @@ mistune==3.0.2 # via nbconvert myst-parser==2.0.0 # via -r docs.in -nbclient==0.8.0 +nbclient==0.9.0 # via nbconvert -nbconvert==7.9.2 +nbconvert==7.12.0 # via nbsphinx nbformat==5.9.2 # via @@ -155,60 +129,29 @@ packaging==23.2 # sphinx pandocfilters==1.5.0 # via nbconvert -parso==0.8.3 - # via jedi -pexpect==4.8.0 - # via ipython -pickleshare==0.7.5 - # via ipython pillow==10.1.0 # via matplotlib -pkgutil-resolve-name==1.3.10 - # via jsonschema -platformdirs==3.11.0 +platformdirs==4.1.0 # via # jupyter-core # pooch -plopp==23.10.1 +plopp==23.11.0 # via -r docs.in pooch==1.8.0 # via -r docs.in -prompt-toolkit==3.0.39 - # via ipython psutil==5.9.6 # via ipykernel -ptyprocess==0.7.0 - # via pexpect -pure-eval==0.2.2 - # via stack-data -pydantic==2.4.2 - # via - # autodoc-pydantic - # pydantic-settings -pydantic-core==2.10.1 - # via pydantic -pydantic-settings==2.0.3 - # via autodoc-pydantic -pydata-sphinx-theme==0.14.2 +pydata-sphinx-theme==0.14.4 # via -r docs.in -pygments==2.16.1 - # via - # accessible-pygments - # ipython - # nbconvert - # pydata-sphinx-theme - # sphinx pyparsing==3.1.1 # via matplotlib -python-dotenv==1.0.0 - # via pydantic-settings -pytz==2023.3.post1 - # via babel -pyzmq==25.1.1 +pyyaml==6.0.1 + # via myst-parser +pyzmq==25.1.2 # via # ipykernel # jupyter-client -referencing==0.30.2 +referencing==0.31.1 # via # jsonschema # jsonschema-specifications @@ -216,7 +159,7 @@ requests==2.31.0 # via # pooch # sphinx -rpds-py==0.10.6 +rpds-py==0.13.2 # via # jsonschema # referencing @@ -224,65 +167,48 @@ snowballstemmer==2.2.0 # via sphinx soupsieve==2.5 # via beautifulsoup4 -sphinx==7.1.2 +sphinx==7.2.6 # via # -r docs.in - # autodoc-pydantic # myst-parser # nbsphinx # pydata-sphinx-theme # sphinx-autodoc-typehints # sphinx-copybutton # sphinx-design -sphinx-autodoc-typehints==1.23.0 + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml +sphinx-autodoc-typehints==1.25.2 # via -r docs.in sphinx-copybutton==0.5.2 # via -r docs.in sphinx-design==0.5.0 # via -r docs.in -sphinxcontrib-applehelp==1.0.4 +sphinxcontrib-applehelp==1.0.7 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.5 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.4 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.6 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.9 # via sphinx -stack-data==0.6.3 - # via ipython tinycss2==1.2.1 # via nbconvert -tornado==6.3.3 +tornado==6.4 # via # ipykernel # jupyter-client -traitlets==5.12.0 - # via - # comm - # ipykernel - # ipython - # jupyter-client - # jupyter-core - # matplotlib-inline - # nbclient - # nbconvert - # nbformat - # nbsphinx typing-extensions==4.8.0 - # via - # annotated-types - # ipython - # pydantic - # pydantic-core - # pydata-sphinx-theme -urllib3==2.0.7 + # via pydata-sphinx-theme +urllib3==2.1.0 # via requests -wcwidth==0.2.8 - # via prompt-toolkit webencodings==0.5.1 # via # bleach diff --git a/requirements/mypy.txt b/requirements/mypy.txt index 5df22e91..f98e1a53 100644 --- a/requirements/mypy.txt +++ b/requirements/mypy.txt @@ -6,7 +6,7 @@ # pip-compile-multi # -r test.txt -mypy==1.6.1 +mypy==1.7.1 # via -r mypy.in mypy-extensions==1.0.0 # via mypy diff --git a/requirements/nightly.in b/requirements/nightly.in index 260e2689..84c4b08e 100644 --- a/requirements/nightly.in +++ b/requirements/nightly.in @@ -1,3 +1,7 @@ -r basetest.in # --- END OF CUSTOM SECTION --- # The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! +python-dateutil +scipy +h5py +https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl diff --git a/requirements/nightly.txt b/requirements/nightly.txt index fc818bc6..de99562b 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -1,24 +1,25 @@ -# SHA1:5f33f1f32f89f39e87cf10294ea4a7a49359a308 +# SHA1:799a1fd7b9563a4277cadc6e4fc5fad5039cad2c # # This file is autogenerated by pip-compile-multi # To update, run: # # pip-compile-multi # +-r basetest.txt graphlib-backport==1.0.3 # via scipp h5py==3.10.0 # via -r nightly.in -numpy==1.24.4 +numpy==1.26.2 # via # h5py # scipp # scipy python-dateutil==2.8.2 # via -r nightly.in -scipp @ https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +scipp @ https://github.com/scipp/scipp/releases/download/nightly/scipp-nightly-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl # via -r nightly.in -scipy==1.10.1 +scipy==1.11.4 # via -r nightly.in six==1.16.0 # via python-dateutil diff --git a/requirements/static.txt b/requirements/static.txt index 11418f26..38c7aa83 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -9,19 +9,19 @@ cfgv==3.4.0 # via pre-commit distlib==0.3.7 # via virtualenv -filelock==3.12.4 +filelock==3.13.1 # via virtualenv -identify==2.5.30 +identify==2.5.33 # via pre-commit nodeenv==1.8.0 # via pre-commit -platformdirs==3.11.0 +platformdirs==4.1.0 # via virtualenv pre-commit==3.5.0 # via -r static.in pyyaml==6.0.1 # via pre-commit -virtualenv==20.24.6 +virtualenv==20.25.0 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/test.txt b/requirements/test.txt index 32d7431c..3c7454d8 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,4 @@ -# SHA1:a035a60fcbac4cd7bf595dbd81ee7994505d4a95 +# SHA1:ef2ee9576d8a9e65b44e2865a26887eed3fc49d1 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -6,15 +6,4 @@ # pip-compile-multi # -r base.txt -exceptiongroup==1.1.3 - # via pytest -iniconfig==2.0.0 - # via pytest -packaging==23.2 - # via pytest -pluggy==1.3.0 - # via pytest -pytest==7.4.3 - # via -r test.in -tomli==2.0.1 - # via pytest +-r basetest.txt diff --git a/requirements/wheels.txt b/requirements/wheels.txt index 01d277eb..d5378cf7 100644 --- a/requirements/wheels.txt +++ b/requirements/wheels.txt @@ -7,7 +7,7 @@ # build==1.0.3 # via -r wheels.in -importlib-metadata==6.8.0 +importlib-metadata==7.0.0 # via build packaging==23.2 # via build From 958ef5b6492f0f901d3a6ebcd3b4c111e805f540 Mon Sep 17 00:00:00 2001 From: Simon Heybrock Date: Thu, 7 Dec 2023 09:20:17 +0100 Subject: [PATCH 3/4] Disable B028 Could fix for v2, but as long as v1 is still around this would waste time and edit untested code. --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 1ba190c5..bd70c852 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [flake8] # See https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length max-line-length = 88 -extend-ignore = E203 +extend-ignore = E203, B028 From f574ba9f44eb30e8229bfadc7c648e6e0ffa1734 Mon Sep 17 00:00:00 2001 From: Simon Heybrock Date: Thu, 7 Dec 2023 10:12:21 +0100 Subject: [PATCH 4/4] Set stacklevel --- setup.cfg | 2 +- src/scippnexus/_hdf5_nexus.py | 3 ++- src/scippnexus/base.py | 2 +- src/scippnexus/field.py | 3 ++- src/scippnexus/nxtransformations.py | 3 ++- src/scippnexus/v1/file.py | 1 + src/scippnexus/v1/nxobject.py | 10 ++++++---- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/setup.cfg b/setup.cfg index bd70c852..1ba190c5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,4 +1,4 @@ [flake8] # See https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length max-line-length = 88 -extend-ignore = E203, B028 +extend-ignore = E203 diff --git a/src/scippnexus/_hdf5_nexus.py b/src/scippnexus/_hdf5_nexus.py index deff86a2..48e6605d 100644 --- a/src/scippnexus/_hdf5_nexus.py +++ b/src/scippnexus/_hdf5_nexus.py @@ -39,7 +39,8 @@ def _warn_latin1_decode(obj, decoded, error): f"extended ASCII (latin-1), but this behavior is not " f"specified by the HDF5 or nexus standards and may therefore " f"be incorrect. Decoded string using latin-1 is '{decoded}'. " - f"Error was '{error}'." + f"Error was '{error}'.", + stacklevel=2, ) diff --git a/src/scippnexus/base.py b/src/scippnexus/base.py index 55792398..ac111e45 100644 --- a/src/scippnexus/base.py +++ b/src/scippnexus/base.py @@ -378,7 +378,7 @@ def _warn_fallback(self, e: Exception) -> None: f"Failed to load {self.name} as {type(self._nexus).__name__}: {e} " "Falling back to loading HDF5 group children as scipp.DataGroup." ) - warnings.warn(msg) + warnings.warn(msg, stacklevel=2) def __setitem__(self, key, value): """Set a child group or child dataset. diff --git a/src/scippnexus/field.py b/src/scippnexus/field.py index c6bc7068..c0a03a7e 100644 --- a/src/scippnexus/field.py +++ b/src/scippnexus/field.py @@ -239,7 +239,8 @@ def unit(self) -> Union[sc.Unit, None]: except sc.UnitError: warnings.warn( f"Unrecognized unit '{unit}' for value dataset " - f"in '{self.name}'; setting unit as 'dimensionless'" + f"in '{self.name}'; setting unit as 'dimensionless'", + stacklevel=2, ) return sc.units.one return None diff --git a/src/scippnexus/nxtransformations.py b/src/scippnexus/nxtransformations.py index 1628ba05..9865abf5 100644 --- a/src/scippnexus/nxtransformations.py +++ b/src/scippnexus/nxtransformations.py @@ -403,7 +403,8 @@ def _with_positions( out[store_transform] = transform except TransformationChainResolver.ChainError as e: warnings.warn( - UserWarning(f'depends_on chain references missing node:\n{e}') + UserWarning(f'depends_on chain references missing node:\n{e}'), + stacklevel=2, ) for name, value in dg.items(): if isinstance(value, sc.DataGroup): diff --git a/src/scippnexus/v1/file.py b/src/scippnexus/v1/file.py index 88308fb0..c797f104 100644 --- a/src/scippnexus/v1/file.py +++ b/src/scippnexus/v1/file.py @@ -16,6 +16,7 @@ def __init__(self, *args, definition=None, **kwargs): "The scippnexus.v1 API is deprecated and will be removed in release 24.01. " "Switch to 'import scippnexus as snx' to use API version 2.", VisibleDeprecationWarning, + stacklevel=2, ) self._file = h5py.File(*args, **kwargs) NXroot.__init__(self, self._file, definition=definition) diff --git a/src/scippnexus/v1/nxobject.py b/src/scippnexus/v1/nxobject.py index db7a4883..37dff8b2 100644 --- a/src/scippnexus/v1/nxobject.py +++ b/src/scippnexus/v1/nxobject.py @@ -317,7 +317,8 @@ def unit(self) -> Union[sc.Unit, None]: except sc.UnitError: warnings.warn( f"Unrecognized unit '{unit}' for value dataset " - f"in '{self.name}'; setting unit as 'dimensionless'" + f"in '{self.name}'; setting unit as 'dimensionless'", + stacklevel=2, ) return sc.units.one return None @@ -389,7 +390,7 @@ def _get_child( f"Failed to determine axis names of {item.name}: {e}. " "Falling back to default dimension labels." ) - warnings.warn(msg) + warnings.warn(msg, stacklevel=2) dims = None dtype = self._get_field_dtype(name) return Field( @@ -415,7 +416,7 @@ def _get_child( f"Failed to load {self.name} as {type(self).__name__}: {e} " "Falling back to loading HDF5 group children as scipp.DataGroup." ) - warnings.warn(msg) + warnings.warn(msg, stacklevel=2) da = NXobject._getitem(self, name) return da @@ -582,7 +583,8 @@ def depends_on(self) -> Union[sc.Variable, sc.DataArray, None]: except (NexusStructureError, TransformationError) as e: warnings.warn( f"Failed to load transformation {self.name}/{depends_on}:\n{e}\n" - "Falling back to returning the path to the transformation." + "Falling back to returning the path to the transformation.", + stacklevel=2, ) return depends_on[()] return None