From 3964ced0f0414ee942a9cd46ead53bb603bd2728 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 14 Aug 2024 15:02:34 -0600 Subject: [PATCH 1/7] Move dependency specifications into pyproject.toml --- pyproject.toml | 54 ++++++++++++++++++++++++++++++++++++------- requirements-dev.txt | 5 ---- requirements-docs.txt | 11 --------- requirements.txt | 16 ------------- 4 files changed, 46 insertions(+), 40 deletions(-) delete mode 100644 requirements-dev.txt delete mode 100644 requirements-docs.txt delete mode 100644 requirements.txt diff --git a/pyproject.toml b/pyproject.toml index 4f4c0a88c..377f8374d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ license = {file = "LICENSE"} readme = "README.rst" requires-python = "~=3.7" -dynamic = ["version", "dependencies"] +dynamic = ["version"] authors = [ {name = "The icepyx Developers", email = "jbscheick@gmail.com"}, @@ -31,6 +31,49 @@ classifiers=[ "Topic :: Software Development :: Libraries", ] +dependencies = [ + "backoff", + "dask[dataframe]", + "datashader", + "earthaccess>=0.5.1", + "fiona", + "geopandas", + "h5netcdf", + "h5py", + "holoviews", + "hvplot", + "matplotlib", + "numpy", + "requests", + "s3fs", + "shapely", + "xarray", +] + +[project.optional-dependencies] +dev = [ + "pre-commit", + "pypistats", + "pytest>=4.6", + "pytest-cov", + "responses", +] +docs = [ + "gitpython", + "linkify-it-py", + "myst-nb", + "nbsphinx", + "numpydoc", + "pybtex", + "pygithub", + "sphinx>=4.3", + "sphinx-panels", + "sphinx_rtd_theme>=1.0", + "sphinxcontrib-bibtex", +] +viz = ["geoviews >= 1.9.0", "cartopy >= 0.18.0", "scipy"] +complete = ["icepyx[viz]"] + [project.urls] Homepage = "https://icepyx.readthedocs.io" Documentation = "https://icepyx.readthedocs.io" @@ -46,13 +89,6 @@ requires = ["setuptools>=66", "wheel", "setuptools_scm"] [tool.setuptools] py-modules = ["_icepyx_version"] -[tool.setuptools.dynamic] -dependencies = {file = ["requirements.txt"]} - -[project.optional-dependencies] -viz = ["geoviews >= 1.9.0", "cartopy >= 0.18.0", "scipy"] -complete = ["icepyx[viz]"] - [tool.setuptools.packages.find] exclude = ["*tests"] @@ -61,6 +97,8 @@ version_file = "_icepyx_version.py" version_file_template = 'version = "{version}"' local_scheme = "node-and-date" fallback_version = "unknown" + + # [tool.ruff.format] # docstring-code-format = true # docstring-code-line-length = "dynamic" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 66106dab8..000000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -pre-commit -pypistats -pytest>=4.6 -pytest-cov -responses diff --git a/requirements-docs.txt b/requirements-docs.txt deleted file mode 100644 index 51dc9ff5a..000000000 --- a/requirements-docs.txt +++ /dev/null @@ -1,11 +0,0 @@ -gitpython -linkify-it-py -myst-nb -nbsphinx -numpydoc -pybtex -pygithub -sphinx>=4.3 -sphinx-panels -sphinx_rtd_theme>=1.0 -sphinxcontrib-bibtex diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6a9659270..000000000 --- a/requirements.txt +++ /dev/null @@ -1,16 +0,0 @@ -backoff -dask[dataframe] -datashader -earthaccess>=0.5.1 -fiona -geopandas -h5netcdf -h5py -holoviews -hvplot -matplotlib -numpy -requests -s3fs -shapely -xarray From fd9d3a9faa6b3fe6968f97df9f31fa4007d74269 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Thu, 15 Aug 2024 08:42:27 -0600 Subject: [PATCH 2/7] Use long-form --editable argument --- doc/source/contributing/how_to_contribute.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/source/contributing/how_to_contribute.rst b/doc/source/contributing/how_to_contribute.rst index 84c21717b..a1ec004e1 100644 --- a/doc/source/contributing/how_to_contribute.rst +++ b/doc/source/contributing/how_to_contribute.rst @@ -78,9 +78,9 @@ If you are modifying portions of code, you will need to run .. code-block:: shell - pip install -e. + pip install --editable .[dev] -within your Python environment to use your real-time edited version of the code during runtime. +within your Python environment to use your real-time editable version of the code during runtime. Setting up a Development Work Environment @@ -116,7 +116,7 @@ If you are working in Jupyter Notebook, in addition to manually installing your .. code-block:: shell - pip install -e. + pip install --editable . you will need to dynamically reload icepyx within your notebook by executing From c6b963fa950abe51783ba847d2a9b974083b051a Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Thu, 15 Aug 2024 08:35:22 -0600 Subject: [PATCH 3/7] Update contributor instructions for more standardized installation --- doc/source/contributing/how_to_contribute.rst | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/source/contributing/how_to_contribute.rst b/doc/source/contributing/how_to_contribute.rst index a1ec004e1..e302c1460 100644 --- a/doc/source/contributing/how_to_contribute.rst +++ b/doc/source/contributing/how_to_contribute.rst @@ -73,18 +73,24 @@ update your local copy of icepyx with to ensure you have the most up to date version of icepyx in your library. +Setting up a Development Work Environment +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If you are modifying portions of code, you will need to run - -.. code-block:: shell +You will need to install icepyx in editable mode, so that when we make changes, they will immediately be testable at runtime. +You will also need icepyx's dependencies and some dev tooling (for automated checks, tests, and documentaiton). - pip install --editable .[dev] +To set this up, start in the root of your local copy of the icepyx repo. +Then, create a new environment using mamba (or conda, or a tool of your choice) and activate it. +Finally, install icepyx and needed dependencies in to it: -within your Python environment to use your real-time editable version of the code during runtime. +.. code-block:: shell + mamba create --name icepyx-dev pip + mamba activate icepyx-dev + pip install --editable .[dev,docs] -Setting up a Development Work Environment ------------------------------------------ +Setting up development tools +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ icepyx uses a few tools to ensure that files have consistent formatting and run tests. You can easily install the ones most frequently used by creating a new mamba (or conda) @@ -116,7 +122,7 @@ If you are working in Jupyter Notebook, in addition to manually installing your .. code-block:: shell - pip install --editable . + pip install --editable .[dev,docs] you will need to dynamically reload icepyx within your notebook by executing From 121bb36fd8c16b318df5baab8614fdfb1a537c12 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Thu, 15 Aug 2024 08:35:53 -0600 Subject: [PATCH 4/7] Update pre-commit instructions for new dependency management style --- doc/source/contributing/how_to_contribute.rst | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/doc/source/contributing/how_to_contribute.rst b/doc/source/contributing/how_to_contribute.rst index e302c1460..68bd3eb08 100644 --- a/doc/source/contributing/how_to_contribute.rst +++ b/doc/source/contributing/how_to_contribute.rst @@ -92,25 +92,20 @@ Finally, install icepyx and needed dependencies in to it: Setting up development tools ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -icepyx uses a few tools to ensure that files have consistent formatting and run tests. -You can easily install the ones most frequently used by creating a new mamba (or conda) -environment (from the home level of your local copy of the icepyx repo) with +One of the dev tools we just installed is called `pre-commit `_. +We have included a set of pre-commit formatting hooks that we strongly encourage all contributors to use. +Configure those hooks to automatically execute with: .. code-block:: shell - mamba env create --name icepyx-env --channel conda-forge -f requirements-dev.txt -f requirements.txt - -and then (1) running `pre-commit install` to let git know about pre-commit and -(2) pip installing icepyx as described above and below. + pre-commit install -One of the tools installed with "requirements-dev.txt" is called [pre-commit](https://pre-commit.com/). -We have included a set of pre-commit formatting hooks that we strongly encourage all contributors to use. -These hooks will check the files you are committing for format consistency, -reformatting the files if necessary. +These hooks will check the files you are committing for format consistency and reformat them if necessary. You can tell files were reformatted if you get a message showing one of the checks failed. -In this case, you will need to re-commit your changes until all pre-commit hooks pass -(i.e. a failed pre-commit check results in no git commit). -Pre-commit will also run on icepyx PRs using the pre-commit CI (continuous integration). +In this case, pre-commit has prevented the commit from completing. +You will need to re-add and the formatted files and try to commit again until all pre-commit hooks pass. + +pre-commit will also run on icepyx PRs using the pre-commit CI (continuous integration) service. As with other automations happening in PRs, you'll want to make sure you pull the changes back to your local version before making new commits. From d8da9f50fb0461395ad775890b2d8672d6af1dfa Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 14 Aug 2024 15:58:17 -0600 Subject: [PATCH 5/7] Use pyproject.toml dependencies for RTD --- readthedocs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readthedocs.yml b/readthedocs.yml index dba60979f..efe60b8a7 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -25,7 +25,7 @@ formats: all # Optionally declare the Python requirements required to build your docs python: install: - - requirements: requirements-docs.txt - - requirements: requirements.txt - method: pip path: . + extra_requirements: + - docs From b5a3838fa40c975ae8d97a1a14924c2f04cf48ec Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 14 Aug 2024 15:59:43 -0600 Subject: [PATCH 6/7] Remove obsolete file from MANIFEST.in --- MANIFEST.in | 1 - 1 file changed, 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 957ccc9e2..df6813f58 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,4 +9,3 @@ exclude *.ini exclude *.txt exclude *.yaml exclude *.yml -include requirements.txt From 075f1f8c7fe41a0992482cab139b36537c16c453 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 14 Aug 2024 19:59:25 -0600 Subject: [PATCH 7/7] Use pyproject for Travis --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index b3d7081e7..562df31c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,9 @@ before_install: - conda info -a install: - - conda create --name icepyx-env --channel conda-forge python=3.10 proj geos + - conda create --name icepyx-env --channel conda-forge python=3.10 pip proj geos - source activate icepyx-env - - pip install -r requirements.txt -r requirements-dev.txt - - pip install -e .[complete] + - pip install -e .[dev,complete] stages: - name: basic tests