From cf4af969641c032585707d01a951b1836dd3b7d6 Mon Sep 17 00:00:00 2001 From: Martin Reuter Date: Sat, 10 Oct 2026 13:00:51 +0200 Subject: [PATCH 1/4] Drop setup.py, the changelog and Python 3.10, add Python 3.14 and check docstrings with ruff --- .github/workflows/build.yml | 3 ++- .github/workflows/code-style.yml | 2 -- .github/workflows/pytest.yml | 10 +++++-- doc/changes/authors.inc | 4 --- doc/changes/index.rst | 7 ----- doc/changes/latest.rst | 45 -------------------------------- doc/changes/latest.rst.template | 38 --------------------------- doc/conf.py | 4 --- doc/index.rst | 1 - lapy/utils/_config.py | 2 -- lapy/utils/_imports.py | 1 - pyproject.toml | 30 ++++++++++----------- setup.py | 3 --- tutorials/README.rst | 2 -- 14 files changed, 24 insertions(+), 128 deletions(-) delete mode 100644 doc/changes/authors.inc delete mode 100644 doc/changes/index.rst delete mode 100644 doc/changes/latest.rst delete mode 100644 doc/changes/latest.rst.template delete mode 100644 setup.py delete mode 100644 tutorials/README.rst diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ff6930a..36a9b789 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,8 +14,9 @@ jobs: strategy: fail-fast: false matrix: + # a pure Python package: oldest and newest Python on every OS is enough os: [ubuntu, macos, windows] - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.11", "3.14"] name: ${{ matrix.os }} - py${{ matrix.python-version }} runs-on: ${{ matrix.os }}-latest defaults: diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 2303f33e..c426506e 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -28,7 +28,5 @@ jobs: run: ruff check . - name: Run codespell uses: codespell-project/actions-codespell@master - - name: Run pydocstyle - run: pydocstyle . - name: Run bibclean run: bibclean-check doc/references.bib diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 336a84b8..ea60388f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -18,8 +18,14 @@ jobs: strategy: fail-fast: false matrix: + # oldest and newest Python on every OS, the versions in between on ubuntu only os: [ubuntu, macos, windows] - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.11", "3.14"] + include: + - os: ubuntu + python-version: "3.12" + - os: ubuntu + python-version: "3.13" name: ${{ matrix.os }} - py${{ matrix.python-version }} runs-on: ${{ matrix.os }}-latest defaults: @@ -41,7 +47,7 @@ jobs: - name: Run pytest run: pytest lapy --cov=lapy --cov-report=xml --cov-config=pyproject.toml - name: Upload to codecov - if: ${{ matrix.os == 'ubuntu' && matrix.python-version == '3.10' && github.repository == 'Deep-MI/LaPy' }} + if: ${{ matrix.os == 'ubuntu' && matrix.python-version == '3.14' && github.repository == 'Deep-MI/LaPy' }} uses: codecov/codecov-action@v7 with: files: ./coverage.xml diff --git a/doc/changes/authors.inc b/doc/changes/authors.inc deleted file mode 100644 index f119074b..00000000 --- a/doc/changes/authors.inc +++ /dev/null @@ -1,4 +0,0 @@ -.. _Andreas Girodi: https://github.com/agirodi -.. _Kersten Diers: https://github.com/kdiers -.. _Martin Reuter: https://github.com/m-reuter -.. _Mathieu Scheltienne: https://github.com/mscheltienne diff --git a/doc/changes/index.rst b/doc/changes/index.rst deleted file mode 100644 index 5a3d80d8..00000000 --- a/doc/changes/index.rst +++ /dev/null @@ -1,7 +0,0 @@ -Changelog -========= - -.. toctree:: - :titlesonly: - - latest.rst diff --git a/doc/changes/latest.rst b/doc/changes/latest.rst deleted file mode 100644 index f233aa13..00000000 --- a/doc/changes/latest.rst +++ /dev/null @@ -1,45 +0,0 @@ -.. NOTE: we use cross-references to highlight new functions and classes. - Please follow the examples below, so the changelog page will have a link to - the function/class documentation. - -.. NOTE: there are 3 separate sections for changes, based on type: - - "Enhancements" for new features - - "Bugs" for bug fixes - - "API changes" for backward-incompatible changes - -.. NOTE: You can use the :pr:`xx` and :issue:`xx` role to x-ref to a GitHub PR - or issue from this project. - -.. include:: ./authors.inc - -.. _latest: - -Version 1.0 -=========== - -API changes ------------ - -- Classes: TriaMesh, TetMesh, and Solver are still available directly at top level and imported directly from lapy. -- Mesh IO: mesh classes have been extended with IO class member functions and TriaIO and TetIO have been deprecated. Use read\_* and write\_* class members to load and write mehses, for example, TriaMesh.read_vtk() to import a VTK triangle mesh file. This simplifies IO greatly. -- Module names have been changed to comply with PEP8 conventions (lower case). For example, DiffGeo to diffgeo, FuncIO to io, and Plot to plot, etc. - -Bugs ----- - -- Fixed numpy deprecation issue in import_vfunc and import_ev functions. - -Enhancements ------------- - -- Comply with the numpy convention for docstrings (by `Andreas Girodi`_, `Kersten Diers`_ and `Martin Reuter`_ in :pr:`19` and :pr:`21`) -- Add initial documentation build (by `Mathieu Scheltienne`_ in :pr:`22`) - - -Authors -------- - -* `Andreas Girodi`_ -* `Kersten Diers`_ -* `Martin Reuter`_ -* `Mathieu Scheltienne`_ diff --git a/doc/changes/latest.rst.template b/doc/changes/latest.rst.template deleted file mode 100644 index 1c74fabf..00000000 --- a/doc/changes/latest.rst.template +++ /dev/null @@ -1,38 +0,0 @@ -.. NOTE: we use cross-references to highlight new functions and classes. - Please follow the examples below, so the changelog page will have a link to - the function/class documentation. - -.. NOTE: there are 3 separate sections for changes, based on type: - - "Enhancements" for new features - - "Bugs" for bug fixes - - "API changes" for backward-incompatible changes - -.. NOTE: You can use the :pr:`xx` and :issue:`xx` role to x-ref to a GitHub PR - or issue from this project. - -.. include:: ./authors.inc - -.. _latest: - -Version x.x -=========== - -Enhancements ------------- - -- xxx - -Bugs ----- - -- xxx - -API and behavior changes ------------------------- - -- xxx - -Authors -------- - -* `Mathieu Scheltienne`_ diff --git a/doc/conf.py b/doc/conf.py index 23f8571c..dc02e550 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -47,7 +47,6 @@ "sphinx_copybutton", "sphinx_design", "sphinx_gallery.gen_gallery", - "sphinx_issues", "nbsphinx", "IPython.sphinxext.ipython_console_highlighting", ] @@ -124,9 +123,6 @@ } intersphinx_timeout = 5 -# -- sphinx-issues ----------------------------------------------------------- -issues_github_path = gh_url.split("https://github.com/")[-1] - # -- autosectionlabels ------------------------------------------------------- autosectionlabel_prefix_document = True diff --git a/doc/index.rst b/doc/index.rst index fcd740f2..5c44bfdb 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -8,7 +8,6 @@ api/index tutorials/index - changes/index LaPy is an `open-source Python package `_ for differential geometry on triangle and tetrahedra meshes. It includes an FEM solver to diff --git a/lapy/utils/_config.py b/lapy/utils/_config.py index 774d8b1a..dce29d0a 100644 --- a/lapy/utils/_config.py +++ b/lapy/utils/_config.py @@ -20,7 +20,6 @@ def sys_info(fid: IO | None = None, developer: bool = False): developer : bool, default=False If True, display information about optional dependencies. """ - ljust = 26 out = partial(print, end="", file=fid) package = __package__.split(".")[0] @@ -82,7 +81,6 @@ def _list_dependencies_info(out: Callable, ljust: int, dependencies: list[str]): list of dependencies """ - for dep in dependencies: # handle dependencies with version specifiers specifiers_pattern = r"(~=|==|!=|<=|>=|<|>|===)" diff --git a/lapy/utils/_imports.py b/lapy/utils/_imports.py index 198f6443..fb531675 100644 --- a/lapy/utils/_imports.py +++ b/lapy/utils/_imports.py @@ -45,7 +45,6 @@ def import_optional_dependency( ImportError dependency not found; see raise_error """ - package_name = INSTALL_MAPPING.get(name) install_name = package_name if package_name is not None else name diff --git a/pyproject.toml b/pyproject.toml index d4cbf257..fe183b17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,5 @@ [build-system] -requires = [ - 'setuptools >= 61.0.0', - 'numpy>=2', -] +requires = ['setuptools >= 77.0.0'] build-backend = 'setuptools.build_meta' [project] @@ -12,7 +9,7 @@ description = 'A package for differential geometry on meshes (Laplace, FEM)' readme = 'README.md' license = 'MIT' license-files = ['LICENSE'] -requires-python = '>=3.10' +requires-python = '>=3.11' authors = [ {name = 'Martin Reuter', email = 'martin.reuter@dzne.de'}, ] @@ -35,10 +32,10 @@ classifiers = [ 'Operating System :: Unix', 'Operating System :: MacOS', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Natural Language :: English', 'Intended Audience :: Science/Research', ] @@ -68,7 +65,6 @@ doc = [ 'sphinx-copybutton', 'sphinx-design', 'sphinx-gallery', - 'sphinx-issues', 'nbsphinx', 'IPython', # For syntax highlighting in notebooks 'ipykernel', @@ -76,7 +72,6 @@ doc = [ style = [ 'bibclean', 'codespell', - 'pydocstyle[toml]', 'ruff', ] test = [ @@ -111,13 +106,6 @@ include-package-data = false include = ['lapy*'] exclude = ['lapy*tests'] -[tool.pydocstyle] -convention = 'numpy' -ignore-decorators = '(copy_doc|property|.*setter|.*getter|pyqtSlot|Slot)' -match = '^(?!setup|__init__|test_).*\.py' -match-dir = '^lapy.*' -add_ignore = 'D100,D104,D107' - [tool.ruff] line-length = 120 extend-exclude = [ @@ -134,12 +122,22 @@ select = [ "UP", # pyupgrade "B", # flake8-bugbear "I", # isort + "D", # pydocstyle # "SIM", # flake8-simplify ] +ignore = [ + "D100", # missing docstring in public module + "D104", # missing docstring in public package + "D107", # missing docstring in __init__ +] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"] -"examples/*" = ["E501"] # ignore too long lines in example ipynb +"examples/*" = ["E501", "D"] # long lines and no docstrings in example ipynb +"**/tests/*" = ["D"] [tool.codespell] ignore-words-list = 'coo,daty' diff --git a/setup.py b/setup.py deleted file mode 100644 index 60684932..00000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/tutorials/README.rst b/tutorials/README.rst deleted file mode 100644 index 0c7e28c3..00000000 --- a/tutorials/README.rst +++ /dev/null @@ -1,2 +0,0 @@ -Tutorials -========= From e037b4a2b95416ec4e5e535bd75ddde75f3eb8ae Mon Sep 17 00:00:00 2001 From: Martin Reuter Date: Sat, 10 Oct 2026 13:18:18 +0200 Subject: [PATCH 2/4] Drop the unused sphinx-gallery setup and the duplicate full extra --- doc/_templates/autosummary/class.rst | 3 --- doc/_templates/autosummary/function.rst | 3 --- doc/conf.py | 25 ------------------------- examples/README.rst | 2 -- pyproject.toml | 5 ----- 5 files changed, 38 deletions(-) delete mode 100644 examples/README.rst diff --git a/doc/_templates/autosummary/class.rst b/doc/_templates/autosummary/class.rst index 3322b321..e73a3605 100644 --- a/doc/_templates/autosummary/class.rst +++ b/doc/_templates/autosummary/class.rst @@ -5,6 +5,3 @@ .. autoclass:: {{ objname }} :members: :inherited-members: - -.. minigallery:: {{ fullname }} - :add-heading: diff --git a/doc/_templates/autosummary/function.rst b/doc/_templates/autosummary/function.rst index cdbecc4f..27ca987d 100644 --- a/doc/_templates/autosummary/function.rst +++ b/doc/_templates/autosummary/function.rst @@ -3,6 +3,3 @@ .. currentmodule:: {{ module }} .. autofunction:: {{ objname }} - -.. minigallery:: {{ fullname }} - :add-heading: diff --git a/doc/conf.py b/doc/conf.py index dc02e550..e4ab9fcd 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -9,8 +9,6 @@ from importlib import import_module from typing import Dict, Optional -from sphinx_gallery.sorting import FileNameSortKey - import lapy # -- project information ----------------------------------------------------- @@ -46,7 +44,6 @@ "sphinxcontrib.bibtex", "sphinx_copybutton", "sphinx_design", - "sphinx_gallery.gen_gallery", "nbsphinx", "IPython.sphinxext.ipython_console_highlighting", ] @@ -57,7 +54,6 @@ "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints", - "tutorials/examples/README.rst", ] # Sphinx will warn about all references where the target cannot be found. @@ -65,11 +61,6 @@ nitpick_ignore = [] show_warning_types = True -suppress_warnings = [ - # Ignore new warning in Sphinx 7.3.0 while pickling environment: - # WARNING: cannot cache unpickable configuration value: 'sphinx_gallery_conf' - "config.cache", -] # A list of ignored prefixes for module index sorting. modindex_common_prefix = [f"{package}."] @@ -237,22 +228,6 @@ def linkcode_resolve(domain: str, info: Dict[str, str]) -> Optional[str]: return url -# -- sphinx-gallery ---------------------------------------------------------- -sphinx_gallery_conf = { - "backreferences_dir": "generated/backreferences", - "doc_module": (f"{package}",), - "examples_dirs": ["../examples"], - "exclude_implicit_doc": {}, # set - "filename_pattern": r"\d{2}_", - "gallery_dirs": ["generated/examples"], - "line_numbers": False, - "plot_gallery": True, - "reference_url": {f"{package}": None}, - "remove_config_comments": True, - "show_memory": True, - "within_subsection_order": FileNameSortKey, -} - # -- Pandoc requirement ------------------------------------------------------ # Note: Pandoc must be installed on the system for nbsphinx to convert notebooks. # Install via system package manager (apt, brew, etc.) or conda/mamba. diff --git a/examples/README.rst b/examples/README.rst deleted file mode 100644 index 0c7e28c3..00000000 --- a/examples/README.rst +++ /dev/null @@ -1,2 +0,0 @@ -Tutorials -========= diff --git a/pyproject.toml b/pyproject.toml index fe183b17..08efceb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,13 +58,11 @@ chol = [ doc = [ 'furo!=2023.8.17', 'matplotlib', - 'memory-profiler', 'numpydoc', 'sphinx>=7.0,!=7.2.*', 'sphinxcontrib-bibtex', 'sphinx-copybutton', 'sphinx-design', - 'sphinx-gallery', 'nbsphinx', 'IPython', # For syntax highlighting in notebooks 'ipykernel', @@ -86,9 +84,6 @@ all = [ 'lapy[style]', 'lapy[test]', ] -full = [ - 'lapy[all]', -] [project.urls] homepage = 'https://Deep-MI.github.io/LaPy/dev/index.html' From 08cd859428c8f9fa42842b6a485c527fb1835921 Mon Sep 17 00:00:00 2001 From: Martin Reuter Date: Sat, 10 Oct 2026 13:27:05 +0200 Subject: [PATCH 3/4] Set minimum dependency versions and test them in CI --- .github/workflows/pytest.yml | 25 +++++++++++++++++++++++++ pyproject.toml | 10 +++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ea60388f..93981467 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -57,3 +57,28 @@ jobs: verbose: true # optional (default = false) token: ${{ secrets.CODECOV_TOKEN }} #slug: deep-mi/LaPy + + pytest-min: + # the lowest versions of the dependencies that pyproject.toml allows + timeout-minutes: 30 + name: ubuntu - py3.11 - minimum versions + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - name: Checkout repository + uses: actions/checkout@v7 + - name: Setup Python 3.11 + uses: actions/setup-python@v7 + with: + python-version: "3.11" + - name: Install package with minimum dependencies + run: | + python -m pip install --progress-bar off uv + uv pip install --system pytest pytest-timeout + uv pip install --system --resolution lowest-direct . + - name: Display system information + run: lapy-sys_info --developer + - name: Run pytest + run: pytest lapy diff --git a/pyproject.toml b/pyproject.toml index 08efceb7..0f030887 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,11 +40,11 @@ classifiers = [ 'Intended Audience :: Science/Research', ] dependencies = [ - 'nibabel', - 'numpy>=1.21', - 'plotly', - 'psutil', - 'scipy!=1.13.0', + 'nibabel>=4.0', + 'numpy>=1.23.2', + 'plotly>=5.0', + 'psutil>=5.9', + 'scipy>=1.9.2,!=1.13.0', ] [project.optional-dependencies] From a3bd402d9a9a6930f302cf2a30bb1318c6d90b3f Mon Sep 17 00:00:00 2001 From: Martin Reuter Date: Sat, 10 Oct 2026 13:41:36 +0200 Subject: [PATCH 4/4] Build the package once and run pytest on pyproject.toml changes --- .github/workflows/build.yml | 27 ++++++++++----------------- .github/workflows/pytest.yml | 4 ++++ 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36a9b789..f980eeed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,40 +5,33 @@ concurrency: on: pull_request: push: - branches: [main] + branches: [ main ] workflow_dispatch: jobs: build: + # a pure Python package builds one wheel for every platform; pytest installs it on each OS timeout-minutes: 10 - strategy: - fail-fast: false - matrix: - # a pure Python package: oldest and newest Python on every OS is enough - os: [ubuntu, macos, windows] - python-version: ["3.11", "3.14"] - name: ${{ matrix.os }} - py${{ matrix.python-version }} - runs-on: ${{ matrix.os }}-latest + name: ubuntu - py3.14 + runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout repository uses: actions/checkout@v7 - - name: Setup Python ${{ matrix.python-version }} + - name: Setup Python 3.14 uses: actions/setup-python@v7 with: - python-version: ${{ matrix.python-version }} + python-version: "3.14" - name: Install dependencies run: | - python -m pip install --progress-bar off --upgrade pip setuptools wheel - python -m pip install --progress-bar off .[build] - - name: Test package install - run: lapy-sys_info - - name: Remove package install - run: python -m pip uninstall -yq lapy + python -m pip install --progress-bar off --upgrade pip + python -m pip install --progress-bar off build twine - name: Build package run: python -m build + - name: Check package metadata + run: twine check --strict dist/* - name: Install sdist run: pip install ./dist/*.tar.gz - name: Test sdist install diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 93981467..6abf12a0 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -6,10 +6,14 @@ on: pull_request: paths: - '**.py' + - 'pyproject.toml' + - '.github/workflows/pytest.yml' push: branches: [main] paths: - '**.py' + - 'pyproject.toml' + - '.github/workflows/pytest.yml' workflow_dispatch: jobs: