From 467223c22d70bfd64a3dfe2dd36408d537648f59 Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Thu, 6 Apr 2023 21:41:38 -0700 Subject: [PATCH 1/7] BUG: Bump pytest version in dev Python 3.10 broke pytest <6.2.4: https://github.com/pytest-dev/pytest/issues/8539#issuecomment-832083778 Fix implemented https://github.com/pytest-dev/pytest/pull/8540 --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index e8b14221..fd6261a3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ -e . -r requirements.txt -pytest~=6.0.0 +pytest>=6.2.4 black pytest-cov pytest-lazy-fixture From e19ea64707f89fa719c7edc046fb44968a31d9a1 Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Thu, 6 Apr 2023 21:59:28 -0700 Subject: [PATCH 2/7] BUG: Change scs version requirement specifier Fixes #176 scs==2.1.4 caused test failures. Tests pass on 2.1.3 and after 2.1.4 --- requirements-dev.txt | 1 - requirements.txt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index fd6261a3..4cf985bc 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -22,5 +22,4 @@ jupyter_contrib_nbextensions pandas seaborn ipython -scs<=2.1.4 gurobipy>=9.5.1,<10.0 diff --git a/requirements.txt b/requirements.txt index 8d4a756c..7bf0e0c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ scipy derivative matplotlib cmake +scs>=2.1,!=2.1.4 From ae6d40ac09d00b4fbe5910f99025d48d1dea1505 Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Fri, 7 Apr 2023 00:10:39 -0700 Subject: [PATCH 3/7] ENH: Bump sphinx version, add pandoc version, bump RTD python version. Old sphinx version spec is very old. Both RTD and CI interpret sphinx>=2.0.0 as 5.0.3, so it seems reasonable that requiring this for developers would only serve to prevent doc build mistakes. Also, added pandoc as a dev requirement, because it is a requirement for building docs. It has an external binary requirement (pandoc) which can't be accomodated in a requirements file. So I added info to the readme.rst Bump python version to 3.8 in RTD since 3.7 is approaching EOL FWIW, was confused about pandoc so added an issue to RTFD: https://github.com/readthedocs/readthedocs.org/issues/10229 --- .readthedocs.yml | 2 +- README.rst | 8 ++++++++ requirements-dev.txt | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index ba75fe2e..0c16f2be 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,6 +4,6 @@ sphinx: configuration: docs/conf.py python: - version: 3.7 + version: 3.8 install: - requirements: requirements-dev.txt diff --git a/README.rst b/README.rst index d796946f..5d4ae5b7 100644 --- a/README.rst +++ b/README.rst @@ -204,6 +204,14 @@ you can run the following to automatically reformat your staged code Note that you will then need to re-stage any changes ``pre-commit`` made to your code. +Building documentation requires [pandoc](https://pandoc.org/installing.html) as a separate install. Once installed, run + +.. code-block:: bash + + python -m sphinx -TEb html -d _build/doctrees -D language=en . ./build + +Or check the build step in the most recent CI run or [RTD build](https://readthedocs.org/projects/pysindy/builds/). + There are a number of SINDy variants and advanced functionality that would be great to implement in future releases: 1. Bayesian SINDy, for instance that from Hirsh, Seth M., David A. Barajas-Solano, and J. Nathan Kutz. "Sparsifying Priors for Bayesian Uncertainty Quantification in Model Discovery." arXiv preprint arXiv:2107.02107 (2021). diff --git a/requirements-dev.txt b/requirements-dev.txt index 4cf985bc..08defeea 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -12,7 +12,7 @@ setuptools_scm_git_archive jupyter jupytext notebook -sphinx >= 2 +sphinx==5.3.0 sphinxcontrib-apidoc sphinx_rtd_theme pre-commit @@ -20,6 +20,7 @@ hypothesis nbsphinx jupyter_contrib_nbextensions pandas +pandoc seaborn ipython gurobipy>=9.5.1,<10.0 From 4c0523667636cc25746454c37147e7bb63e59463 Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Fri, 7 Apr 2023 00:11:37 -0700 Subject: [PATCH 4/7] CI: Bump python versions in CI Also, python versions should be strings or else 3.10==3.1 according to GH Actions. --- .github/workflows/main.yml | 6 +++--- .github/workflows/release.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6302b39e..30c590b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,10 +8,10 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set up Python 3.7 + - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: "3.8" - name: Linting run: | pip install pre-commit @@ -23,7 +23,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.7, 3.8] + python-version: ["3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94631af0..c4e6d143 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: 3.7 + python-version: "3.8" - name: Install dependencies run: pip install wheel - name: Build package From 6d63fb35c9353e125ae4f89cb6e59fa534748783 Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Fri, 7 Apr 2023 00:28:20 -0700 Subject: [PATCH 5/7] BUG: Fix links to notebooks in doc build. Fixes #298 --- examples/README.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/README.rst b/examples/README.rst index 4ab9d917..fdbe6868 100644 --- a/examples/README.rst +++ b/examples/README.rst @@ -3,7 +3,7 @@ PySINDy Examples This directory showcases the following examples of PySINDy in action. -`Feature overview `_ +`Feature overview <./1_feature_overview/example.html>`_ ----------------------------------------------------------------------------------------------------------- This notebook gives an almost exhaustive overview of the different features available in PySINDy. It's a good reference for how to set various options and work with different types of datasets. @@ -11,7 +11,7 @@ This notebook gives an almost exhaustive overview of the different features avai --------------------------------------------------------------------------------------------------------------------- We recommend that people new to SINDy start here. We give a gentle introduction to the SINDy method and how different steps in the algorithm are represented in PySINDy. We also show how to use PySINDy to learn a model for a simple linear differential equation. -`Original paper `_ +`Original paper <./3_original_paper/example.html>`_ ------------------------------------------------------------------------------------------------------- This notebook uses PySINDy to reproduce the examples in the `original SINDy paper `_. Namely, it applies PySINDy to the following problems: @@ -23,7 +23,7 @@ This notebook uses PySINDy to reproduce the examples in the `original SINDy pape * Logistic map * Hopf system -`Scikit-learn compatibility `_ +`Scikit-learn compatibility <./4_scikit_learn_compatibility/example.html>`_ ------------------------------------------------------------------------------------------------------------------------------- Shows how PySINDy interfaces with various Scikit-learn objects. @@ -34,40 +34,40 @@ Shows how PySINDy interfaces with various Scikit-learn objects. --------------------------------------------------------------------------------------------------------- Explore the differentiation methods available in PySINDy on pure differentiation problems and as components in the SINDy algorithm. -`Deeptime compatibility `_ +`Deeptime compatibility <./6_deeptime_compatibility/example.html>`_ ------------------------------------------------------------------------------------------------------------------------ See a demonstration of PySINDy objects designed to conform to the `Deeptime `_ API. -`Plasma physics `_ +`Plasma physics <./7_plasma_example/example.html>`_ ---------------------------------------------------------------------------------------------- Use the ``ConstrainedSR3`` optimizer to build a constrained model for the temporal POD modes of a plasma simulation. -`Trapping SINDy `_ +`Trapping SINDy <./8_trapping_sindy_paper_examples/example.html>`_ ----------------------------------------------------------------------------------------------------------- This notebook applies the ``TrappingSR3`` optimizer to various canonical fluid systems., proposed in this paper: Kaptanoglu, Alan A., et al. "Promoting global stability in data-driven models of quadratic nonlinear dynamics." Physical Review Fluids 6.9 (2021): 094401. A preprint is found here ``_. -`SINDyPI `_ +`SINDyPI <./9_sindypi_with_sympy/example.html>`_ ---------------------------------------------------------------------------------------------- This notebook applies the ``SINDyPI`` optimizer to a simple implicit ODE and was originally proposed in this paper: Kaheman, Kadierdan, J. Nathan Kutz, and Steven L. Brunton. "SINDy-PI: a robust algorithm for parallel implicit sparse identification of nonlinear dynamics." Proceedings of the Royal Society A 476.2242 (2020): 20200279. -`PDEFIND `_ +`PDEFIND <./10_PDEFIND_examples/example.html>`_ ---------------------------------------------------------------------------------------------- This notebook applies the PDEFIND algorithm (SINDy for PDE identification) to a number of PDEs, and was originally proposed in this paper: Rudy, Samuel H., et al. "Data-driven discovery of partial differential equations." Science Advances 3.4 (2017): e1602614. -`Greedy Algorithms `_ +`Greedy Algorithms <./11_SSR_FROLS_examples/example.html>`_ ----------------------------------------------------------------------------------------------------- This notebook uses the step-wise sparse regression (SSR) and forward-regression orthogonal least-squares (FROLS) algorithms, which are greedy algorithms that iteratively truncate (or add) one nonzero coefficient at each algorithm iteration. -`Weak formulation SINDy `_ +`Weak formulation SINDy <./12_weakform_SINDy_examples/example.html>`_ -------------------------------------------------------------------------------------------------------------- This notebook uses SINDy to identify the weak-formulation of a system of ODEs or PDEs, adding significant robustness against noise in the data. -`Model ensembles `_ +`Model ensembles <./13_ensembling/example.html>`_ ---------------------------------------------------------------------------------------------- This notebook uses sub-sampling of the data and sub-sampling of the SINDy library to generate many models, and the user can choose how to average or otherwise combine these models together. This tends to make SINDy more robust against noisy data. -`Cavity flow `_ +`Cavity flow <./14_cavity_flow/example.html>`_ ---------------------------------------------------------------------------------------------- Demonstrates the use of SINDy to learn a model for the quasiperiodic dynamics in a shear-driven cavity at Re=7500, following Callaham, Brunton, and Loiseau (2021), preprint available here ``_. From dfe5410e0a68394573cb433ca5c06728aed292a5 Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Fri, 7 Apr 2023 01:27:04 -0700 Subject: [PATCH 6/7] CI: Clear GH actions deprecations warnings. Fixes #305 Previous CI used versions of actions that will be disabled on 31st May 2023. --- .github/workflows/draft-pdf.yml | 4 ++-- .github/workflows/main.yml | 12 ++++++------ .github/workflows/release.yml | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/draft-pdf.yml b/.github/workflows/draft-pdf.yml index 8e7fde16..0dec7ffe 100644 --- a/.github/workflows/draft-pdf.yml +++ b/.github/workflows/draft-pdf.yml @@ -6,7 +6,7 @@ jobs: name: Paper Draft steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Build draft PDF uses: openjournals/openjournals-draft-action@master with: @@ -14,7 +14,7 @@ jobs: # This should be the path to the paper within your repo. paper-path: docs/JOSS2/paper.md - name: Upload - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v3 with: name: paper # This is the output path where Pandoc will write the compiled diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 30c590b6..c2270519 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,9 +7,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: "3.8" - name: Linting @@ -26,9 +26,9 @@ jobs: python-version: ["3.8", "3.9", "3.10"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -46,7 +46,7 @@ jobs: run: | pytest test --cov=pysindy --cov-report=xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml @@ -55,7 +55,7 @@ jobs: pip install papermill cd examples papermill --report-mode 1_feature_overview.ipynb out.json - - uses: actions/cache@v1 + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4e6d143..f8df6e4c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v1 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: "3.8" - name: Install dependencies @@ -20,7 +20,7 @@ jobs: - name: Build package run: python setup.py sdist bdist_wheel - name: Upload package - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1.8.5 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} From 2ab4301c4b32c18bc5146a3b416bf70f7dc4ebcf Mon Sep 17 00:00:00 2001 From: Jake Stevens-Haas <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Fri, 7 Apr 2023 01:39:46 -0700 Subject: [PATCH 7/7] DOC: Add trove classifiers for newer pythons --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index f881007c..9b11dffc 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,8 @@ "Programming Language :: Python", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License",