diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ec36a184a0..8659364801 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,7 +12,7 @@ updates: labels: ["skip news", "dependencies"] - package-ecosystem: "pip" - directory: "." + directory: "/requirements" schedule: interval: "daily" target-branch: "dependencies" diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 8e5fc65013..319c8d831d 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # `towncrier check` runs `git diff --name-only origin/main...`, which # needs a non-shallow clone. diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 87ada56689..0ccedf2942 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -19,7 +19,7 @@ jobs: shell: bash -l {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8adee4eb48..3294345014 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.11 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index bcd1bc769f..cb6b726eb2 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -71,7 +71,7 @@ jobs: os: "windows-latest" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Python 3.10 uses: actions/setup-python@v4 @@ -80,7 +80,7 @@ jobs: - name: Set up QEMU # Needed to build aarch64 wheels if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: all @@ -90,7 +90,7 @@ jobs: python -m cibuildwheel --only ${{ matrix.cibw-only }} --print-build-identifiers - name: Build wheels - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.16.2 with: only: ${{ matrix.cibw-only }} @@ -103,7 +103,7 @@ jobs: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build sdist run: pipx run build --sdist diff --git a/.github/workflows/rebase_dependencies.yml b/.github/workflows/rebase_dependencies.yml index 041e1e8b8d..6ffb0a7db5 100644 --- a/.github/workflows/rebase_dependencies.yml +++ b/.github/workflows/rebase_dependencies.yml @@ -8,7 +8,7 @@ jobs: name: Rebase `dependencies` with `master` runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # otherwise, you will fail to push refs to dest repo ref: dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2ce0bcb46f..3d7fae6392 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,7 +72,7 @@ jobs: os: "windows-latest" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Python 3.10 uses: actions/setup-python@v4 @@ -81,7 +81,7 @@ jobs: - name: Set up QEMU # Needed to build aarch64 wheels if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 with: platforms: all @@ -91,7 +91,7 @@ jobs: python -m cibuildwheel --only ${{ matrix.cibw-only }} --print-build-identifiers - name: Build wheels - uses: pypa/cibuildwheel@v2.15.0 + uses: pypa/cibuildwheel@v2.16.2 with: only: ${{ matrix.cibw-only }} @@ -104,7 +104,7 @@ jobs: name: Build source distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build sdist run: pipx run build --sdist diff --git a/.github/workflows/test-notebooks.yml b/.github/workflows/test-notebooks.yml index c96cb45c24..1ea0cbf023 100644 --- a/.github/workflows/test-notebooks.yml +++ b/.github/workflows/test-notebooks.yml @@ -25,7 +25,7 @@ jobs: markers: ["slow", "not slow"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: mamba-org/setup-micromamba@v1 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0daf94ec5a..df2519a158 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: pytest-marker: ["slow", "not slow"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: mamba-org/setup-micromamba@v1 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8941a1a34..4fc546bb0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -61,7 +61,11 @@ repos: rev: 5.12.0 hooks: - id: isort - files: \.py$ + name: isort (python) + types: [python] + - id: isort + name: isort (cython) + types: [cython] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 diff --git a/.readthedocs.yaml b/.readthedocs.yaml index e1ee0b058f..1b93bc7e32 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,7 +12,6 @@ sphinx: python: install: - - requirements: docs/requirements.in + - requirements: docs/requirements.txt - method: pip path: . - system_packages: false diff --git a/MANIFEST.in b/MANIFEST.in index 1da938041e..c3400c3e4d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -13,6 +13,7 @@ recursive-include docs *.txt recursive-include landlab *.pyx *.pxd *.hpp recursive-include landlab README.md recursive-include landlab/data * +recursive-include requirements *.md *.txt recursive-include tests *py recursive-include tests *.asc recursive-include tests *.dbf diff --git a/README.rst b/README.rst index 801d175c5c..bf5479de91 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,7 @@ :target: https://coveralls.io/r/landlab/landlab .. image:: https://mybinder.org/badge_logo.svg - :target: https://mybinder.org/v2/gh/landlab/landlab/release?filepath=notebooks/welcome.ipynb + :target: https://mybinder.org/v2/gh/landlab/landlab/master?filepath=notebooks/welcome.ipynb ======= Landlab @@ -107,11 +107,11 @@ Run on Binder To launch an instance of Binder and `explore the notebooks click here`_. -.. _explore the notebooks click here: https://mybinder.org/v2/gh/landlab/landlab/release?filepath=notebooks/welcome.ipynb +.. _explore the notebooks click here: https://mybinder.org/v2/gh/landlab/landlab/master?filepath=notebooks/welcome.ipynb To launch a Binder instance that goes straight to the `teaching notebooks click here`_. -.. _teaching notebooks click here: https://mybinder.org/v2/gh/landlab/landlab/release?filepath=notebooks/teaching/welcome_teaching.ipynb +.. _teaching notebooks click here: https://mybinder.org/v2/gh/landlab/landlab/master?filepath=notebooks/teaching/welcome_teaching.ipynb Run on EarthscapeHub ```````````````````` diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 4b415ddc06..0000000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,218 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile requirements.in -# -alabaster==0.7.13 - # via sphinx -asttokens==2.2.1 - # via stack-data -attrs==22.2.0 - # via jsonschema -babel==2.11.0 - # via sphinx -backcall==0.2.0 - # via ipython -beautifulsoup4==4.11.2 - # via - # furo - # nbconvert -bleach==6.0.0 - # via nbconvert -certifi==2023.7.22 - # via requests -charset-normalizer==3.0.1 - # via requests -click==8.1.3 - # via - # click-default-group - # towncrier -click-default-group==1.2.2 - # via towncrier -decorator==5.1.1 - # via ipython -defusedxml==0.7.1 - # via nbconvert -docutils==0.18.1 - # via - # nbsphinx - # sphinx - # sphinx-jinja -entrypoints==0.4 - # via -r docs/requirements.in -executing==1.2.0 - # via stack-data -fastjsonschema==2.16.2 - # via nbformat -furo==2023.8.19 - # via -r docs/requirements.in -idna==3.4 - # via requests -imagesize==1.4.1 - # via sphinx -incremental==22.10.0 - # via towncrier -ipython==8.14.0 - # via -r docs/requirements.in -jedi==0.18.2 - # via ipython -jinja2==3.1.2 - # via - # nbconvert - # nbsphinx - # sphinx - # sphinx-jinja - # towncrier -jsonschema==4.17.3 - # via nbformat -jupyter-client==8.3.0 - # via - # -r docs/requirements.in - # nbclient -jupyter-core==5.2.0 - # via - # jupyter-client - # nbclient - # nbconvert - # nbformat -jupyterlab-pygments==0.2.2 - # via nbconvert -markupsafe==2.1.2 - # via - # jinja2 - # nbconvert -matplotlib-inline==0.1.6 - # via ipython -mistune==2.0.5 - # via nbconvert -nbclient==0.7.2 - # via nbconvert -nbconvert==7.2.9 - # via nbsphinx -nbformat==5.9.2 - # via - # -r docs/requirements.in - # nbclient - # nbconvert - # nbsphinx -nbsphinx==0.9.3 - # via -r docs/requirements.in -packaging==23.0 - # via - # nbconvert - # sphinx -pandoc==2.3 - # via -r docs/requirements.in -pandocfilters==1.5.0 - # via nbconvert -parso==0.8.3 - # via jedi -pexpect==4.8.0 - # via ipython -pickleshare==0.7.5 - # via ipython -platformdirs==3.0.0 - # via jupyter-core -plumbum==1.8.1 - # via pandoc -ply==3.11 - # via pandoc -prompt-toolkit==3.0.36 - # via ipython -ptyprocess==0.7.0 - # via pexpect -pure-eval==0.2.2 - # via stack-data -pygments==2.15.0 - # via - # furo - # ipython - # nbconvert - # sphinx -pyrsistent==0.19.3 - # via jsonschema -python-dateutil==2.8.2 - # via jupyter-client -pytz==2022.7.1 - # via babel -pyzmq==25.0.0 - # via jupyter-client -requests==2.31.0 - # via sphinx -six==1.16.0 - # via - # asttokens - # bleach - # python-dateutil -snowballstemmer==2.2.0 - # via sphinx -soupsieve==2.4 - # via beautifulsoup4 -sphinx==7.2.4 - # via - # -r docs/requirements.in - # furo - # nbsphinx - # sphinx-basic-ng - # sphinx-copybutton - # sphinx-inline-tabs - # sphinx-jinja - # sphinxcontrib-serializinghtml - # sphinxcontrib-towncrier -sphinx-basic-ng==1.0.0b1 - # via furo -sphinx-copybutton==0.5.2 - # via -r docs/requirements.in -sphinx-inline-tabs==2023.4.21 - # via -r docs/requirements.in -sphinx-jinja==2.0.2 - # via -r docs/requirements.in -sphinxcontrib-applehelp==1.0.4 - # via sphinx -sphinxcontrib-devhelp==1.0.2 - # via sphinx -sphinxcontrib-htmlhelp==2.0.1 - # via sphinx -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.3 - # via sphinx -sphinxcontrib-serializinghtml==1.1.9 - # via sphinx -sphinxcontrib-towncrier==0.3.2a0 - # via -r docs/requirements.in -stack-data==0.6.2 - # via ipython -tabulate==0.9.0 - # via -r docs/requirements.in -tinycss2==1.2.1 - # via nbconvert -tomli==2.0.1 - # via -r docs/requirements.in -tornado==6.3.3 - # via - # -r docs/requirements.in - # jupyter-client -towncrier==23.6.0 - # via - # -r docs/requirements.in - # sphinxcontrib-towncrier -traitlets==5.9.0 - # via - # ipython - # jupyter-client - # jupyter-core - # matplotlib-inline - # nbclient - # nbconvert - # nbformat - # nbsphinx -urllib3==1.26.14 - # via requests -wcwidth==0.2.6 - # via prompt-toolkit -webencodings==0.5.1 - # via - # bleach - # tinycss2 diff --git a/docs/scipy-sphinx-theme b/docs/scipy-sphinx-theme deleted file mode 160000 index 47c5c8fc0d..0000000000 --- a/docs/scipy-sphinx-theme +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 47c5c8fc0df705d5953fb1ec5c0ccca225ce9f58 diff --git a/docs/source/development/contribution/develop_a_component.rst b/docs/source/development/contribution/develop_a_component.rst index 0e7d5c211d..f2e17ceb6d 100644 --- a/docs/source/development/contribution/develop_a_component.rst +++ b/docs/source/development/contribution/develop_a_component.rst @@ -20,7 +20,7 @@ Once you have installed Landlab (:ref:`developer install `) and :ref:`created your own branch `, you can start writing a Python script for your component. -See `this tutorial `_ +See `this tutorial `_ for instructions on the structure and content of your component code. See also `this example pull request `_, which shows you the common set of files (such as ``__init__.py`` and documentation @@ -63,7 +63,7 @@ For your new component, you should create a folder in - `'.my_component_name'` is the name of the python script. - `'MyComponent'` is as defined in the _name header of your python script - See `this tutorial `_ + See `this tutorial `_ on making a component for additional document requirements. In addition there are a number of recommendations and requirements for @@ -73,7 +73,7 @@ For your new component, you should create a folder in unit tests. The unit tests are run every time changes are pushed to the Landlab repository. They should go through every line of your code (e.g. test every possible scenario in if/else loops, exceptions, etc.). See - `the tutorial on making a component `_ + `the tutorial on making a component `_ for instructions about making docstring tests and the next section for more information about making the unit tests. diff --git a/docs/source/getting_started/10min.rst b/docs/source/getting_started/10min.rst index 0f7fd1120f..5245a02941 100644 --- a/docs/source/getting_started/10min.rst +++ b/docs/source/getting_started/10min.rst @@ -5,7 +5,7 @@ ********************* For a quick introduction to Landlab, check out `this tutorial on Binder -`_ +`_ showing its major features in the context of a 2D model for fault-scarp degradation. diff --git a/docs/source/getting_started/teach_yourself_landlab.rst b/docs/source/getting_started/teach_yourself_landlab.rst index c1960e6301..200f6341c4 100644 --- a/docs/source/getting_started/teach_yourself_landlab.rst +++ b/docs/source/getting_started/teach_yourself_landlab.rst @@ -4,7 +4,7 @@ Self-study course for learning to use Landlab in your research ============================================================== This course is entirely hosted in our Jupyter notebook tutorials. Here is a -link to the `syllabus `_ +link to the `syllabus `_ on Binder. If you have access to `EarthscapeHub`_ through class or CSDMS membership, diff --git a/docs/source/user_guide/build_a_model.rst b/docs/source/user_guide/build_a_model.rst index 8a3a24dff0..99f59c1d00 100644 --- a/docs/source/user_guide/build_a_model.rst +++ b/docs/source/user_guide/build_a_model.rst @@ -285,7 +285,7 @@ This means producing a storm series in Landlab is also very easy: Notice that the advantage of the generator is that it just stops when the desired number of events/time duration has expired! See the end of `this tutorial -`_ +`_ for an example of this generator in action. What exactly "…do the thing" consists of is up to you. You can either design diff --git a/docs/source/user_guide/components.rst b/docs/source/user_guide/components.rst index a5ae8ac379..159f36b34a 100644 --- a/docs/source/user_guide/components.rst +++ b/docs/source/user_guide/components.rst @@ -17,12 +17,12 @@ Landlab components exist as classes, and can be imported from To develop your own Landlab component, see :ref:`this page ` and -`this tutorial `_. +`this tutorial `_. Component Library Tutorial ---------------------------- For a tutorial introduction to using the component library, see -`here `_. +`here `_. Available Landlab components ---------------------------- diff --git a/docs/source/user_guide/examples.rst b/docs/source/user_guide/examples.rst index cb8d9c1c76..d47a07542f 100644 --- a/docs/source/user_guide/examples.rst +++ b/docs/source/user_guide/examples.rst @@ -26,7 +26,7 @@ Flexure .. image:: images/flexure.png :width: 300px :align: center - :target: https://mybinder.org/v2/gh/landlab/landlab/release?filepath=notebooks/tutorials/flexure/lots_of_loads.ipynb + :target: https://mybinder.org/v2/gh/landlab/landlab/master?filepath=notebooks/tutorials/flexure/lots_of_loads.ipynb Hydrograph of Changing Storm Intensity -------------------------------------- @@ -41,7 +41,7 @@ Topographic Elevation .. image:: images/topographic-elevation.png :width: 300px :align: center - :target: https://mybinder.org/v2/gh/landlab/landlab/release?filepath=notebooks/tutorials/component_tutorial/component_tutorial.ipynb + :target: https://mybinder.org/v2/gh/landlab/landlab/master?filepath=notebooks/tutorials/component_tutorial/component_tutorial.ipynb CA Transition ------------- diff --git a/docs/source/user_guide/faq.rst b/docs/source/user_guide/faq.rst index 068f60fa38..fa1aa94b2c 100644 --- a/docs/source/user_guide/faq.rst +++ b/docs/source/user_guide/faq.rst @@ -112,7 +112,7 @@ are some options: (3) assign the downstream value Look at this -`Tutorial `_ +`Tutorial `_ for all the Landlab mappers How do I test whether my grid is regular or irregular? @@ -137,7 +137,7 @@ The way to do this is: How do I modify boundary conditions for part of the grid where I know the coordinates? -------------------------------------------------------------------------------------- -See `this tutorial `_. +See `this tutorial `_. I am having trouble installing Landlab on Ubuntu without Anaconda. What is the fix? ----------------------------------------------------------------------------------- diff --git a/docs/source/user_guide/grid.rst b/docs/source/user_guide/grid.rst index 88d33d129e..b8951ba2b4 100644 --- a/docs/source/user_guide/grid.rst +++ b/docs/source/user_guide/grid.rst @@ -352,7 +352,7 @@ evaluated between pairs of adjacent nodes. ModelGrid makes these calculations easier for programmers by providing built-in functions to calculate gradients along links and allowing applications to associate an array of gradient values with their corresponding links or edges. The `tutorial examples -`_ +`_ illustrate how this capability can be used to create models of processes such as diffusion and overland flow. @@ -461,7 +461,7 @@ is one that joins either two core nodes, or one *core* and one *open boundary* node (Figure 3). You can use this distinction in models to implement closed boundaries by performing flow calculations only on active links, as seen in `this tutorial -`_. +`_. .. _bc_details: diff --git a/docs/source/user_guide/python_numpy_intro.rst b/docs/source/user_guide/python_numpy_intro.rst index 891e51446b..f7d7ee4e5d 100644 --- a/docs/source/user_guide/python_numpy_intro.rst +++ b/docs/source/user_guide/python_numpy_intro.rst @@ -84,7 +84,7 @@ the ``**`` operator. We have a very short tutorial on Python and NumPy from the point of view of Landlab (and the key differences with Matlab) -`here `_. +`here `_. NumPy, SciPy, and Efficient Coding Style ---------------------------------------- diff --git a/docs/source/user_guide/teaching_tutorials.rst b/docs/source/user_guide/teaching_tutorials.rst index 404a17cac9..9529694d00 100644 --- a/docs/source/user_guide/teaching_tutorials.rst +++ b/docs/source/user_guide/teaching_tutorials.rst @@ -23,7 +23,7 @@ laboratory assignments. However, they can be used to illustrate concepts on-the-fly in the classroom. The easiest way to see what is in the notebooks is through the -`Binder welcome page for the teaching notebooks `_. This also allows you to run the notebooks online. +`Binder welcome page for the teaching notebooks `_. This also allows you to run the notebooks online. The tutorials can also be run online on :ref:`EarthscapeHub `. diff --git a/docs/source/user_guide/tutorials.rst b/docs/source/user_guide/tutorials.rst index 6a2024a149..715ec8117e 100644 --- a/docs/source/user_guide/tutorials.rst +++ b/docs/source/user_guide/tutorials.rst @@ -14,14 +14,14 @@ Launch notebooks online ----------------------- Landlab Notebooks can be accessed online with the following link: -`Binder `_. +`Binder `_. Here the notebooks are provided within a binder online environment that includes Landlab. The welcome page on Binder provides onward links to most of our tutorials. If you're a newbie you might want to skip directly to a recommended syllabus for learning Landlab -`here `_. +`here `_. .. _tutorials_EarthscapeHub: diff --git a/environment.yml b/environment.yml index 06881b4cc1..45d7138776 100644 --- a/environment.yml +++ b/environment.yml @@ -5,4 +5,4 @@ dependencies: - landlab>=2.1 - pip - pip: - - -r requirements-notebooks.txt + - -r notebooks/requirements.in diff --git a/landlab/components/stream_power/cfuncs.pyx b/landlab/components/stream_power/cfuncs.pyx index 6910b88f40..874b34e4b5 100644 --- a/landlab/components/stream_power/cfuncs.pyx +++ b/landlab/components/stream_power/cfuncs.pyx @@ -4,6 +4,7 @@ cimport cython cimport numpy as np from scipy.optimize import newton + # suspect that the function _brentq is in c and thus this is the most effective # method for using the brentq method in cython. from scipy.optimize._zeros import _brentq as brentq diff --git a/news/1758.misc b/news/1758.misc new file mode 100644 index 0000000000..1cd14f4259 --- /dev/null +++ b/news/1758.misc @@ -0,0 +1,3 @@ + +Fixed an issue with *Landlab*'s environment file that caused an error when +trying to run the tutorial notebooks through *Binder*. diff --git a/news/1762.misc b/news/1762.misc new file mode 100644 index 0000000000..6a968b870f --- /dev/null +++ b/news/1762.misc @@ -0,0 +1,4 @@ + +Updated the *readthedocs* configuration file to exclude the +`now invalid `_ +``system_packages`` option. diff --git a/news/1763.misc b/news/1763.misc new file mode 100644 index 0000000000..8f204b32c4 --- /dev/null +++ b/news/1763.misc @@ -0,0 +1,4 @@ + +Updated the *isort* configuration to identify *landlab* as a first-party +package to prevent it from moving *landlab* imports into the third-party +section. diff --git a/news/1773.misc b/news/1773.misc new file mode 100644 index 0000000000..999d0333cd --- /dev/null +++ b/news/1773.misc @@ -0,0 +1,3 @@ + +Updated *dependabot* to only manage *Landlab* direct dependencies and changed +our CI to ensure we are running with those pinned dependencies. diff --git a/notebooks/requirements.txt b/notebooks/requirements.txt deleted file mode 100644 index 98c5fffed3..0000000000 --- a/notebooks/requirements.txt +++ /dev/null @@ -1,524 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile requirements.in -# -affine==2.4.0 - # via rasterio -anyio==3.6.2 - # via - # jupyter-server - # starlette -argon2-cffi==21.3.0 - # via - # jupyter-server - # nbclassic - # notebook -argon2-cffi-bindings==21.2.0 - # via argon2-cffi -arrow==1.2.3 - # via - # isoduration - # jinja2-time -asttokens==2.2.1 - # via stack-data -attrs==22.2.0 - # via - # jsonschema - # rasterio -backcall==0.2.0 - # via ipython -beautifulsoup4==4.11.2 - # via nbconvert -binaryornot==0.4.4 - # via cookiecutter -black==23.1.0 - # via bmipy -bleach==6.0.0 - # via - # nbconvert - # panel -bmi-topography==0.8.2 - # via -r requirements.in -bmipy==2.0 - # via bmi-topography -bokeh==2.4.3 - # via panel -cachetools==5.3.1 - # via solara -certifi==2023.7.22 - # via - # pyproj - # rasterio - # requests -cffi==1.15.1 - # via argon2-cffi-bindings -chardet==5.1.0 - # via binaryornot -charset-normalizer==3.0.1 - # via requests -click==8.1.3 - # via - # black - # bmi-topography - # bmipy - # click-plugins - # cligj - # cookiecutter - # dask - # mesa - # rasterio - # rich-click - # solara - # uvicorn -click-plugins==1.1.1 - # via rasterio -cligj==0.7.2 - # via rasterio -cloudpickle==2.2.1 - # via dask -colorcet==3.0.1 - # via holoviews -comm==0.1.2 - # via ipykernel -cookiecutter==2.1.1 - # via mesa -dask[array]==2023.8.1 - # via -r requirements.in -debugpy==1.6.6 - # via ipykernel -decorator==5.1.1 - # via ipython -defusedxml==0.7.1 - # via nbconvert -executing==1.2.0 - # via stack-data -fastjsonschema==2.16.2 - # via nbformat -filelock==3.12.2 - # via solara -fqdn==1.5.1 - # via jsonschema -fsspec==2023.1.0 - # via dask -h11==0.14.0 - # via uvicorn -holoviews==1.17.1 - # via -r requirements.in -humanize==4.8.0 - # via solara -idna==3.4 - # via - # anyio - # jsonschema - # requests -importlib-metadata==6.1.0 - # via dask -ipykernel==6.21.2 - # via - # ipywidgets - # jupyter - # jupyter-console - # nbclassic - # notebook - # qtconsole - # solara -ipython==8.14.0 - # via - # ipykernel - # ipywidgets - # jupyter-console -ipython-genutils==0.2.0 - # via - # nbclassic - # notebook - # qtconsole -ipyvue==1.9.2 - # via - # ipyvuetify - # solara -ipyvuetify==1.8.10 - # via solara -ipywidgets==8.0.4 - # via - # ipyvue - # jupyter - # reacton - # solara -isoduration==20.11.0 - # via jsonschema -jedi==0.18.2 - # via ipython -jinja2==3.1.2 - # via - # bmipy - # bokeh - # cookiecutter - # jinja2-time - # jupyter-server - # nbclassic - # nbconvert - # notebook - # solara -jinja2-time==0.2.0 - # via cookiecutter -jsonpointer==2.3 - # via jsonschema -jsonschema[format-nongpl]==4.17.3 - # via - # jupyter-events - # nbformat -jupyter==1.0.0 - # via -r requirements.in -jupyter-client==8.3.0 - # via - # ipykernel - # jupyter-console - # jupyter-server - # nbclassic - # nbclient - # notebook - # qtconsole - # solara -jupyter-console==6.5.1 - # via jupyter -jupyter-core==5.2.0 - # via - # ipykernel - # jupyter-client - # jupyter-console - # jupyter-server - # nbclassic - # nbclient - # nbconvert - # nbformat - # notebook - # qtconsole -jupyter-events==0.6.3 - # via jupyter-server -jupyter-server==2.3.0 - # via - # nbclassic - # notebook-shim -jupyter-server-terminals==0.4.4 - # via jupyter-server -jupyterlab-pygments==0.2.2 - # via nbconvert -jupyterlab-widgets==3.0.5 - # via ipywidgets -locket==1.0.0 - # via partd -markdown==3.4.1 - # via - # panel - # pymdown-extensions - # solara -markdown-it-py==3.0.0 - # via rich -markupsafe==2.1.2 - # via - # jinja2 - # nbconvert - # solara -matplotlib-inline==0.1.6 - # via - # ipykernel - # ipython -mdurl==0.1.2 - # via markdown-it-py -mesa==2.1.1 - # via -r requirements.in -mistune==2.0.5 - # via nbconvert -mypy-extensions==1.0.0 - # via black -nbclassic==0.5.1 - # via notebook -nbclient==0.7.2 - # via nbconvert -nbconvert==7.2.9 - # via - # jupyter - # jupyter-server - # nbclassic - # notebook -nbformat==5.9.2 - # via - # jupyter-server - # nbclassic - # nbclient - # nbconvert - # notebook - # solara -nest-asyncio==1.5.6 - # via - # ipykernel - # nbclassic - # notebook -networkx==3.0 - # via mesa -notebook==6.5.2 - # via jupyter -notebook-shim==0.2.2 - # via nbclassic -numpy==1.25.2 - # via - # bmi-topography - # bmipy - # bokeh - # dask - # holoviews - # mesa - # pandas - # rasterio - # snuggs - # xarray -packaging==23.0 - # via - # black - # bokeh - # dask - # holoviews - # ipykernel - # jupyter-server - # nbconvert - # qtpy - # rioxarray - # xarray -pandas==2.0.3 - # via - # holoviews - # mesa - # xarray -pandocfilters==1.5.0 - # via nbconvert -panel==0.14.3 - # via holoviews -param==1.12.3 - # via - # holoviews - # panel - # pyct - # pyviz-comms -parso==0.8.3 - # via jedi -partd==1.3.0 - # via dask -pathspec==0.11.0 - # via black -pexpect==4.8.0 - # via ipython -pickleshare==0.7.5 - # via ipython -pillow==9.4.0 - # via bokeh -platformdirs==3.0.0 - # via - # black - # jupyter-core -prometheus-client==0.16.0 - # via - # jupyter-server - # nbclassic - # notebook -prompt-toolkit==3.0.36 - # via - # ipython - # jupyter-console -psutil==5.9.4 - # via ipykernel -ptyprocess==0.7.0 - # via - # pexpect - # terminado -pure-eval==0.2.2 - # via stack-data -pycparser==2.21 - # via cffi -pyct==0.5.0 - # via - # colorcet - # panel -pygments==2.15.0 - # via - # ipython - # jupyter-console - # nbconvert - # qtconsole - # rich -pymdown-extensions==10.1 - # via solara -pyparsing==3.0.9 - # via snuggs -pyproj==3.4.1 - # via rioxarray -pyrsistent==0.19.3 - # via jsonschema -python-dateutil==2.8.2 - # via - # arrow - # jupyter-client - # pandas -python-json-logger==2.0.6 - # via jupyter-events -python-slugify==8.0.0 - # via cookiecutter -pytz==2022.7.1 - # via pandas -pyviz-comms==2.2.1 - # via - # holoviews - # panel -pyyaml==6.0.1 - # via - # bmi-topography - # bokeh - # cookiecutter - # dask - # jupyter-events - # pymdown-extensions -pyzmq==25.0.0 - # via - # ipykernel - # jupyter-client - # jupyter-console - # jupyter-server - # nbclassic - # notebook - # qtconsole -qtconsole==5.4.0 - # via jupyter -qtpy==2.3.0 - # via qtconsole -rasterio==1.3.6 - # via rioxarray -reacton==1.7.1 - # via solara -requests==2.31.0 - # via - # bmi-topography - # cookiecutter - # panel - # solara -rfc3339-validator==0.1.4 - # via - # jsonschema - # jupyter-events -rfc3986-validator==0.1.1 - # via - # jsonschema - # jupyter-events -rich==13.5.2 - # via rich-click -rich-click==1.6.1 - # via solara -rioxarray==0.13.3 - # via bmi-topography -send2trash==1.8.0 - # via - # jupyter-server - # nbclassic - # notebook -six==1.16.0 - # via - # asttokens - # bleach - # python-dateutil - # rfc3339-validator -sniffio==1.3.0 - # via anyio -snuggs==1.4.7 - # via rasterio -solara==1.19.0 - # via mesa -soupsieve==2.4 - # via beautifulsoup4 -stack-data==0.6.2 - # via ipython -starlette==0.31.0 - # via solara -terminado==0.17.1 - # via - # jupyter-server - # jupyter-server-terminals - # nbclassic - # notebook -text-unidecode==1.3 - # via python-slugify -tinycss2==1.2.1 - # via nbconvert -toolz==0.12.0 - # via - # dask - # partd -tornado==6.3.3 - # via - # bokeh - # ipykernel - # jupyter-client - # jupyter-server - # mesa - # nbclassic - # notebook - # terminado -tqdm==4.64.1 - # via - # mesa - # panel -traitlets==5.9.0 - # via - # comm - # ipykernel - # ipython - # ipywidgets - # jupyter-client - # jupyter-console - # jupyter-core - # jupyter-events - # jupyter-server - # matplotlib-inline - # nbclassic - # nbclient - # nbconvert - # nbformat - # notebook - # qtconsole -typing-extensions==4.5.0 - # via - # bokeh - # panel - # reacton -tzdata==2023.3 - # via pandas -uri-template==1.2.0 - # via jsonschema -urllib3==1.26.14 - # via requests -uvicorn==0.23.2 - # via solara -watchdog==3.0.0 - # via solara -wcwidth==0.2.6 - # via prompt-toolkit -webcolors==1.12 - # via jsonschema -webencodings==0.5.1 - # via - # bleach - # tinycss2 -websocket-client==1.5.1 - # via jupyter-server -websockets==11.0.3 - # via solara -widgetsnbextension==4.0.5 - # via ipywidgets -xarray==2023.8.0 - # via - # bmi-topography - # rioxarray -zipp==3.15.0 - # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/noxfile.py b/noxfile.py index 50584420f6..32d0bb56a9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,13 +1,22 @@ +import json import os import pathlib import shutil import tempfile import nox +from packaging.requirements import Requirement PROJECT = "landlab" ROOT = pathlib.Path(__file__).parent PYTHON_VERSION = "3.11" +PATH = { + "build": ROOT / "build", + "docs": ROOT / "docs", + "nox": pathlib.Path(".nox"), + "requirements": ROOT / "requirements", + "root": ROOT, +} @nox.session(python=PYTHON_VERSION, venv_backend="mamba") @@ -15,13 +24,20 @@ def test(session: nox.Session) -> None: """Run the tests.""" os.environ["WITH_OPENMP"] = "1" - # session.conda_install("c-compiler", "cxx-compiler") session.log(f"CC = {os.environ.get('CC', 'NOT FOUND')}") - session.conda_install("--file", "requirements.in") - session.conda_install("--file", "requirements-testing.in") + + session.install( + "-r", + PATH["requirements"] / "required.txt", + "-r", + PATH["requirements"] / "testing.txt", + ) + session.conda_install("richdem") session.install("-e", ".", "--no-deps") + check_package_versions(session, files=["required.txt", "testing.txt"]) + args = [ "-n", "auto", @@ -55,22 +71,22 @@ def test_notebooks(session: nox.Session) -> None: os.environ["WITH_OPENMP"] = "1" - # session.conda_install("c-compiler", "cxx-compiler") - session.conda_install("richdem", channel=["nodefaults", "conda-forge"]) - session.conda_install( - "pytest", - "pytest-xdist", - "--file", - "notebooks/requirements.in", - "--file", - "requirements-testing.in", - "--file", - "requirements.in", - channel=["nodefaults", "conda-forge"], + session.install( + "-r", + PATH["requirements"] / "required.txt", + "-r", + PATH["requirements"] / "testing.txt", + "-r", + PATH["requirements"] / "notebooks.txt", ) + session.conda_install("richdem", channel=["nodefaults", "conda-forge"]) session.install("git+https://github.com/mcflugen/nbmake.git@mcflugen/add-markers") session.install("-e", ".", "--no-deps") + check_package_versions( + session, files=["required.txt", "testing.txt", "notebooks.txt"] + ) + session.run(*args) @@ -127,23 +143,65 @@ def build_index(session: nox.Session) -> None: @nox.session(name="build-docs") def build_docs(session: nox.Session) -> None: """Build the docs.""" - build_dir = ROOT / "build" - docs_dir = ROOT / "docs" - session.install("-r", docs_dir / "requirements.in") - session.install("-e", ".") + session.install( + "-r", + PATH["requirements"] / "docs.txt", + "-r", + PATH["requirements"] / "required.txt", + ) + session.install("-e", ".", "--no-deps") + + check_package_versions(session, files=["required.txt", "docs.txt"]) - build_dir.mkdir(exist_ok=True) + PATH["build"].mkdir(exist_ok=True) session.run( "sphinx-build", "-b", "html", "-W", "--keep-going", - docs_dir / "source", - build_dir / "html", + PATH["docs"] / "source", + PATH["build"] / "html", ) - session.log(f"generated docs at {build_dir / 'html'!s}") + session.log(f"generated docs at {PATH['build'] / 'html'!s}") + + +@nox.session(name="check-versions") +def check_package_versions(session, files=("required.txt",)): + output_lines = session.run("pip", "list", "--format=json", silent=True).splitlines() + + installed_version = { + p["name"].lower(): p["version"] for p in json.loads(output_lines[0]) + } + + for file_ in files: + required_version = {} + with (PATH["requirements"] / file_).open() as fp: + for line in fp.readlines(): + requirement = Requirement(line) + required_version[requirement.name.lower()] = requirement.specifier + + mismatch = set() + for name, version in required_version.items(): + if name not in installed_version or not version.contains( + installed_version[name] + ): + mismatch.add(name) + + session.log(f"Checking installed package versions for {file_}") + for name in sorted(required_version): + print(f"[{name}]") + print(f"requested = {str(required_version[name])!r}") + if name in installed_version: + print(f"installed = {installed_version[name]!r}") + else: + print("installed = false") + + if mismatch: + session.warn( + f"There were package version mismatches for packages required in {file_}" + ) @nox.session @@ -255,14 +313,12 @@ def clean_checkpoints(session): @nox.session(python=False, name="clean-docs") def clean_docs(session: nox.Session) -> None: """Clean up the docs folder.""" - build_dir = ROOT / "build" - - if (build_dir / "html").is_dir(): - with session.chdir(build_dir): + if (PATH["build"] / "html").is_dir(): + with session.chdir(PATH["build"]): shutil.rmtree("html") - if (ROOT / "build").is_dir(): - session.chdir(ROOT / "build") + if PATH["build"].is_dir(): + session.chdir(PATH["build"]) if os.path.exists("html"): shutil.rmtree("html") @@ -328,10 +384,8 @@ def _args_to_folders(args): def _clean_rglob(pattern): - nox_dir = pathlib.Path(".nox") - for p in pathlib.Path(".").rglob(pattern): - if nox_dir in p.parents: + if PATH["nox"] in p.parents: continue if p.is_dir(): p.rmdir() diff --git a/pyproject.toml b/pyproject.toml index cba165d326..bb24c614c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,11 +125,9 @@ markers = [ ] [tool.isort] -multi_line_output = 3 -include_trailing_comma = true -force_grid_wrap = 0 combine_as_imports = true -line_length = 88 +known_first_party = "landlab" +profile = "black" [tool.check-manifest] ignore = [".nox", "build"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 266df51751..0000000000 --- a/requirements.txt +++ /dev/null @@ -1,105 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.10 -# by the following command: -# -# pip-compile requirements.in -# -black==23.1.0 - # via bmipy -bmipy==2.0 - # via -r requirements.in -certifi==2023.7.22 - # via netcdf4 -cftime==1.6.2 - # via netcdf4 -click==8.1.3 - # via - # black - # bmipy - # rich-click -contourpy==1.0.7 - # via matplotlib -cycler==0.11.0 - # via matplotlib -fonttools==4.38.0 - # via matplotlib -jinja2==3.1.2 - # via bmipy -kiwisolver==1.4.4 - # via matplotlib -markdown-it-py==2.2.0 - # via rich -markupsafe==2.1.2 - # via jinja2 -matplotlib==3.7.2 - # via -r requirements.in -mdurl==0.1.2 - # via markdown-it-py -mypy-extensions==1.0.0 - # via black -netcdf4==1.6.4 - # via -r requirements.in -numpy==1.25.2 - # via - # -r requirements.in - # bmipy - # cftime - # contourpy - # matplotlib - # netcdf4 - # pandas - # patsy - # scipy - # statsmodels - # xarray -packaging==23.0 - # via - # black - # matplotlib - # statsmodels - # xarray -pandas==2.0.3 - # via - # -r requirements.in - # statsmodels - # xarray -pathspec==0.11.0 - # via black -patsy==0.5.3 - # via statsmodels -pillow==9.4.0 - # via matplotlib -platformdirs==3.0.0 - # via black -pygments==2.15.0 - # via rich -pyparsing==3.0.9 - # via matplotlib -pyshp==2.3.1 - # via -r requirements.in -python-dateutil==2.8.2 - # via - # matplotlib - # pandas -pytz==2022.7.1 - # via pandas -pyyaml==6.0.1 - # via -r requirements.in -rich==13.3.1 - # via rich-click -rich-click==1.6.1 - # via -r requirements.in -scipy==1.11.2 - # via - # -r requirements.in - # statsmodels -six==1.16.0 - # via - # patsy - # python-dateutil -statsmodels==0.14.0 - # via -r requirements.in -tzdata==2023.3 - # via pandas -xarray==2023.8.0 - # via -r requirements.in diff --git a/requirements/README.md b/requirements/README.md new file mode 100644 index 0000000000..259c513b98 --- /dev/null +++ b/requirements/README.md @@ -0,0 +1,10 @@ +This directory contains several files that specify the versions of +our dependencies used in our CI workflows. *Landlab* does not require +these exact version numbers to work properly, these are what we +test against to ensure that things don't break as new versions +of our dependencies are released. + +## Managed by dependabot + +All files with a `.txt` extension are managed by dependabot and **should +not be manually edited** unless you need to add or remove a dependency. diff --git a/requirements/docs.txt b/requirements/docs.txt new file mode 100644 index 0000000000..9224f52818 --- /dev/null +++ b/requirements/docs.txt @@ -0,0 +1,11 @@ +furo==2023.9.10 +ipython==8.16.1 +myst-parser==2.0.0 +nbsphinx==0.9.3 +pandoc==2.3 +sphinx-copybutton==0.5.2 +sphinx-inline-tabs==2023.4.21 +sphinx-jinja==2.0.2 +sphinx==7.2.6 +sphinxcontrib-towncrier==0.3.2a0 +tomli==2.0.1 diff --git a/requirements/notebooks.txt b/requirements/notebooks.txt new file mode 100644 index 0000000000..d7d44d2b54 --- /dev/null +++ b/requirements/notebooks.txt @@ -0,0 +1,5 @@ +bmi-topography==0.8.2 +dask[array]==2023.10.0 +holoviews==1.18.0 +jupyter==1.0.0 +mesa==2.1.2 diff --git a/requirements/required.txt b/requirements/required.txt new file mode 100644 index 0000000000..59c2d3389d --- /dev/null +++ b/requirements/required.txt @@ -0,0 +1,11 @@ +bmipy==2.0 +matplotlib==3.8.0 +netcdf4==1.6.4 +numpy==1.26.1 +pandas==2.1.1 +pyshp==2.3.1 +pyyaml==6.0.1 +rich-click==1.7.0 +scipy==1.11.3 +statsmodels==0.14.0 +xarray==2023.10.1 diff --git a/requirements/testing.txt b/requirements/testing.txt new file mode 100644 index 0000000000..0db9a92c4d --- /dev/null +++ b/requirements/testing.txt @@ -0,0 +1,8 @@ +coveralls==3.3.1 +flaky==3.7.0 +hypothesis==6.88.1 +pytest==7.4.2 +pytest-benchmark==4.0.0 +pytest-cov==4.1.0 +pytest-datadir==1.5.0 +pytest-xdist==3.3.1