diff --git a/DISCLAIMER.md b/DISCLAIMER.md deleted file mode 100644 index c3b346b8df..0000000000 --- a/DISCLAIMER.md +++ /dev/null @@ -1,11 +0,0 @@ -Disclaimer ----------- - -This software is preliminary or provisional and is subject to revision. It is -being provided to meet the need for timely best science. This software is -provided "as is" and "as-available", and makes no representations or warranties -of any kind concerning the software, whether express, implied, statutory, or -other. This includes, without limitation, warranties of title, -merchantability, fitness for a particular purpose, non-infringement, absence -of latent or other defects, accuracy, or the presence or absence of errors, -whether or not known or discoverable. \ No newline at end of file diff --git a/README.md b/README.md index fc5354d7d4..c364d247a1 100644 --- a/README.md +++ b/README.md @@ -170,17 +170,3 @@ MODFLOW Resources + [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/) - - -Disclaimer ----------- - -This software is preliminary or provisional and is subject to revision. It is -being provided to meet the need for timely best science. This software is -provided "as is" and "as-available", and makes no representations or warranties -of any kind concerning the software, whether express, implied, statutory, or -other. This includes, without limitation, warranties of title, -merchantability, fitness for a particular purpose, non-infringement, absence -of latent or other defects, accuracy, or the presence or absence of errors, -whether or not known or discoverable. - diff --git a/code.json b/code.json deleted file mode 100644 index 1471ab55d9..0000000000 --- a/code.json +++ /dev/null @@ -1,49 +0,0 @@ -[ - { - "status": "Preliminary", - "languages": [ - "python" - ], - "repositoryURL": "https://code.usgs.gov/usgs/modflow/flopy.git", - "disclaimerURL": "https://code.usgs.gov/usgs/modflow/flopy/blob/master/DISCLAIMER.md", - "name": "flopy", - "tags": [ - "MODFLOW", - "MODFLOW 6", - "MODFLOW-2005", - "MODFLOW-NWT", - "MODFLOW-USG", - "MODFLOW-2000", - "MT3DMS", - "MT3D-USGS", - "SEAWAT", - "MODPATH", - "groundwater model", - "transport model", - "python" - ], - "contact": { - "name": "Joseph D. Hughes", - "email": "jdhughes@usgs.gov" - }, - "downloadURL": "https://code.usgs.gov/usgs/modflow/flopy/archive/master.zip", - "vcs": "git", - "laborHours": -1, - "version": "3.8.0.dev0", - "date": { - "metadataLastUpdated": "2024-05-23" - }, - "organization": "U.S. Geological Survey", - "permissions": { - "licenses": [ - { - "URL": "https://code.usgs.gov/usgs/modflow/flopy/blob/master/LICENSE.md", - "name": "Public Domain, CC0-1.0" - } - ], - "usageType": "openSource" - }, - "homepageURL": "https://code.usgs.gov/usgs/modflow/flopy/", - "description": "FloPy is a python package to create, run, and post-process MODFLOW-based models." - } -] diff --git a/docs/PyPI_release.md b/docs/PyPI_release.md index fac5c4fbb9..e56a389884 100644 --- a/docs/PyPI_release.md +++ b/docs/PyPI_release.md @@ -31,17 +31,3 @@ How to Cite *Software/Code citation for FloPy:* [Bakker, Mark, Post, Vincent, Hughes, J. D., Langevin, C. D., White, J. T., Leaf, A. T., Paulinski, S. R., Bellino, J. C., Morway, E. D., Toews, M. W., Larsen, J. D., Fienen, M. N., Starn, J. J., Brakenhoff, D. A., and Bonelli, W. P., 2024, FloPy v3.8.0.dev0 (preliminary): U.S. Geological Survey Software Release, 23 May 2024, https://doi.org/10.5066/F7BK19FH](https://doi.org/10.5066/F7BK19FH) - - -Disclaimer ----------- - -This software is preliminary or provisional and is subject to revision. It is -being provided to meet the need for timely best science. This software is -provided "as is" and "as-available", and makes no representations or warranties -of any kind concerning the software, whether express, implied, statutory, or -other. This includes, without limitation, warranties of title, -merchantability, fitness for a particular purpose, non-infringement, absence -of latent or other defects, accuracy, or the presence or absence of errors, -whether or not known or discoverable. - diff --git a/flopy/DISCLAIMER.md b/flopy/DISCLAIMER.md deleted file mode 100644 index 81ba20d032..0000000000 --- a/flopy/DISCLAIMER.md +++ /dev/null @@ -1,11 +0,0 @@ -Disclaimer ----------- - -This software is preliminary or provisional and is subject to revision. It is -being provided to meet the need for timely best science. This software is -provided "as is" and "as-available", and makes no representations or warranties -of any kind concerning the software, whether express, implied, statutory, or -other. This includes, without limitation, warranties of title, -merchantability, fitness for a particular purpose, non-infringement, absence -of latent or other defects, accuracy, or the presence or absence of errors, -whether or not known or discoverable. diff --git a/scripts/README.md b/scripts/README.md index 71ed667f2e..64b0536af3 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -33,7 +33,6 @@ For instance, `e689af57e7439b9005749d806248897ad550eab5_20150811_041632_uncommit The `update_version.py` script can be used to update FloPy version numbers. Running the script first updates the version in `version.txt`, then propagates the change to various other places version strings or timestamps are embedded in the repository: - `flopy/version.py` -- `flopy/DISCLAIMER.md` - `CITATION.cff` - `README.md` - `docs/PyPI_release.md` @@ -46,12 +45,10 @@ If the script is run with no arguments, the version number is not changed, but u python scripts/update_version.py -v 3.3.6 ``` -To get the current version number, use the `--get` flag: +To get the current version number, use the `--get` flag (short `-g`): ```shell -python scripts/update_version.py +python scripts/update_version.py -g ``` This simply returns the contents of `version.txt` and does not write any changes to the repository's files. - -By default, the script assumes a local development version of FloPy. The `--approve` flag should be used prior to releasing a new FloPy version. This will alter the `DISCLAIMER.md` file, substituting wording to indicate the version is no longer preliminary but approved for official release. See [the release docs](../docs/make_release.md) for more information. diff --git a/scripts/update_version.py b/scripts/update_version.py index 3f309f19c7..619a9e133f 100644 --- a/scripts/update_version.py +++ b/scripts/update_version.py @@ -1,5 +1,4 @@ import argparse -import json import re import textwrap from datetime import datetime @@ -9,6 +8,14 @@ from filelock import FileLock from packaging.version import Version +_epilog = """\ +Update version information stored in version.txt in the project root, +as well as several other files in the repository. If --version is not +provided, the version number will not be changed. A file lock is held +to synchronize file access. The version tag must comply with standard +'..' format conventions for semantic versioning. +To show the version without changing anything, use --get (short -g). +""" _project_name = "flopy" _project_root_path = Path(__file__).parent.parent _version_txt_path = _project_root_path / "version.txt" @@ -17,53 +24,21 @@ # file names and the path to the file relative to the repo root directory file_paths_list = [ _project_root_path / "CITATION.cff", - _project_root_path / "code.json", _project_root_path / "README.md", _project_root_path / "docs" / "PyPI_release.md", _project_root_path / "flopy" / "version.py", - _project_root_path / "flopy" / "DISCLAIMER.md", ] file_paths = {pth.name: pth for pth in file_paths_list} # keys for each file -approved_disclaimer = """Disclaimer ----------- - -This software is provided "as is" and "as-available", and makes no -representations or warranties of any kind concerning the software, whether -express, implied, statutory, or other. This includes, without limitation, -warranties of title, merchantability, fitness for a particular purpose, -non-infringement, absence of latent or other defects, accuracy, or the -presence or absence of errors, whether or not known or discoverable. -""" - -preliminary_disclaimer = """Disclaimer ----------- - -This software is preliminary or provisional and is subject to revision. It is -being provided to meet the need for timely best science. This software is -provided "as is" and "as-available", and makes no representations or warranties -of any kind concerning the software, whether express, implied, statutory, or -other. This includes, without limitation, warranties of title, -merchantability, fitness for a particular purpose, non-infringement, absence -of latent or other defects, accuracy, or the presence or absence of errors, -whether or not known or discoverable. -""" - - def split_nonnumeric(s): match = re.compile("[^0-9]").search(s) return [s[: match.start()], s[match.start() :]] if match else s -_initial_version = Version("0.0.1") _current_version = Version(_version_txt_path.read_text().strip()) -def get_disclaimer(approved: bool = False): - return approved_disclaimer if approved else preliminary_disclaimer - - def update_version_txt(version: Version): with open(_version_txt_path, "w") as f: f.write(str(version)) @@ -81,15 +56,10 @@ def update_version_py(timestamp: datetime, version: Version): print(f"Updated {_version_py_path} to version {version}") -def get_software_citation( - timestamp: datetime, version: Version, approved: bool = False -): +def get_software_citation(timestamp: datetime, version: Version): # get data Software/Code citation for FloPy citation = yaml.safe_load(file_paths["CITATION.cff"].read_text()) - sb = "" - if not approved: - sb = " (preliminary)" # format author names authors = [] for author in citation["authors"]: @@ -116,7 +86,7 @@ def get_software_citation( # add the rest of the citation line += ( - f", {timestamp.year}, FloPy v{version}{sb}: " + f", {timestamp.year}, FloPy v{version}: " f"U.S. Geological Survey Software Release, {timestamp:%d %B %Y}, " "https://doi.org/10.5066/F7BK19FH]" "(https://doi.org/10.5066/F7BK19FH)" @@ -125,83 +95,44 @@ def get_software_citation( return line -def update_codejson( - timestamp: datetime, version: Version, approved: bool = False -): - # define json filename - json_fname = file_paths["code.json"] - - # load and modify json file - data = json.loads(json_fname.read_text()) - - # modify the json file data - data[0]["date"]["metadataLastUpdated"] = timestamp.strftime("%Y-%m-%d") - data[0]["version"] = str(version) - data[0]["status"] = "Release" if approved else "Preliminary" - - # rewrite the json file - with open(json_fname, "w") as f: - json.dump(data, f, indent=4) - f.write("\n") - - print(f"Updated {json_fname} to version {version}") - - -def update_readme_markdown( - timestamp: datetime, version: Version, approved: bool = False -): - # create disclaimer text - disclaimer = get_disclaimer(approved) - +def update_readme_markdown(timestamp: datetime, version: Version): # read README.md into memory fpth = file_paths["README.md"] lines = fpth.read_text().rstrip().split("\n") # rewrite README.md - terminate = False - f = open(fpth, "w") - for line in lines: - if "### Version " in line: - line = f"### Version {version}" - if not approved: - line += " (preliminary)" - elif "[flopy continuous integration]" in line: - line = ( - "[![flopy continuous integration](https://github.com/" - "modflowpy/flopy/actions/workflows/commit.yml/badge.svg?" - "branch=develop)](https://github.com/modflowpy/flopy/actions/" - "workflows/commit.yml)" - ) - elif "[Read the Docs]" in line: - line = ( - "[![Read the Docs](https://github.com/modflowpy/flopy/" - "actions/workflows/rtd.yml/badge.svg?branch=develop)]" - "(https://github.com/modflowpy/flopy/actions/" - "workflows/rtd.yml)" - ) - elif "[Coverage Status]" in line: - line = ( - "[![Coverage Status](https://coveralls.io/repos/github/" - "modflowpy/flopy/badge.svg?branch=develop)]" - "(https://coveralls.io/github/modflowpy/" - "flopy?branch=develop)" - ) - elif "doi.org/10.5066/F7BK19FH" in line: - line = get_software_citation(timestamp, version, approved) - elif "Disclaimer" in line: - line = disclaimer - terminate = True - f.write(f"{line}\n") - if terminate: - break + with open(fpth, "w") as f: + for line in lines: + if "### Version " in line: + line = f"### Version {version}" + elif "[flopy continuous integration]" in line: + line = ( + "[![flopy continuous integration](https://github.com/" + "modflowpy/flopy/actions/workflows/commit.yml/badge.svg?" + "branch=develop)](https://github.com/modflowpy/flopy/actions/" + "workflows/commit.yml)" + ) + elif "[Read the Docs]" in line: + line = ( + "[![Read the Docs](https://github.com/modflowpy/flopy/" + "actions/workflows/rtd.yml/badge.svg?branch=develop)]" + "(https://github.com/modflowpy/flopy/actions/" + "workflows/rtd.yml)" + ) + elif "[Coverage Status]" in line: + line = ( + "[![Coverage Status](https://coveralls.io/repos/github/" + "modflowpy/flopy/badge.svg?branch=develop)]" + "(https://coveralls.io/github/modflowpy/" + "flopy?branch=develop)" + ) + elif "doi.org/10.5066/F7BK19FH" in line: + line = get_software_citation(timestamp, version) + + f.write(f"{line}\n") - f.close() print(f"Updated {fpth} to version {version}") - # write disclaimer markdown file - file_paths["DISCLAIMER.md"].write_text(disclaimer) - print(f"Updated {file_paths['DISCLAIMER.md']} to version {version}") - def update_citation_cff(timestamp: datetime, version: Version): # read CITATION.cff to modify @@ -225,28 +156,18 @@ def update_citation_cff(timestamp: datetime, version: Version): print(f"Updated {fpth} to version {version}") -def update_PyPI_release( - timestamp: datetime, version: Version, approved: bool = False -): - # create disclaimer text - disclaimer = get_disclaimer(approved) - +def update_pypi_release(timestamp: datetime, version: Version): # read PyPI_release.md into memory fpth = file_paths["PyPI_release.md"] lines = fpth.read_text().rstrip().split("\n") # rewrite PyPI_release.md - terminate = False f = open(fpth, "w") for line in lines: if "doi.org/10.5066/F7BK19FH" in line: - line = get_software_citation(timestamp, version, approved) - elif "Disclaimer" in line: - line = disclaimer - terminate = True + line = get_software_citation(timestamp, version) + f.write(f"{line}\n") - if terminate: - break f.close() print(f"Updated {fpth} to version {version}") @@ -255,7 +176,6 @@ def update_PyPI_release( def update_version( timestamp: datetime = datetime.now(), version: Version = None, - approved: bool = False, ): lock_path = Path(_version_txt_path.name + ".lock") try: @@ -270,10 +190,9 @@ def update_version( with lock: update_version_txt(version) update_version_py(timestamp, version) - update_readme_markdown(timestamp, version, approved) + update_readme_markdown(timestamp, version) update_citation_cff(timestamp, version) - update_codejson(timestamp, version, approved) - update_PyPI_release(timestamp, version, approved) + update_pypi_release(timestamp, version) finally: try: lock_path.unlink() @@ -285,15 +204,7 @@ def update_version( parser = argparse.ArgumentParser( prog=f"Update {_project_name} version", formatter_class=argparse.RawDescriptionHelpFormatter, - epilog=textwrap.dedent( - """\ - Update version information stored in version.txt in the project root, - as well as several other files in the repository. If --version is not - provided, the version number will not be changed. A file lock is held - to synchronize file access. The version tag must comply with standard - '..' format conventions for semantic versioning. - """ - ), + epilog=textwrap.dedent(_epilog), ) parser.add_argument( "-v", @@ -301,13 +212,6 @@ def update_version( required=False, help="Specify the release version", ) - parser.add_argument( - "-a", - "--approve", - required=False, - action="store_true", - help="Approve the release (defaults false)", - ) parser.add_argument( "-g", "--get", @@ -318,14 +222,11 @@ def update_version( args = parser.parse_args() if args.get: - print( - Version((_project_root_path / "version.txt").read_text().strip()) - ) + print(_current_version) else: update_version( timestamp=datetime.now(), version=( Version(args.version) if args.version else _current_version ), - approved=args.approve, )