diff --git a/.copier-answers.yml b/.copier-answers.yml index 1ec0754..9a28e19 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,10 +1,13 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 14eaf11 +_commit: 6ee5264 _src_path: gh:scipp/copier_template description: Flux simulation toy building library. -github_linux_image: ubuntu-20.04 -max_python: '3.11' +max_python: '3.12' min_python: '3.10' +namespace_package: '' +nightly_deps: '' orgname: physicscore +prettyname: Thermoblock projectname: thermoblock -year: 2023 +related_projects: '' +year: 2024 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4a4bf11..c8076bb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,13 +1,9 @@ version: 2 updates: - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - ignore: - # Optional: Official actions have moving tags like v1; - # if you use those, you don't need updates. - - dependency-name: "actions/*" + # Note: We are not listing package-ecosystem: "github-actions". This causes + # noise in all template instances. Instead dependabot.yml in scipp/copier_template + # triggers updates of github-actions in the *template*. We then use `copier update` + # in template instances. - package-ecosystem: "pip" directory: "/requirements" schedule: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65a5685..44266a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,3 @@ - name: CI on: @@ -11,30 +10,37 @@ 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 }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - 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 + - uses: actions/setup-python@v5 + with: + python-version-file: '.github/workflows/python-version-ci' + - uses: pre-commit/action@v3.0.1 with: - python-version: '3.10' - - run: python -m pip install --upgrade pip - - run: python -m pip install -r requirements/ci.txt - - run: tox -e static - - uses: stefanzweifel/git-auto-commit-action@v4 + extra_args: --all-files + - uses: pre-commit-ci/lite-action@v1.0.2 + if: always() with: - commit_message: Apply automatic formatting + msg: Apply automatic formatting tests: name: Tests needs: formatting strategy: matrix: - - os: ['ubuntu-20.04'] + os: ['ubuntu-22.04'] python: - - version: '3.10' - tox-env: 'py310' - + - version: '${{needs.formatting.outputs.min_python}}' + tox-env: '${{needs.formatting.outputs.min_tox_env}}' uses: ./.github/workflows/test.yml with: os-variant: ${{ matrix.os }} @@ -46,5 +52,5 @@ jobs: uses: ./.github/workflows/docs.yml with: publish: false - version: ${{ github.ref_name }} + 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 83e2276..7e5a7bc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,3 @@ - name: Docs on: @@ -30,6 +29,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 }} @@ -37,30 +41,28 @@ 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 + - uses: actions/checkout@v4 with: ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }} + repository: ${{ github.event.pull_request.head.repo.full_name }} fetch-depth: 0 # history required so cmake can determine version - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v5 with: - - python-version: '3.10' + 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 --skip-pkg-install -e docs -- thermoblock==${VERSION} - - echo "target=$(python docs/version.py --version=${VERSION} --action=get-target)" >> $GITHUB_ENV - if: ${{ inputs.publish }} + - run: tox -e releasedocs -- ${VERSION} + if: ${{ inputs.version != '' }} - run: tox -e docs - if: ${{ !inputs.publish }} - - uses: actions/upload-artifact@v3 + if: ${{ inputs.version == '' }} + - run: tox -e linkcheck + if: ${{ inputs.linkcheck }} + - uses: actions/upload-artifact@v4 with: - name: html + name: docs_html path: html/ - uses: JamesIves/github-pages-deploy-action@v4.6.0 @@ -68,7 +70,4 @@ jobs: with: branch: gh-pages folder: html - target-folder: ${{ env.target }} single-commit: true - clean-exclude: release - ssh-key: ${{ secrets.GH_PAGES_DEPLOY_KEY }} diff --git a/.github/workflows/python-version-ci b/.github/workflows/python-version-ci new file mode 100644 index 0000000..c8cfe39 --- /dev/null +++ b/.github/workflows/python-version-ci @@ -0,0 +1 @@ +3.10 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7ae622a..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,126 +0,0 @@ -name: Release - -on: - release: - types: [published] - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} # required for conda env - -jobs: - build_conda: - name: Conda build - runs-on: 'ubuntu-20.04' - - steps: - - uses: actions/checkout@v2 - with: - submodules: true - fetch-depth: 0 # history required so cmake can determine version - - - uses: conda-incubator/setup-miniconda@v3 - - run: conda install --yes conda-build - - run: conda build --channel conda-forge --python=3.10 --no-anaconda-upload --override-channels --output-folder conda/package conda - - - uses: actions/upload-artifact@v2 - with: - name: conda-package-noarch - path: conda/package/*/thermoblock*.tar.bz2 - - build_wheels: - name: Wheels - runs-on: 'ubuntu-20.04' - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # history required so setuptools_scm can determine version - - - uses: actions/setup-python@v3 - with: - python-version: '3.10' - - - - run: python -m pip install --upgrade pip - - run: python -m pip install -r requirements/wheels.txt - - - name: Build wheels - run: python -m build - - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - name: dist - path: dist - - upload_pypi: - name: Deploy PyPI - needs: [build_wheels, build_conda] - runs-on: 'ubuntu-20.04' - if: github.event_name == 'release' && github.event.action == 'published' - - steps: - - uses: actions/download-artifact@v3 - - uses: actions/setup-python@v3 - - uses: pypa/gh-action-pypi-publish@v1.8.14 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - - upload_conda: - name: Deploy Conda Forge - needs: [build_wheels, build_conda] - runs-on: 'ubuntu-20.04' - if: github.event_name == 'release' && github.event.action == 'published' - - steps: - - uses: actions/download-artifact@v3 - - uses: conda-incubator/setup-miniconda@v3 - with: - python-version: '3.10' - - - run: conda install -c conda-forge --yes anaconda-client - - run: anaconda --token ${{ secrets.ANACONDATOKEN }} upload --user physicscore --label main $(ls conda-package-*/*/*.tar.bz2) - manage-versions: - name: Manage Versions - - runs-on: 'ubuntu-20.04' - - outputs: - version-new: ${{ steps.version.outputs.new }} - version-replaced: ${{ steps.version.outputs.replaced }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 # history required so cmake can determine version - - uses: actions/setup-python@v3 - with: - - python-version: '3.10' - - - run: python -m pip install --upgrade pip - - run: python -m pip install -r requirements/ci.txt - - name: Set outputs - id: version - run: | - echo "new=$(python docs/version.py --version=${GITHUB_REF_NAME} --action=is-new)" >> $GITHUB_OUTPUT - echo "replaced=$(python docs/version.py --version=${GITHUB_REF_NAME} --action=get-replaced)" >> $GITHUB_OUTPUT - - docs: - needs: [upload_conda, upload_pypi, manage-versions] - uses: ./.github/workflows/docs.yml - with: - publish: ${{ github.event_name == 'release' && github.event.action == 'published' }} - version: ${{ github.ref_name }} - secrets: inherit - - replaced-docs: - needs: docs - if: github.event_name == 'release' && github.event.action == 'published' && needs.manage-versions.outputs.version-new == 'True' - uses: ./.github/workflows/docs.yml - with: - publish: true - version: ${{ needs.manage-versions.outputs.version-replaced }} - secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cc266bd..5f56a06 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,16 +1,12 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 PhysicsCore contributors (https://github.com/physicscore) - name: Test on: workflow_dispatch: inputs: os-variant: - default: 'ubuntu-20.04' + default: 'ubuntu-22.04' type: string python-version: - default: '3.10' type: string tox-env: default: 'test' @@ -21,13 +17,15 @@ on: coverage-report: default: false type: boolean + checkout_ref: + default: '' + type: string workflow_call: inputs: os-variant: - default: 'ubuntu-20.04' + default: 'ubuntu-22.04' type: string python-version: - default: '3.10' type: string tox-env: default: 'test' @@ -38,22 +36,26 @@ on: coverage-report: default: false type: boolean + checkout_ref: + default: '' + type: string jobs: test: runs-on: ${{ inputs.os-variant }} steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - 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 -r ${{ inputs.pip-recipe }} - run: tox -e ${{ inputs.tox-env }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: ${{ inputs.coverage-report }} with: name: CoverageReport path: coverage_html/ - diff --git a/.gitignore b/.gitignore index 3d93cf4..2a0e312 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,17 @@ +# Build artifacts +build dist html .tox -src/thermoblock.egg-info +*.egg-info *.sw? +# Environments +venv + +# Caches .clangd/ -.idea/ -.vscode/ *.ipynb_checkpoints __pycache__/ .vs/ @@ -16,3 +20,12 @@ __pycache__/ .pytest_cache .mypy_cache docs/generated/ + +# Editor settings +.idea/ +.vscode/ + +# Data files +*.data +*.dat +*.csv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9f068c3..19830db 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 @@ -17,8 +18,8 @@ repos: hooks: - id: isort name: isort (python) - - repo: https://github.com/psf/black - rev: 23.1.0 + - repo: https://github.com/psf/black-pre-commit-mirror + 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/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..69f79e1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,133 @@ + +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at sunyoung.yoo[at]ess.eu +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][Mozilla CoC]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[Mozilla CoC]: https://github.com/mozilla/diversity +[FAQ]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed126f7..c37e631 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,3 +13,8 @@ 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://physicscore.github.io/thermoblock/developer/index.html) for details on how Thermoblock is developed. + +## Code of conduct + +This project is a community effort, and everyone is welcome to contribute. +Everyone within the community is expected to abide by our [code of conduct](https://github.com/physicscore/thermoblock/blob/main/CODE_OF_CONDUCT.md). diff --git a/README.md b/README.md index ddde4e5..1a51a6f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md) [![PyPI badge](http://img.shields.io/pypi/v/thermoblock.svg)](https://pypi.python.org/pypi/thermoblock) [![Anaconda-Server Badge](https://anaconda.org/physicscore/thermoblock/badges/version.svg)](https://anaconda.org/physicscore/thermoblock) [![License: BSD 3-Clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](LICENSE) -# thermoblock +# Thermoblock ## About diff --git a/conda/meta.yaml b/conda/meta.yaml index 96f685f..12808de 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -6,6 +6,11 @@ package: source: path: .. + +{% set pyproject = load_file_data('pyproject.toml') %} +{% set dependencies = pyproject.get('project', {}).get('dependencies', {}) %} + + requirements: build: - setuptools @@ -13,6 +18,11 @@ requirements: run: - python>=3.10 + {% for package in dependencies %} + - {% if package == "graphviz" %}python-graphviz{% else %}{{ package }}{% endif %} + {% endfor %} + + test: imports: - thermoblock @@ -22,12 +32,13 @@ test: - pyproject.toml - tests/ commands: - - python -m pytest tests + # We ignore warnings during release package builds + - python -m pytest -Wignore tests build: noarch: python script: - - pip install . + - python -m pip install . about: home: https://github.com/physicscore/thermoblock diff --git a/docs/_static/anaconda-icon.js b/docs/_static/anaconda-icon.js new file mode 100644 index 0000000..024350e --- /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/_templates/class-template.rst b/docs/_templates/class-template.rst new file mode 100644 index 0000000..0200267 --- /dev/null +++ b/docs/_templates/class-template.rst @@ -0,0 +1,31 @@ +{{ fullname | escape | underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :special-members: __getitem__ + + {% block methods %} + .. automethod:: __init__ + + {% if methods %} + .. rubric:: {{ _('Methods') }} + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/docs/_templates/doc_version.html b/docs/_templates/doc_version.html new file mode 100644 index 0000000..48f9aac --- /dev/null +++ b/docs/_templates/doc_version.html @@ -0,0 +1,2 @@ + +Current {{ project }} version: {{ version }} (older versions). diff --git a/docs/_templates/module-template.rst b/docs/_templates/module-template.rst new file mode 100644 index 0000000..6fee8d7 --- /dev/null +++ b/docs/_templates/module-template.rst @@ -0,0 +1,66 @@ +{{ fullname | escape | underline}} + +.. automodule:: {{ fullname }} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Module Attributes') }} + + .. autosummary:: + :toctree: + {% for item in attributes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block functions %} + {% if functions %} + .. rubric:: {{ _('Functions') }} + + .. autosummary:: + :toctree: + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block classes %} + {% if classes %} + .. rubric:: {{ _('Classes') }} + + .. autosummary:: + :toctree: + :template: class-template.rst + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block exceptions %} + {% if exceptions %} + .. rubric:: {{ _('Exceptions') }} + + .. autosummary:: + :toctree: + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + +{% block modules %} +{% if modules %} +.. rubric:: Modules + +.. autosummary:: + :toctree: + :template: module-template.rst + :recursive: +{% for item in modules %} + {{ item }} +{%- endfor %} +{% endif %} +{% endblock %} diff --git a/docs/about/index.md b/docs/about/index.md new file mode 100644 index 0000000..d2aea46 --- /dev/null +++ b/docs/about/index.md @@ -0,0 +1,26 @@ +# About + +## Development + +Thermoblock is an open source project by the [European Spallation Source ERIC](https://europeanspallationsource.se/) (ESS). + +## License + +Thermoblock is available as open source under the [BSD-3 license](https://opensource.org/licenses/BSD-3-Clause). + +## Citing Thermoblock + +Please cite the following: + +[![DOI](https://zenodo.org/badge/FIXME.svg)](https://zenodo.org/doi/10.5281/zenodo.FIXME) + +To cite a specific version of Thermoblock, select the desired version on Zenodo to get the corresponding DOI. + +## Older versions of the documentation + +Older versions of the documentation pages can be found under the assets of each [release](https://github.com/physicscore/thermoblock/releases). +Simply download the archive, unzip and view locally in a web browser. + +## Source code and development + +Thermoblock is hosted and developed [on GitHub](https://github.com/physicscore/thermoblock). diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md new file mode 100644 index 0000000..e5d63c7 --- /dev/null +++ b/docs/api-reference/index.md @@ -0,0 +1,29 @@ +# API Reference + +## Classes + +```{eval-rst} +.. currentmodule:: thermoblock + +.. autosummary:: + :toctree: ../generated/classes + :template: class-template.rst + :recursive: +``` + +## Top-level functions + +```{eval-rst} +.. autosummary:: + :toctree: ../generated/functions + :recursive: +``` + +## Submodules + +```{eval-rst} +.. autosummary:: + :toctree: ../generated/modules + :template: module-template.rst + :recursive: +``` diff --git a/docs/conf.py b/docs/conf.py index 2872985..248a5c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -3,13 +3,12 @@ import doctest import os import sys - -import thermoblock +from importlib.metadata import version as get_version sys.path.insert(0, os.path.abspath('.')) # General information about the project. -project = u'thermoblock' +project = u'Thermoblock' copyright = u'2023 PhysicsCore contributors' author = u'PhysicsCore contributors' @@ -19,16 +18,19 @@ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.doctest', + 'sphinx.ext.githubpages', 'sphinx.ext.intersphinx', 'sphinx.ext.mathjax', 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', 'sphinx_autodoc_typehints', 'sphinx_copybutton', - "sphinx_design", + 'sphinx_design', 'nbsphinx', 'myst_parser', ] + myst_enable_extensions = [ "amsmath", "colon_fence", @@ -72,6 +74,7 @@ typehints_defaults = 'comma' typehints_use_rtype = False + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -89,10 +92,8 @@ # built documents. # -# The short X.Y version. -version = thermoblock.__version__ -# The full version, including alpha/beta/rc tags. -release = thermoblock.__version__ +release = get_version("thermoblock") +version = ".".join(release.split('.')[:3]) # CalVer warning_is_error = True @@ -120,7 +121,9 @@ 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, "pygment_light_style": "github-light-high-contrast", "pygment_dark_style": "github-dark-high-contrast", @@ -128,7 +131,9 @@ "image_light": "_static/logo.svg", "image_dark": "_static/logo-dark.svg", }, - "external_links": [], + "external_links": [ + {"name": "", "url": "https://physicscore.github.io/"}, + ], "icon_links": [ { "name": "GitHub", @@ -145,10 +150,12 @@ { "name": "Conda", "url": "https://anaconda.org/physicscore/thermoblock", - "icon": "_static/anaconda-logo.svg", - "type": "local", + "icon": "fa-custom fa-anaconda", + "type": "fontawesome", }, ], + "footer_start": ["copyright", "sphinx-version"], + "footer_end": ["doc_version", "theme-version"], } html_context = { "doc_path": "docs", @@ -157,7 +164,7 @@ "**": ["sidebar-nav-bs", "page-toc"], } -html_title = "thermoblock" +html_title = "Thermoblock" html_logo = "_static/logo.svg" html_favicon = "_static/favicon.ico" @@ -165,7 +172,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 ------------------------------------------ @@ -175,13 +183,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 + +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 4ad90be..a196f56 100644 --- a/docs/developer/getting-started.md +++ b/docs/developer/getting-started.md @@ -78,14 +78,14 @@ tox -e linkcheck Build the documentation using ```sh -python -m sphinx -v -b html -d build/.doctrees docs build/html +python -m sphinx -v -b html -d .tox/docs_doctrees docs html ``` Additionally, test the documentation using ```sh -python -m sphinx -v -b doctest -d build/.doctrees docs build/html -python -m sphinx -v -b linkcheck -d build/.doctrees docs build/html +python -m sphinx -v -b doctest -d .tox/docs_doctrees docs html +python -m sphinx -v -b linkcheck -d .tox/docs_doctrees docs html ``` ```` ````` \ No newline at end of file diff --git a/docs/developer/index.md b/docs/developer/index.md index aab4772..9dc534a 100644 --- a/docs/developer/index.md +++ b/docs/developer/index.md @@ -1,4 +1,4 @@ -# Developer documentation +# Development ```{include} ../../CONTRIBUTING.md ``` @@ -7,9 +7,7 @@ ```{toctree} --- -caption: About maxdepth: 2 -hidden: --- getting-started diff --git a/docs/index.md b/docs/index.md index 725ccf6..d3fbc0c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,5 +10,7 @@ hidden: --- +api-reference/index developer/index +about/index ``` diff --git a/pyproject.toml b/pyproject.toml index ea5e720..e0a4883 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ - "setuptools>=67", - "setuptools_scm[toml]>=7.0", + "setuptools>=68", + "setuptools_scm[toml]>=8.0", ] build-backend = "setuptools.build_meta" @@ -20,23 +20,36 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering", "Typing :: Typed", ] requires-python = ">=3.10" + +# IMPORTANT: +# Run 'tox -e deps' after making changes here. This will update requirement files. +# Make sure to list one dependency per line. dependencies = [ ] + dynamic = ["version"] [project.urls] "Bug Tracker" = "https://github.com/physicscore/thermoblock/issues" +"Documentation" = "https://physicscore.github.io/thermoblock" "Source" = "https://github.com/physicscore/thermoblock" [tool.setuptools_scm] [tool.pytest.ini_options] minversion = "7.0" -addopts = "-ra -v" +addopts = """ +--strict-config +--strict-markers +--import-mode=importlib +-ra +-v +""" testpaths = "tests" filterwarnings = [ "error", @@ -52,6 +65,7 @@ skip-string-normalization = true [tool.isort] skip_gitignore = true profile = "black" +known_first_party = ["thermoblock"] [tool.mypy] strict = true @@ -61,5 +75,4 @@ enable_error_code = [ "redundant-expr", "truthy-bool", ] -show_error_codes = true warn_unreachable = true diff --git a/requirements/base.in b/requirements/base.in index 24ce15a..8a4200d 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -1 +1,6 @@ numpy +# 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! + diff --git a/requirements/base.txt b/requirements/base.txt index dd97ab3..ca8effd 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -5,5 +5,5 @@ # # pip-compile-multi # -numpy==1.25.1 +numpy==1.26.4 # via -r base.in diff --git a/requirements/basetest.in b/requirements/basetest.in new file mode 100644 index 0000000..e4a48b2 --- /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/basetest.txt b/requirements/basetest.txt new file mode 100644 index 0000000..c8f8e17 --- /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.1 + # via pytest +iniconfig==2.0.0 + # via pytest +packaging==24.0 + # via pytest +pluggy==1.5.0 + # via pytest +pytest==8.1.1 + # via -r basetest.in +tomli==2.0.1 + # via pytest diff --git a/requirements/ci.txt b/requirements/ci.txt index 7a2fd01..58abf9f 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -5,52 +5,52 @@ # # pip-compile-multi # -cachetools==5.3.1 +cachetools==5.3.3 # via tox -certifi==2023.5.7 +certifi==2024.2.2 # via requests -chardet==5.1.0 +chardet==5.2.0 # via tox -charset-normalizer==3.2.0 +charset-normalizer==3.3.2 # via requests colorama==0.4.6 # via tox -distlib==0.3.7 +distlib==0.3.8 # via virtualenv -filelock==3.12.2 +filelock==3.13.4 # via # tox # virtualenv -gitdb==4.0.10 +gitdb==4.0.11 # via gitpython -gitpython==3.1.32 +gitpython==3.1.43 # via -r ci.in -idna==3.4 +idna==3.7 # via requests -packaging==23.1 +packaging==24.0 # via # -r ci.in # pyproject-api # tox -platformdirs==3.9.1 +platformdirs==4.2.1 # via # tox # virtualenv -pluggy==1.2.0 +pluggy==1.5.0 # via tox -pyproject-api==1.5.3 +pyproject-api==1.6.1 # via tox requests==2.31.0 # via -r ci.in -smmap==5.0.0 +smmap==5.0.1 # via gitdb tomli==2.0.1 # via # pyproject-api # tox -tox==4.6.4 +tox==4.14.2 # via -r ci.in -urllib3==2.0.4 +urllib3==2.2.1 # via requests -virtualenv==20.24.1 +virtualenv==20.26.0 # via tox diff --git a/requirements/dev.in b/requirements/dev.in index c127881..53ddf47 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -1,9 +1,11 @@ -r base.in -r ci.in -r docs.in +-r mypy.in -r static.in -r test.in -r wheels.in +copier jupyterlab pip-compile-multi pre-commit diff --git a/requirements/dev.txt b/requirements/dev.txt index 0e98201..7cc5c02 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,4 @@ -# SHA1:9f5c5c1a75be1863132bb9005162f80b0264f17b +# SHA1:efd19a3a98c69fc3d6d6233ed855de7e4a208f74 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -8,68 +8,97 @@ -r base.txt -r ci.txt -r docs.txt +-r mypy.txt -r static.txt -r test.txt -r wheels.txt -anyio==3.7.1 - # via jupyter-server -argon2-cffi==21.3.0 +annotated-types==0.6.0 + # via pydantic +anyio==4.3.0 + # via + # httpx + # jupyter-server +argon2-cffi==23.1.0 # via jupyter-server argon2-cffi-bindings==21.2.0 # via argon2-cffi -arrow==1.2.3 +arrow==1.3.0 # via isoduration -async-lru==2.0.3 +async-lru==2.0.4 # via jupyterlab -cffi==1.15.1 +cffi==1.16.0 # via argon2-cffi-bindings -click==8.1.6 +click==8.1.7 # via # pip-compile-multi # pip-tools +copier==9.2.0 + # via -r dev.in +dunamai==1.20.0 + # via copier fqdn==1.5.1 # via jsonschema +funcy==2.0 + # via copier +h11==0.14.0 + # via httpcore +httpcore==1.0.5 + # via httpx +httpx==0.27.0 + # via jupyterlab isoduration==20.11.0 # via jsonschema -json5==0.9.14 +jinja2-ansible-filters==1.3.2 + # via copier +json5==0.9.25 # via jupyterlab-server jsonpointer==2.4 # via jsonschema -jsonschema[format-nongpl]==4.18.4 +jsonschema[format-nongpl]==4.21.1 # via # jupyter-events # jupyterlab-server # nbformat -jupyter-events==0.6.3 +jupyter-events==0.10.0 # via jupyter-server -jupyter-lsp==2.2.0 +jupyter-lsp==2.2.5 # via jupyterlab -jupyter-server==2.7.0 +jupyter-server==2.14.0 # via # jupyter-lsp # jupyterlab # jupyterlab-server # notebook-shim -jupyter-server-terminals==0.4.4 +jupyter-server-terminals==0.5.3 # via jupyter-server -jupyterlab==4.0.3 +jupyterlab==4.1.6 # via -r dev.in -jupyterlab-server==2.23.0 +jupyterlab-server==2.27.1 # via jupyterlab -notebook-shim==0.2.3 +notebook-shim==0.2.4 # via jupyterlab -overrides==7.3.1 +overrides==7.7.0 # via jupyter-server +pathspec==0.12.1 + # via copier pip-compile-multi==2.6.3 # via -r dev.in -pip-tools==7.1.0 +pip-tools==7.4.1 # via pip-compile-multi -prometheus-client==0.17.1 +plumbum==1.8.2 + # via copier +prometheus-client==0.20.0 # via jupyter-server -pycparser==2.21 +pycparser==2.22 # via cffi +pydantic==2.7.1 + # via copier +pydantic-core==2.18.2 + # via pydantic python-json-logger==2.0.7 # via jupyter-events +questionary==1.10.0 + # via copier rfc3339-validator==0.1.4 # via # jsonschema @@ -78,23 +107,27 @@ rfc3986-validator==0.1.1 # via # jsonschema # jupyter-events -send2trash==1.8.2 +send2trash==1.8.3 # via jupyter-server -sniffio==1.3.0 - # via anyio -terminado==0.17.1 +sniffio==1.3.1 + # via + # anyio + # httpx +terminado==0.18.1 # via # jupyter-server # jupyter-server-terminals toposort==1.10 # via pip-compile-multi +types-python-dateutil==2.9.0.20240316 + # via arrow uri-template==1.3.0 # via jsonschema webcolors==1.13 # via jsonschema -websocket-client==1.6.1 +websocket-client==1.8.0 # via jupyter-server -wheel==0.40.0 +wheel==0.43.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/docs.in b/requirements/docs.in index 5d5807a..e542e53 100644 --- a/requirements/docs.in +++ b/requirements/docs.in @@ -1,11 +1,10 @@ -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 diff --git a/requirements/docs.txt b/requirements/docs.txt index 95f3d00..ecfb97e 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,4 +1,4 @@ -# SHA1:c8d387b90560a2db42c26e33735a4f78ada867c3 +# SHA1:2175813590b5d31dc1cdf3e3c820f699647e9043 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -8,98 +8,94 @@ -r base.txt accessible-pygments==0.0.4 # via pydata-sphinx-theme -alabaster==0.7.13 +alabaster==0.7.16 # via sphinx -appnope==0.1.3 - # via - # ipykernel - # ipython -asttokens==2.2.1 +appnope==0.1.4 + # via ipykernel +asttokens==2.4.1 # via stack-data -attrs==23.1.0 +attrs==23.2.0 # via # jsonschema # referencing -autodoc-pydantic==1.9.0 - # via -r docs.in -babel==2.12.1 +babel==2.14.0 # via # pydata-sphinx-theme # sphinx -backcall==0.2.0 - # via ipython -beautifulsoup4==4.12.2 +beautifulsoup4==4.12.3 # via # nbconvert # pydata-sphinx-theme -bleach==6.0.0 +bleach==6.1.0 # via nbconvert -certifi==2023.5.7 +certifi==2024.2.2 # via requests -charset-normalizer==3.2.0 +charset-normalizer==3.3.2 # via requests -comm==0.1.3 +comm==0.2.2 # via ipykernel -debugpy==1.6.7 +debugpy==1.8.1 # via ipykernel decorator==5.1.1 # via ipython defusedxml==0.7.1 # via nbconvert -docutils==0.19 +docutils==0.21.2 # via # myst-parser # nbsphinx # pydata-sphinx-theme # sphinx -executing==1.2.0 +exceptiongroup==1.2.1 + # via ipython +executing==2.0.1 # via stack-data -fastjsonschema==2.17.1 +fastjsonschema==2.19.1 # via nbformat -idna==3.4 +idna==3.7 # via requests imagesize==1.4.1 # via sphinx -ipykernel==6.24.0 +ipykernel==6.29.4 # via -r docs.in -ipython==8.14.0 +ipython==8.23.0 # via # -r docs.in # ipykernel -jedi==0.18.2 +jedi==0.19.1 # via ipython -jinja2==3.1.2 +jinja2==3.1.3 # via # myst-parser # nbconvert # nbsphinx # sphinx -jsonschema==4.18.4 +jsonschema==4.21.1 # via nbformat -jsonschema-specifications==2023.7.1 +jsonschema-specifications==2023.12.1 # via jsonschema -jupyter-client==8.3.0 +jupyter-client==8.6.1 # via # ipykernel # nbclient -jupyter-core==5.3.1 +jupyter-core==5.7.2 # via # ipykernel # jupyter-client # nbclient # nbconvert # nbformat -jupyterlab-pygments==0.2.2 +jupyterlab-pygments==0.3.0 # via nbconvert markdown-it-py==3.0.0 # via # mdit-py-plugins # myst-parser -markupsafe==2.1.3 +markupsafe==2.1.5 # via # jinja2 # nbconvert -matplotlib-inline==0.1.6 +matplotlib-inline==0.1.7 # via # ipykernel # ipython @@ -107,73 +103,69 @@ mdit-py-plugins==0.4.0 # via myst-parser mdurl==0.1.2 # via markdown-it-py -mistune==3.0.1 +mistune==3.0.2 # via nbconvert -myst-parser==2.0.0 +myst-parser==3.0.0 # via -r docs.in -nbclient==0.8.0 +nbclient==0.10.0 # via nbconvert -nbconvert==7.7.2 +nbconvert==7.16.3 # via nbsphinx -nbformat==5.9.1 +nbformat==5.10.4 # via # nbclient # nbconvert # nbsphinx -nbsphinx==0.9.2 +nbsphinx==0.9.3 # via -r docs.in -nest-asyncio==1.5.6 +nest-asyncio==1.6.0 # via ipykernel -packaging==23.1 +packaging==24.0 # via # ipykernel # nbconvert # pydata-sphinx-theme # sphinx -pandocfilters==1.5.0 +pandocfilters==1.5.1 # via nbconvert -parso==0.8.3 +parso==0.8.4 # via jedi -pexpect==4.8.0 - # via ipython -pickleshare==0.7.5 +pexpect==4.9.0 # via ipython -platformdirs==3.9.1 +platformdirs==4.2.1 # via jupyter-core -prompt-toolkit==3.0.39 +prompt-toolkit==3.0.43 # via ipython -psutil==5.9.5 +psutil==5.9.8 # via ipykernel ptyprocess==0.7.0 # via pexpect pure-eval==0.2.2 # via stack-data -pydantic==1.10.11 - # via autodoc-pydantic -pydata-sphinx-theme==0.13.3 +pydata-sphinx-theme==0.15.2 # via -r docs.in -pygments==2.15.1 +pygments==2.17.2 # via # accessible-pygments # ipython # nbconvert # pydata-sphinx-theme # sphinx -python-dateutil==2.8.2 +python-dateutil==2.9.0.post0 # via jupyter-client pyyaml==6.0.1 # via myst-parser -pyzmq==25.1.0 +pyzmq==26.0.2 # via # ipykernel # jupyter-client -referencing==0.30.0 +referencing==0.35.0 # via # jsonschema # jsonschema-specifications requests==2.31.0 # via sphinx -rpds-py==0.9.2 +rpds-py==0.18.0 # via # jsonschema # referencing @@ -184,45 +176,46 @@ six==1.16.0 # python-dateutil snowballstemmer==2.2.0 # via sphinx -soupsieve==2.4.1 +soupsieve==2.5 # via beautifulsoup4 -sphinx==6.2.1 +sphinx==7.3.7 # 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 +sphinx-autodoc-typehints==2.1.0 # via -r docs.in sphinx-copybutton==0.5.2 # via -r docs.in -sphinx-design==0.4.1 +sphinx-design==0.5.0 # via -r docs.in -sphinxcontrib-applehelp==1.0.4 +sphinxcontrib-applehelp==1.0.8 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.6 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.5 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.7 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.10 # via sphinx -stack-data==0.6.2 +stack-data==0.6.3 # via ipython -tinycss2==1.2.1 +tinycss2==1.3.0 # via nbconvert -tornado==6.3.2 +tomli==2.0.1 + # via sphinx +tornado==6.4 # via # ipykernel # jupyter-client -traitlets==5.9.0 +traitlets==5.14.3 # via # comm # ipykernel @@ -234,13 +227,13 @@ traitlets==5.9.0 # nbconvert # nbformat # nbsphinx -typing-extensions==4.7.1 +typing-extensions==4.11.0 # via - # pydantic + # ipython # pydata-sphinx-theme -urllib3==2.0.4 +urllib3==2.2.1 # via requests -wcwidth==0.2.6 +wcwidth==0.2.13 # via prompt-toolkit webencodings==0.5.1 # via diff --git a/requirements/make_base.py b/requirements/make_base.py new file mode 100644 index 0000000..1e1f48e --- /dev/null +++ b/requirements/make_base.py @@ -0,0 +1,67 @@ +import sys +from argparse import ArgumentParser +from pathlib import Path +from typing import List + +import tomli + +parser = ArgumentParser() +parser.add_argument( + "--nightly", + default="", + help="List of dependencies to install from main branch for nightly tests, " + "separated by commas.", +) +args = parser.parse_args() + +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) + dependencies = pyproject["project"].get("dependencies") + if dependencies is None: + raise RuntimeError("No dependencies found in pyproject.toml") + dependencies = [dep.strip().strip('"') for dep in dependencies] + +write_dependencies("base", dependencies) + + +def as_nightly(repo: str) -> str: + if "/" in repo: + org, repo = repo.split("/") + 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" + return "-".join([base, version, version, suffix]) + 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 += [as_nightly(arg) for arg in nightly] + +write_dependencies("nightly", nightly_dependencies) diff --git a/requirements/mypy.in b/requirements/mypy.in new file mode 100644 index 0000000..5027d8c --- /dev/null +++ b/requirements/mypy.in @@ -0,0 +1,2 @@ +-r test.in +mypy diff --git a/requirements/mypy.txt b/requirements/mypy.txt new file mode 100644 index 0000000..15e9ad7 --- /dev/null +++ b/requirements/mypy.txt @@ -0,0 +1,14 @@ +# SHA1:859ef9c15e5e57c6c91510133c01f5751feee941 +# +# This file is autogenerated by pip-compile-multi +# To update, run: +# +# pip-compile-multi +# +-r test.txt +mypy==1.10.0 + # via -r mypy.in +mypy-extensions==1.0.0 + # via mypy +typing-extensions==4.11.0 + # via mypy diff --git a/requirements/nightly.in b/requirements/nightly.in new file mode 100644 index 0000000..6b1ebcc --- /dev/null +++ b/requirements/nightly.in @@ -0,0 +1,4 @@ +-r basetest.in +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! + diff --git a/requirements/nightly.txt b/requirements/nightly.txt new file mode 100644 index 0000000..a98564b --- /dev/null +++ b/requirements/nightly.txt @@ -0,0 +1,8 @@ +# SHA1:e8b11c1210855f07eaedfbcfb3ecd1aec3595dee +# +# This file is autogenerated by pip-compile-multi +# To update, run: +# +# pip-compile-multi +# +-r basetest.txt diff --git a/requirements/static.txt b/requirements/static.txt index e422a06..fef06bd 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -5,23 +5,23 @@ # # pip-compile-multi # -cfgv==3.3.1 +cfgv==3.4.0 # via pre-commit -distlib==0.3.7 +distlib==0.3.8 # via virtualenv -filelock==3.12.2 +filelock==3.13.4 # via virtualenv -identify==2.5.25 +identify==2.5.36 # via pre-commit nodeenv==1.8.0 # via pre-commit -platformdirs==3.9.1 +platformdirs==4.2.1 # via virtualenv -pre-commit==3.3.3 +pre-commit==3.7.0 # via -r static.in pyyaml==6.0.1 # via pre-commit -virtualenv==20.24.1 +virtualenv==20.26.0 # via pre-commit # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/test.in b/requirements/test.in index 1cf404d..7b40979 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/requirements/test.txt b/requirements/test.txt index e5af3c0..3c7454d 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.2 - # via pytest -iniconfig==2.0.0 - # via pytest -packaging==23.1 - # via pytest -pluggy==1.2.0 - # via pytest -pytest==7.4.0 - # via -r test.in -tomli==2.0.1 - # via pytest +-r basetest.txt diff --git a/requirements/wheels.txt b/requirements/wheels.txt index ea0610f..ff60a18 100644 --- a/requirements/wheels.txt +++ b/requirements/wheels.txt @@ -5,11 +5,13 @@ # # pip-compile-multi # -build==0.10.0 +build==1.2.1 # via -r wheels.in -packaging==23.1 +packaging==24.0 # via build pyproject-hooks==1.0.0 # via build tomli==2.0.1 - # via build + # via + # build + # pyproject-hooks diff --git a/setup.cfg b/setup.cfg index 0253a40..1ba190c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,15 +1,3 @@ -[options] -package_dir = - = src -packages = find: -include_package_data = True - -[options.packages.find] -where = src - -[options.package_data] -thermoblock = py.typed - [flake8] # See https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length max-line-length = 88 diff --git a/src/thermoblock/__init__.py b/src/thermoblock/__init__.py index a5a3b9c..df1de96 100644 --- a/src/thermoblock/__init__.py +++ b/src/thermoblock/__init__.py @@ -8,3 +8,5 @@ __version__ = importlib.metadata.version(__package__ or __name__) except importlib.metadata.PackageNotFoundError: __version__ = "0.0.0" + +del importlib diff --git a/src/thermoblock/py.typed b/src/thermoblock/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/tests/package_test.py b/tests/package_test.py index cd04d8c..bea221d 100644 --- a/tests/package_test.py +++ b/tests/package_test.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Physicscore contributors (https://github.com/physicscore) +# Copyright (c) 2024 Physicscore contributors (https://github.com/physicscore) import thermoblock as pkg diff --git a/tox.ini b/tox.ini index 3ceb5ca..ba9b1f3 100644 --- a/tox.ini +++ b/tox.ini @@ -6,22 +6,25 @@ isolated_build = true deps = -r requirements/test.txt setenv = JUPYTER_PLATFORM_DIRS = 1 -commands = pytest +commands = pytest {posargs} [testenv:docs] description = invoke sphinx-build to build the HTML docs -deps = - {posargs:} - -r requirements/docs.txt +deps = -r requirements/docs.txt allowlist_externals=find -setenv = - {[testenv]setenv} - # Search directory for confuse for custom config enabling plopp plotting - SCIPPDIR={toxinidir}{/}docs{/}buildconfig commands = python -m sphinx -j2 -v -b html -d {toxworkdir}/docs_doctrees docs html python -m sphinx -j2 -v -b doctest -d {toxworkdir}/docs_doctrees docs html find html -type f -name "*.ipynb" -not -path "html/_sources/*" -delete +[testenv:releasedocs] +description = invoke sphinx-build to build the HTML docs from a released version +skip_install = true +deps = + thermoblock=={posargs} + {[testenv:docs]deps} +allowlist_externals={[testenv:docs]allowlist_externals} +commands = {[testenv:docs]commands} + [testenv:linkcheck] description = Run Sphinx linkcheck deps = -r requirements/docs.txt @@ -37,9 +40,17 @@ allowlist_externals = sh # either the different formatters can't agree on a format or that static analysis failed. commands = sh -c 'pre-commit run -a || (echo "" && pre-commit run -a)' +[testenv:mypy] +description = Type checking (mypy) +deps = -r requirements/mypy.txt +commands = python -m mypy . + [testenv:deps] description = Update dependencies by running pip-compile-multi -deps = pip-compile-multi +deps = + pip-compile-multi + tomli skip_install = true changedir = requirements -commands = pip-compile-multi -d . +commands = python ./make_base.py + pip-compile-multi -d . --backtracking