From d379977823689103a6022f9955a7334155d9d9c0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Jul 2023 21:32:51 +0000 Subject: [PATCH 1/4] ci(release): update to development version 0.3.0.dev0 --- docs/conf.py | 2 +- modflow_devtools/__init__.py | 2 +- version.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 663e602..ffe3e28 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -8,7 +8,7 @@ project = "modflow-devtools" author = "MODFLOW Team" -release = "0.2.0" +release = "0.3.0.dev0" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/modflow_devtools/__init__.py b/modflow_devtools/__init__.py index 10e93c1..112d37f 100644 --- a/modflow_devtools/__init__.py +++ b/modflow_devtools/__init__.py @@ -1,6 +1,6 @@ __author__ = "Joseph D. Hughes" __date__ = "Jul 26, 2023" -__version__ = "0.2.0" +__version__ = "0.3.0.dev0" __maintainer__ = "Joseph D. Hughes" __email__ = "jdhughes@usgs.gov" __status__ = "Production" diff --git a/version.txt b/version.txt index 341cf11..2934a2f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.2.0 \ No newline at end of file +0.3.0.dev0 \ No newline at end of file From 72e29e14e74c2b874cba89b1eb1563e1b4e6d0a0 Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Thu, 3 Aug 2023 21:09:11 -0400 Subject: [PATCH 2/4] refactor(dependencies): remove them, update readme (#95) --- DEVELOPER.md | 1 + README.md | 70 ++++++++++++++++++++-------------------------- docs/md/install.md | 2 +- pyproject.toml | 6 ++-- 4 files changed, 34 insertions(+), 45 deletions(-) diff --git a/DEVELOPER.md b/DEVELOPER.md index 5a44c4f..b074df5 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -5,6 +5,7 @@ This document provides guidance to set up a development environment and discusse + - [Requirements](#requirements) - [Installation](#installation) - [Testing](#testing) diff --git a/README.md b/README.md index a6833db..0471626 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,44 @@ [![CI](https://github.com/MODFLOW-USGS/modflow-devtools/actions/workflows/ci.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow-devtools/actions/workflows/ci.yml) [![Documentation Status](https://readthedocs.org/projects/modflow-devtools/badge/?version=latest)](https://modflow-devtools.readthedocs.io/en/latest/?badge=latest) -Python tools for MODFLOW development and testing. +Python development tools for MODFLOW 6. + +- [Use cases](#use-cases) - [Requirements](#requirements) - [Installation](#installation) -- [Use cases](#use-cases) -- [Quickstart](#quickstart) - [Documentation](#documentation) -- [MODFLOW Resources](#modflow-resources) +## Use cases + +This is a small toolkit for developing MODFLOW 6, FloPy, and related projects. It includes standalone utilities and optional [Pytest](https://github.com/pytest-dev/pytest) extensions. + +Standalone utilities include a very minimal GitHub API client, mainly for retrieving release information and downloading asset, and a `ZipFile` subclass that [preserves file permissions](https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries) (workaround for [Python #15795](https://bugs.python.org/issue15795)) + +Pytest features include: + +- `--keep ` tempdir fixtures for [each scope](https://docs.pytest.org/en/stable/how-to/fixtures.html#scope-sharing-fixtures-across-classes-modules-packages-or-session) +- a [`--smoke` test](https://en.wikipedia.org/wiki/Smoke_testing_(software)) (abbrev. `-S`) CLI option shortcut +- markers to skip test cases conditional on + - operating system + - Python packages installed + - executables available on the PATH +- test fixtures for example / test models in + - `MODFLOW-USGS/modflow6-examples` + - `MODFLOW-USGS/modflow6-testmodels` + - `MODFLOW-USGS/modflow6-largetestmodels` + ## Requirements -This project requires Python3.8+. Its only core dependencies are `numpy` and `pytest`. +Python3.8+, dependency-free, but pairs well with `pytest` and select plugins, e.g. + +- [`pytest-dotenv`](https://github.com/quiqua/pytest-dotenv) +- [`pytest-xdist`](https://github.com/pytest-dev/pytest-xdist) ## Installation @@ -33,13 +54,7 @@ This project requires Python3.8+. Its only core dependencies are `numpy` and `py pip install modflow-devtools ``` -This package pairs well with a few pytest plugins: - -- `pytest-cases` -- `pytest-dotenv` -- `pytest-xdist` - -These and a few other optional dependencies can be installed with: +Pytest, pytest plugins, and other optional dependencies can be installed with: ```shell pip install "modflow-devtools[test]" @@ -47,41 +62,16 @@ pip install "modflow-devtools[test]" To install from source and set up a development environment please see the [developer documentation](DEVELOPER.md). -## Use cases - -This package contains shared tools for developing and testing MODFLOW 6 and FloPy, including standalone utilities as well as `pytest` fixtures, CLI options, and test cases: - -- utilities for retrieving release information and downloading assets from the GitHub API -- a `ZipFile` subclass that [preserves file permissions](https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries) (workaround for [Python #15795](https://bugs.python.org/issue15795)) -- a `pytest` CLI option for smoke testing (running a fast subset of cases) -- a minimal `pytest-cases` framework for reusing test functions and data -- a set of keepable `pytest` temporary directory fixtures for each scope -- a set of fixtures to parametrize tests with models from external repos - - `MODFLOW-USGS/modflow6-examples` - - `MODFLOW-USGS/modflow6-testmodels` - - `MODFLOW-USGS/modflow6-largetestmodels` -- a set of `pytest` markers to conditionally skip test cases based on - - operating system - - Python packages installed - - executables available on the path - -## Quickstart - To import `pytest` fixtures in a project consuming `modflow-devtools`, add the following to a `conftest.py` file: ```python pytest_plugins = [ "modflow_devtools.fixtures" ] ``` -**Note**: `pytest` requires this to be a top-level `conftest.py` file. Nested `conftest.py` files may override or extend this package's fixtures. +**Note**: this must be a top-level `conftest.py`, which nested `conftest.py` files may then override or extend. ## Documentation -Usage documentation is available at [modflow-devtools.readthedocs.io](https://modflow-devtools.readthedocs.io/en/latest/). - -## MODFLOW Resources +Docs are available at [modflow-devtools.readthedocs.io](https://modflow-devtools.readthedocs.io/en/latest/). -+ [MODFLOW and Related Programs](https://water.usgs.gov/ogw/modflow/) -+ [Online guide for MODFLOW-2000](https://water.usgs.gov/nrp/gwsoftware/modflow2000/Guide/) -+ [Online guide for MODFLOW-2005](https://water.usgs.gov/ogw/modflow/MODFLOW-2005-Guide/) -+ [Online guide for MODFLOW-NWT](https://water.usgs.gov/ogw/modflow-nwt/MODFLOW-NWT-Guide/) +For more info on MODFLOW 6 see [the USGS overview](https://water.usgs.gov/ogw/modflow/). diff --git a/docs/md/install.md b/docs/md/install.md index 539a83c..473bc1e 100644 --- a/docs/md/install.md +++ b/docs/md/install.md @@ -2,7 +2,7 @@ ## Installing `modflow-devtools` from PyPI -The `modflow-devtools` package is [available on PyPi](https://pypi.org/project/modflow-devtools/) and can be installed with `pip`: +Packages are [available on PyPi](https://pypi.org/project/modflow-devtools/) and can be installed with `pip`: ```shell pip install modflow-devtools diff --git a/pyproject.toml b/pyproject.toml index 46d8cfd..78beab2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,10 +36,6 @@ classifiers = [ "Topic :: Scientific/Engineering :: Hydrology" ] requires-python = ">=3.8" -dependencies = [ - "numpy", - "pytest" -] dynamic = ["version"] [project.optional-dependencies] @@ -57,6 +53,8 @@ test = [ "filelock", "meson!=0.63.0", "ninja", + "numpy", + "pytest", "pytest-cases", "pytest-cov", "pytest-dotenv", From c1bdb3cf7cdd988df9f3ae8d67de7496f1603c38 Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Thu, 3 Aug 2023 21:11:29 -0400 Subject: [PATCH 3/4] refactor(download_and_unzip): return path to extract locn (#96) * docs: fix README typo --- README.md | 2 +- docs/md/download.md | 2 ++ modflow_devtools/download.py | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0471626..d9f2e34 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Python development tools for MODFLOW 6. This is a small toolkit for developing MODFLOW 6, FloPy, and related projects. It includes standalone utilities and optional [Pytest](https://github.com/pytest-dev/pytest) extensions. -Standalone utilities include a very minimal GitHub API client, mainly for retrieving release information and downloading asset, and a `ZipFile` subclass that [preserves file permissions](https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries) (workaround for [Python #15795](https://bugs.python.org/issue15795)) +Standalone utilities include a very minimal GitHub API client, mainly for retrieving release information and downloading assets, and a `ZipFile` subclass that [preserves file permissions](https://stackoverflow.com/questions/39296101/python-zipfile-removes-execute-permissions-from-binaries) (workaround for [Python #15795](https://bugs.python.org/issue15795)) Pytest features include: diff --git a/docs/md/download.md b/docs/md/download.md index dd41fa1..9a3643b 100644 --- a/docs/md/download.md +++ b/docs/md/download.md @@ -77,3 +77,5 @@ from modflow_devtools.download import download_and_unzip url = f"https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip" download_and_unzip(url, "~/Downloads", delete_zip=True, verbose=True) ``` + +The function's return value is the `Path` the archive was extracted to. \ No newline at end of file diff --git a/modflow_devtools/download.py b/modflow_devtools/download.py index c90ba51..3741f05 100644 --- a/modflow_devtools/download.py +++ b/modflow_devtools/download.py @@ -438,7 +438,7 @@ def download_and_unzip( delete_zip=True, retries=3, verbose=False, -): +) -> Path: """ Download and unzip a zip file from a URL. The filename must be the last element in the URL. @@ -455,6 +455,11 @@ def download_and_unzip( The maximum number of retries for each request verbose : bool Whether to show verbose output + + Returns + ------- + Path + The path to the directory where the zip file was unzipped """ path = Path(path if path else os.getcwd()) @@ -544,3 +549,5 @@ def download_and_unzip( if verbose: print(f"Done downloading and extracting {file_path.name} to {path}") + + return path From f26ae58199d2bfefe27cfc41378bcab46034f968 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 01:21:13 +0000 Subject: [PATCH 4/4] ci(release): set version to 0.3.0, update changelog --- HISTORY.md | 7 +++++++ docs/conf.py | 2 +- modflow_devtools/__init__.py | 4 ++-- version.txt | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 6763a5d..f7d4e74 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,10 @@ +### Version 0.3.0 + +#### Refactoring + +* [refactor(dependencies)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/72e29e14e74c2b874cba89b1eb1563e1b4e6d0a0): Remove them, update readme (#95). Committed by w-bonelli on 2023-08-04. +* [refactor(download_and_unzip)](https://github.com/MODFLOW-USGS/modflow-devtools/commit/c1bdb3cf7cdd988df9f3ae8d67de7496f1603c38): Return path to extract locn (#96). Committed by w-bonelli on 2023-08-04. + ### Version 0.2.0 #### New features diff --git a/docs/conf.py b/docs/conf.py index ffe3e28..8a04df4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -8,7 +8,7 @@ project = "modflow-devtools" author = "MODFLOW Team" -release = "0.3.0.dev0" +release = "0.3.0" # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/modflow_devtools/__init__.py b/modflow_devtools/__init__.py index 112d37f..5db56f7 100644 --- a/modflow_devtools/__init__.py +++ b/modflow_devtools/__init__.py @@ -1,6 +1,6 @@ __author__ = "Joseph D. Hughes" -__date__ = "Jul 26, 2023" -__version__ = "0.3.0.dev0" +__date__ = "Aug 04, 2023" +__version__ = "0.3.0" __maintainer__ = "Joseph D. Hughes" __email__ = "jdhughes@usgs.gov" __status__ = "Production" diff --git a/version.txt b/version.txt index 2934a2f..9325c3c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.3.0.dev0 \ No newline at end of file +0.3.0 \ No newline at end of file