Skip to content

Commit 773c463

Browse files
authored
Fix using .A instead of .toarray() (#61)
* Fix using `.A` instead of `.toarray()` * Fix typos * Fix class template in the docs * Use BLAS/LAPACK from conda * Update GA's versions * Update pre-commits * Fix `pyproject.toml` * Switch to `myst-nb` * Use amsmath * Remove `enviroment.yaml` * Drop `tox-conda` * Use conda in CI * Remove `tox` from CI * Don't skip on `mpi4py` * Install petsc/slepc * Specify correct shell * Change env name * Fix conda CI * Update codecov action * Update coverage * Add codecov token to CI
1 parent 0ce99c3 commit 773c463

13 files changed

Lines changed: 82 additions & 103 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,36 @@ jobs:
3030
slepc: 'slepc'
3131

3232
steps:
33-
- uses: actions/checkout@v3
34-
- name: Set up Python ${{ matrix.python }}
35-
uses: actions/setup-python@v4
33+
- uses: actions/checkout@v4
34+
- name: Set up Conda
35+
uses: conda-incubator/setup-miniconda@v3.1.0
3636
with:
3737
python-version: ${{ matrix.python }}
38+
auto-update-conda: true
39+
channels: conda-forge,defaults
3840

3941
- name: Install pip dependencies
42+
shell: bash -el {0}
4043
run: |
4144
python -m pip install --upgrade pip
42-
pip install tox codecov
45+
pip install '.[test]'
46+
47+
- name: Install conda dependencies
48+
if: ${{ matrix.slepc == 'slepc' }}
49+
shell: bash -el {0}
50+
run: |
51+
conda install petsc slepc petsc4py slepc4py mpi4py
4352
4453
- name: Test
54+
shell: bash -el {0}
4555
run: |
46-
tox -e py${{ matrix.python }}-${{ matrix.slepc }} -vv
47-
env:
48-
PLATFORM: ${{ matrix.os }}
56+
python -m pytest --cov --cov-config=tox.ini --no-cov-on-fail --cov-report=xml --cov-report=term-missing:skip-covered -vv
4957
5058
- name: Upload coverage
51-
uses: codecov/codecov-action@v3
59+
uses: codecov/codecov-action@v4
5260
with:
61+
fail_ci_if_error: false
5362
files: ./coverage.xml
54-
flags: unittests
5563
name: ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.slepc }}
56-
env_vars: OS,PYTHON
57-
fail_ci_if_error: false
64+
token: ${{ secrets.CODECOV_TOKEN }}
5865
verbose: true

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
lint:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
- name: Set up Python 3.10
21-
uses: actions/setup-python@v4
21+
uses: actions/setup-python@v5
2222
with:
2323
python-version: '3.10'
2424

2525
- name: Cache pre-commit
26-
uses: actions/cache@v3
26+
uses: actions/cache@v4
2727
with:
2828
path: ~/.cache/pre-commit
2929
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('**/.pre-commit-config.yaml') }}

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: Set up Python
13-
uses: actions/setup-python@v4
13+
uses: actions/setup-python@v5
1414
with:
1515
python-version: '3.10'
1616

.pre-commit-config.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,41 @@ default_language_version:
44
default_stages:
55
- commit
66
- push
7-
minimum_pre_commit_version: 2.9.0
7+
minimum_pre_commit_version: 3.0.0
88
repos:
99
- repo: https://github.com/pre-commit/mirrors-mypy
10-
rev: v1.3.0
10+
rev: v1.13.0
1111
hooks:
1212
- id: mypy
1313
additional_dependencies: [numpy>=1.20.0, scipy>=1.6.0]
1414
- repo: https://github.com/psf/black
15-
rev: 23.3.0
15+
rev: 24.10.0
1616
hooks:
1717
- id: black
1818
additional_dependencies: [toml]
1919
- repo: https://github.com/timothycrosley/isort
20-
rev: 5.12.0
20+
rev: 5.13.2
2121
hooks:
2222
- id: isort
2323
additional_dependencies: [toml]
2424
args: [--order-by-type]
2525
- repo: https://github.com/asottile/yesqa
26-
rev: v1.4.0
26+
rev: v1.5.0
2727
hooks:
2828
- id: yesqa
2929
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]
3030
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
31-
rev: v2.9.0
31+
rev: v2.14.0
3232
hooks:
3333
- id: pretty-format-yaml
3434
args: [--autofix, --indent, '4', --preserve-quotes]
3535
- repo: https://github.com/pre-commit/pre-commit-hooks
36-
rev: v4.4.0
36+
rev: v5.0.0
3737
hooks:
3838
- id: detect-private-key
3939
- id: check-merge-conflict
4040
- id: check-ast
4141
- id: check-symlinks
42-
- id: check-added-large-files
4342
- id: check-executables-have-shebangs
4443
- id: fix-encoding-pragma
4544
args: [--remove]
@@ -56,12 +55,12 @@ repos:
5655
- id: check-toml
5756
- id: requirements-txt-fixer
5857
- repo: https://github.com/pycqa/flake8
59-
rev: 6.0.0
58+
rev: 7.1.1
6059
hooks:
6160
- id: flake8
6261
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]
6362
- repo: https://github.com/myint/autoflake
64-
rev: v2.1.1
63+
rev: v2.3.1
6564
hooks:
6665
- id: autoflake
6766
args: [--in-place, --remove-all-unused-imports, --remove-unused-variable, --ignore-init-module-imports]
@@ -72,12 +71,12 @@ repos:
7271
name: Check executable files use .sh extension
7372
types: [shell, executable]
7473
- repo: https://github.com/asottile/blacken-docs
75-
rev: 1.13.0
74+
rev: 1.19.1
7675
hooks:
7776
- id: blacken-docs
7877
additional_dependencies: [black==23.1.0]
7978
- repo: https://github.com/asottile/pyupgrade
80-
rev: v3.4.0
79+
rev: v3.19.0
8180
hooks:
8281
- id: pyupgrade
8382
args: [--py3-plus, --py37-plus]
@@ -91,6 +90,6 @@ repos:
9190
- id: rst-directive-colons
9291
- id: rst-inline-touching-normal
9392
- repo: https://github.com/PyCQA/doc8
94-
rev: v1.1.1
93+
rev: v1.1.2
9594
hooks:
9695
- id: doc8

docs/requirements.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
-r ../requirements.txt
2-
nbsphinx>=0.8
3-
sphinx>=5
4-
sphinx-autodoc-annotation
5-
sphinx-autodoc-typehints>=1.10.3
2+
myst-nb
3+
sphinx>=8
64
sphinx-copybutton
7-
sphinx_last_updated_by_git
5+
sphinx_autodoc_typehints
86
sphinx_rtd_theme
97
sphinxcontrib-spelling
Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
:github_url: {{ fullname }}
22

3-
{{ fullname | escape | underline}}
3+
{{ fullname | escape | underline }}
44

55
.. currentmodule:: {{ module }}
66

77
.. autoclass:: {{ objname }}
8+
{% block methods %}
9+
{%- if methods %}
10+
.. rubric:: {{ _('Methods') }}
811

9-
{% block methods %}
10-
{% if methods %}
11-
.. rubric:: Methods
12+
.. autosummary::
13+
:toctree: .
14+
{% for item in methods %}
15+
{%- if item not in ['__init__', 'tree_flatten', 'tree_unflatten', 'bind', 'tabulate', 'module_paths'] %}
16+
~{{ name }}.{{ item }}
17+
{%- endif %}
18+
{%- endfor %}
19+
{%- endif %}
20+
{%- endblock %}
21+
{% block attributes %}
22+
{%- if attributes %}
23+
.. rubric:: {{ _('Attributes') }}
1224

13-
.. autosummary::
14-
:toctree: .
15-
{% for item in methods %}
16-
{%- if item != '__init__' %}
17-
~{{ fullname }}.{{ item }}
18-
{%- endif -%}
19-
{%- endfor %}
20-
{% endif %}
21-
{% endblock %}
22-
23-
{% block attributes %}
24-
{% if attributes %}
25-
.. rubric:: Attributes
26-
27-
.. autosummary::
28-
:toctree: .
29-
{% for item in attributes %}
30-
~{{ fullname }}.{{ item }}
31-
{%- endfor %}
32-
{% endif %}
33-
{% endblock %}
25+
.. autosummary::
26+
:toctree: .
27+
{% for item in attributes %}
28+
~{{ name }}.{{ item }}
29+
{%- endfor %}
30+
{%- endif %}
31+
{% endblock %}

docs/source/conf.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"sphinx_autodoc_typehints",
4848
"sphinx_copybutton",
4949
"typed_returns",
50-
"nbsphinx",
50+
"myst_nb",
5151
]
5252
intersphinx_mapping = {
5353
"python": ("https://docs.python.org/3", None),
@@ -63,7 +63,7 @@
6363
# This pattern also affects html_static_path and html_extra_path.
6464
exclude_patterns = ["build", "**.ipynb_checkpoints"]
6565

66-
source_suffix = ".rst"
66+
source_suffix = {".rst": "restructuredtext", ".ipynb": "myst-nb"}
6767
add_function_parentheses = True
6868

6969
# -- Options for HTML output -------------------------------------------------
@@ -86,29 +86,21 @@
8686
napoleon_use_admonition_for_references = False
8787
todo_include_todos = False
8888

89-
# binder
90-
nbsphinx_highlight_language = "python3"
91-
nbsphinx_execute_arguments = [
92-
"--InlineBackend.figure_formats={'png', 'pdf'}", # correct figure resize
93-
"--InlineBackend.rc={'figure.dpi': 96}",
89+
# myst-nb
90+
myst_heading_anchors = 2
91+
nb_execution_mode = "off"
92+
nb_mime_priority_overrides = [("spelling", "text/plain", 0)]
93+
myst_enable_extensions = [
94+
"colon_fence",
95+
"amsmath",
96+
"dollarmath",
9497
]
95-
nbsphinx_prolog = r"""
96-
{% set docname = 'docs/source/' + env.doc2path(env.docname, base=None) %}
97-
.. raw:: html
98-
99-
<div class="note">
100-
Interactive version
101-
<a href="https://mybinder.org/v2/gh/msmdev/pygpcca/{{ env.config.release|e }}?filepath={{ docname|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom">
102-
</a>
103-
</div>
104-
""" # noqa: E501
10598

10699
# spelling
107100
spelling_lang = "en_US"
108101
spelling_warning = True
109102
spelling_word_list_filename = "spelling_wordlist.txt"
110103
spelling_add_pypi_package_names = True
111-
spelling_show_suggestions = True
112104
# see: https://pyenchant.github.io/pyenchant/api/enchant.tokenize.html
113105
spelling_filters = ["enchant.tokenize.URLFilter", "enchant.tokenize.EmailFilter"]
114106

@@ -119,6 +111,7 @@
119111
"https://pubs.acs.org/doi/abs/10.1021/acs.jctc.8b00079",
120112
"https://doi.org/10.1063/1.5064530",
121113
]
114+
linkcheck_report_timeouts_as_broken = False
122115

123116
# Add any paths that contain custom static files (such as style sheets) here,
124117
# relative to this directory. They are copied after the builtin static files,

environment.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[build-system]
2-
requires = ['setuptools', 'setuptools_scm', 'wheel']
3-
build-backend = 'setuptools.build_meta'
2+
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
46

57
[tool.black]
68
line-length = 120

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"slepc4py>=3.18.0",
4343
],
4444
dev=["pre-commit>=2.9.0", "bump2version"],
45-
test=["tox>=3.20.1"],
45+
test=["pytest", "pytest-cov", "pytest-mock", "codecov"],
4646
docs=[
4747
line.strip()
4848
for line in (Path("docs") / "requirements.txt").read_text("utf-8").splitlines()

0 commit comments

Comments
 (0)