diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f384b14..f9cea62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,29 +30,36 @@ jobs: slepc: 'slepc' steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Conda + uses: conda-incubator/setup-miniconda@v3.1.0 with: python-version: ${{ matrix.python }} + auto-update-conda: true + channels: conda-forge,defaults - name: Install pip dependencies + shell: bash -el {0} run: | python -m pip install --upgrade pip - pip install tox codecov + pip install '.[test]' + + - name: Install conda dependencies + if: ${{ matrix.slepc == 'slepc' }} + shell: bash -el {0} + run: | + conda install petsc slepc petsc4py slepc4py mpi4py - name: Test + shell: bash -el {0} run: | - tox -e py${{ matrix.python }}-${{ matrix.slepc }} -vv - env: - PLATFORM: ${{ matrix.os }} + python -m pytest --cov --cov-config=tox.ini --no-cov-on-fail --cov-report=xml --cov-report=term-missing:skip-covered -vv - name: Upload coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: + fail_ci_if_error: false files: ./coverage.xml - flags: unittests name: ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.slepc }} - env_vars: OS,PYTHON - fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} verbose: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7cad946..52a52a1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,14 +16,14 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' - name: Cache pre-commit - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pre-commit key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3ead81d..47cfccc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,9 +8,9 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dbe616f..0e43eea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,42 +4,41 @@ default_language_version: default_stages: - commit - push -minimum_pre_commit_version: 2.9.0 +minimum_pre_commit_version: 3.0.0 repos: - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.3.0 + rev: v1.13.0 hooks: - id: mypy additional_dependencies: [numpy>=1.20.0, scipy>=1.6.0] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.10.0 hooks: - id: black additional_dependencies: [toml] - repo: https://github.com/timothycrosley/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort additional_dependencies: [toml] args: [--order-by-type] - repo: https://github.com/asottile/yesqa - rev: v1.4.0 + rev: v1.5.0 hooks: - id: yesqa additional_dependencies: [flake8-tidy-imports, flake8-docstrings, flake8-rst-docstrings, flake8-comprehensions, flake8-bugbear, flake8-logging-format, flake8-blind-except, flake8-builtins, flake8-pytest-style, flake8-string-format] - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.9.0 + rev: v2.14.0 hooks: - id: pretty-format-yaml args: [--autofix, --indent, '4', --preserve-quotes] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: detect-private-key - id: check-merge-conflict - id: check-ast - id: check-symlinks - - id: check-added-large-files - id: check-executables-have-shebangs - id: fix-encoding-pragma args: [--remove] @@ -56,12 +55,12 @@ repos: - id: check-toml - id: requirements-txt-fixer - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 7.1.1 hooks: - id: flake8 additional_dependencies: [flake8-tidy-imports, flake8-docstrings, flake8-rst-docstrings, flake8-comprehensions, flake8-bugbear, flake8-logging-format, flake8-blind-except, flake8-builtins, flake8-pytest-style, flake8-string-format] - repo: https://github.com/myint/autoflake - rev: v2.1.1 + rev: v2.3.1 hooks: - id: autoflake args: [--in-place, --remove-all-unused-imports, --remove-unused-variable, --ignore-init-module-imports] @@ -72,12 +71,12 @@ repos: name: Check executable files use .sh extension types: [shell, executable] - repo: https://github.com/asottile/blacken-docs - rev: 1.13.0 + rev: 1.19.1 hooks: - id: blacken-docs additional_dependencies: [black==23.1.0] - repo: https://github.com/asottile/pyupgrade - rev: v3.4.0 + rev: v3.19.0 hooks: - id: pyupgrade args: [--py3-plus, --py37-plus] @@ -91,6 +90,6 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/PyCQA/doc8 - rev: v1.1.1 + rev: v1.1.2 hooks: - id: doc8 diff --git a/docs/requirements.txt b/docs/requirements.txt index 66c7686..82c147f 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,9 +1,7 @@ -r ../requirements.txt -nbsphinx>=0.8 -sphinx>=5 -sphinx-autodoc-annotation -sphinx-autodoc-typehints>=1.10.3 +myst-nb +sphinx>=8 sphinx-copybutton -sphinx_last_updated_by_git +sphinx_autodoc_typehints sphinx_rtd_theme sphinxcontrib-spelling diff --git a/docs/source/_templates/autosummary/class.rst b/docs/source/_templates/autosummary/class.rst index 81e6503..57e2365 100644 --- a/docs/source/_templates/autosummary/class.rst +++ b/docs/source/_templates/autosummary/class.rst @@ -1,33 +1,31 @@ :github_url: {{ fullname }} -{{ fullname | escape | underline}} +{{ fullname | escape | underline }} .. currentmodule:: {{ module }} .. autoclass:: {{ objname }} + {% block methods %} + {%- if methods %} + .. rubric:: {{ _('Methods') }} - {% block methods %} - {% if methods %} - .. rubric:: Methods + .. autosummary:: + :toctree: . + {% for item in methods %} + {%- if item not in ['__init__', 'tree_flatten', 'tree_unflatten', 'bind', 'tabulate', 'module_paths'] %} + ~{{ name }}.{{ item }} + {%- endif %} + {%- endfor %} + {%- endif %} + {%- endblock %} + {% block attributes %} + {%- if attributes %} + .. rubric:: {{ _('Attributes') }} - .. autosummary:: - :toctree: . - {% for item in methods %} - {%- if item != '__init__' %} - ~{{ fullname }}.{{ item }} - {%- endif -%} - {%- endfor %} - {% endif %} - {% endblock %} - - {% block attributes %} - {% if attributes %} - .. rubric:: Attributes - - .. autosummary:: - :toctree: . - {% for item in attributes %} - ~{{ fullname }}.{{ item }} - {%- endfor %} - {% endif %} - {% endblock %} + .. autosummary:: + :toctree: . + {% for item in attributes %} + ~{{ name }}.{{ item }} + {%- endfor %} + {%- endif %} + {% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py index d70915d..eb0eb06 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -47,7 +47,7 @@ "sphinx_autodoc_typehints", "sphinx_copybutton", "typed_returns", - "nbsphinx", + "myst_nb", ] intersphinx_mapping = { "python": ("https://docs.python.org/3", None), @@ -63,7 +63,7 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = ["build", "**.ipynb_checkpoints"] -source_suffix = ".rst" +source_suffix = {".rst": "restructuredtext", ".ipynb": "myst-nb"} add_function_parentheses = True # -- Options for HTML output ------------------------------------------------- @@ -86,29 +86,21 @@ napoleon_use_admonition_for_references = False todo_include_todos = False -# binder -nbsphinx_highlight_language = "python3" -nbsphinx_execute_arguments = [ - "--InlineBackend.figure_formats={'png', 'pdf'}", # correct figure resize - "--InlineBackend.rc={'figure.dpi': 96}", +# myst-nb +myst_heading_anchors = 2 +nb_execution_mode = "off" +nb_mime_priority_overrides = [("spelling", "text/plain", 0)] +myst_enable_extensions = [ + "colon_fence", + "amsmath", + "dollarmath", ] -nbsphinx_prolog = r""" -{% set docname = 'docs/source/' + env.doc2path(env.docname, base=None) %} -.. raw:: html - -