From ec22a8d9177b08ac21c3a4e86618722c479aa0ed Mon Sep 17 00:00:00 2001 From: jdhughes-usgs Date: Thu, 12 Dec 2019 16:28:11 -0500 Subject: [PATCH 1/2] refactor(release): update make-release script to generate author names --- README.md | 2 +- binder/environment.yml | 1 - code.json | 2 +- docs/PyPi_release.md | 2 +- docs/USGS_release.md | 6 +-- docs/make_release.md | 78 +++++++++++++-------------- flopy/version.py | 2 +- release/make-release.py | 116 ++++++++++++++++++++++++++++++---------- 8 files changed, 133 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index e5ab570e93..be30d571e7 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ How to Cite ##### ***Software/Code citation for FloPy:*** -[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2019, FloPy v3.3.0 — release candidate: U.S. Geological Survey Software Release, 18 November 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) +[Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N., 2019, FloPy v3.3.0 — release candidate: U.S. Geological Survey Software Release, 12 December 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) MODFLOW Resources diff --git a/binder/environment.yml b/binder/environment.yml index d68fecfc64..936af99cae 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -20,5 +20,4 @@ dependencies: - rasterio>=1.0 - rasterstats - pyshp - - hydrofunctions - pip diff --git a/code.json b/code.json index 7c5211c3bc..ee053eb104 100755 --- a/code.json +++ b/code.json @@ -31,7 +31,7 @@ "laborHours": -1, "version": "3.3.0", "date": { - "metadataLastUpdated": "2019-11-18" + "metadataLastUpdated": "2019-12-12" }, "organization": "U.S. Geological Survey", "permissions": { diff --git a/docs/PyPi_release.md b/docs/PyPi_release.md index 7849887904..9be0da600a 100644 --- a/docs/PyPi_release.md +++ b/docs/PyPi_release.md @@ -27,7 +27,7 @@ How to Cite *Software/Code citation for FloPy:* -[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2019, FloPy v3.3.0 — release candidate: U.S. Geological Survey Software Release, 18 November 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) +[Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N., 2019, FloPy v3.3.0 — release candidate: U.S. Geological Survey Software Release, 12 December 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) Disclaimer diff --git a/docs/USGS_release.md b/docs/USGS_release.md index 4efac2a394..826ef20ae3 100644 --- a/docs/USGS_release.md +++ b/docs/USGS_release.md @@ -12,7 +12,7 @@ author: - Michael W. Toews - Eric D. Morway - Jason C. Bellino - - Jeffrey Starn + - Jeffrey J. Starn - Michael N. Fienen header-includes: - \usepackage{fancyhdr} @@ -23,7 +23,7 @@ header-includes: - \fancyhead[CE, CO]{FloPy Release Notes} - \fancyfoot[LE, RO]{FloPy version 3.3.0} - \fancyfoot[CO, CE]{\thepage\ of \pageref{LastPage}} - - \fancyfoot[RE, LO]{11/18/2019} + - \fancyfoot[RE, LO]{12/12/2019} geometry: margin=0.75in --- @@ -56,7 +56,7 @@ How to Cite ##### ***Software/Code citation for FloPy:*** -[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., White, J.T., Starn, J.J., and Fienen, M.N., 2019, FloPy v3.3.0 — release candidate: U.S. Geological Survey Software Release, 18 November 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) +[Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N., 2019, FloPy v3.3.0 — release candidate: U.S. Geological Survey Software Release, 12 December 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) Disclaimer diff --git a/docs/make_release.md b/docs/make_release.md index f8881d7c6f..95fed2f348 100644 --- a/docs/make_release.md +++ b/docs/make_release.md @@ -4,12 +4,14 @@ Instructions for making a FloPy release ## Make a release branch from develop 1. Make a release branch from develop (*e.g.* `release3.2.10`) -2. Update MODFLOW 6 dfn files in the repository and MODFLOW 6 package classes by running: +2. Update MODFLOW 6 dfn files in the repository and MODFLOW 6 package classes by running: ``` python -c 'import flopy; flopy.mf6.utils.generate_classes(branch="master", backup=False)' ``` + Evaluate if there are any changes that seem to reduce MODFLOW 6 functionality before committing changes on the release branch. + ## Update the release version number @@ -58,43 +60,12 @@ Instructions for making a FloPy release 3. Make release on [GitHub website](https://github.com/modflowpy/flopy/releases). Add version changes for [current release](https://github.com/modflowpy/flopy/blob/develop/docs/version_changes.md) from to release text. Publish release. -## Update PyPi - -1. Make sure `pypandoc` and `twine` are installed using: - - ``` - conda search pypandoc - conda search twine - ``` - - -2. If they are not installed, install one or both using using: - - - ``` - conda install pypandoc - conda install twine - ``` - -3. Create the source zip file in a terminal using: - - ``` - python setup.py sdist --format=zip - ``` - -4. Upload the release to PyPi using (*make sure* `twine` *is installed using conda*): - - ``` - twine upload dist/flopy-version.zip - ``` - - ## Update flopy-feedstock for conda install 1. Download the `*.tar.gz` file for the current release from the [GitHub website](https://github.com/modflowpy/flopy/releases). 2. Calculate the sha256 checksum for the `*.tar.gz` using: - + ``` openssl sha256 flopy-version.tar.gz ``` @@ -107,8 +78,8 @@ Instructions for making a FloPy release cd /Users/jdhughes/Documents/Development/flopy-feedstock_git git fetch upstream git checkout master - git reset --hard upstream/master - git push origin master --force + git reset --hard upstream/master + git push origin master --force ``` 4. Rerender the repo using `conda-smithy` (make sure `conda-smithy` is installed using conda): @@ -124,6 +95,36 @@ Instructions for making a FloPy release 6. Make pull request to [flopy-feedstock](https://github.com/conda-forge/flopy-feedstock) +## Update PyPi + +1. Make sure `pypandoc` and `twine` are installed using: + + ``` + conda search pypandoc + conda search twine + ``` + + +2. If they are not installed, install one or both using using: + + + ``` + conda install pypandoc + conda install twine + ``` + +3. Create the source zip file in a terminal using: + + ``` + python setup.py sdist --format=zip + ``` + +4. Upload the release to PyPi using (*make sure* `twine` *is installed using conda*): + + ``` + twine upload dist/flopy-version.zip + ``` + ## Sync develop and master branches 1. Merge the `master` branch into the `develop` branch. @@ -134,8 +135,7 @@ Instructions for making a FloPy release ``` python make-release.py - ``` + ``` 4. Commit and push the modified `develop` branch. - - - \ No newline at end of file + + diff --git a/flopy/version.py b/flopy/version.py index 740abd95c8..63a31c618a 100644 --- a/flopy/version.py +++ b/flopy/version.py @@ -1,5 +1,5 @@ # flopy version file automatically created using...make-release.py -# created on...November 18, 2019 08:34:13 +# created on...December 12, 2019 16:22:42 major = 3 minor = 3 diff --git a/release/make-release.py b/release/make-release.py index 4488308b68..4a30ea891d 100644 --- a/release/make-release.py +++ b/release/make-release.py @@ -13,10 +13,10 @@ # as the path if the file is in the root repository directory paths = ['../flopy', '../', '../docs', '../docs', - '../', '../'] + '../', '../', '../docs'] files = ['version.py', 'README.md', 'USGS_release.md', 'PyPi_release.md', - 'code.json', 'DISCLAIMER.md'] + 'code.json', 'DISCLAIMER.md', 'notebook_examples.md'] # check that there are the same number of entries in files and paths if len(paths) != len(files): @@ -54,6 +54,16 @@ resulting from the authorized or unauthorized use of the software. ''' +# author list for software citation +# author should be defined LastName FirstName MiddleInitial +# MiddleInitial can be absent. Use spaces instead of commas to separate +# LastName, FirstName, and MiddleInitial. +authors = ['Bakker Mark', 'Post Vincent', 'Langevin Christian D', + 'Hughes Joseph D', 'White Jeremy T', 'Leaf Andrew T', + 'Paulinski Scott R', 'Larsen Joshua D', 'Toews Michael W', + 'Morway Eric D', 'Bellino Jason C', 'Starn Jeffrey J', + 'Fienen Michael N'] + def get_disclaimer(): # get current branch @@ -114,6 +124,32 @@ def get_tag(v0, v1, v2): tag = '.'.join(tag_type) return tag +def get_software_citation(version, is_approved): + now = datetime.datetime.now() + sb = '' + if not is_approved: + sb = ' — release candidate' + line = '[' + for ipos, author in enumerate(authors): + if ipos > 0: + line += ', ' + if ipos == len(authors) - 1: + line += 'and ' + sv = author.split() + tauthor = '{}, {}.'.format(sv[0], sv[1][0]) + if len(sv) > 2: + tauthor += ' {}.'.format(sv[2][0]) + line += tauthor + line += ', {}, '.format(now.year) + \ + 'FloPy v{}{}: '.format(version, sb) + \ + 'U.S. Geological Survey Software Release, ' + \ + '{}, '.format(now.strftime('%d %B %Y')) + \ + 'http://dx.doi.org/10.5066/F7BK19FH]' + \ + '(http://dx.doi.org/10.5066/F7BK19FH)' + + return line + + def update_version(): try: @@ -157,6 +193,9 @@ def update_version(): # update README.md with new version information update_readme_markdown(vmajor, vminor, vmicro) + # update notebook_examples.md + update_notebook_examples_markdown() + # update code.json update_codejson(vmajor, vminor, vmicro) @@ -232,27 +271,21 @@ def update_readme_markdown(vmajor, vminor, vmicro): 'modflowpy/flopy/badge.svg?branch={})]'.format(branch) + \ '(https://coveralls.io/github/modflowpy/' + \ 'flopy?branch={})'.format(branch) + elif '[Binder]' in line: + # [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/modflowpy/flopy.git/develop) + line = '[![Binder](https://mybinder.org/badge_logo.svg)]' + \ + '(https://mybinder.org/v2/gh/modflowpy/flopy.git/' + \ + '{}'.format(branch) + ')' elif 'http://dx.doi.org/10.5066/F7BK19FH' in line: - now = datetime.datetime.now() - sb = '' - if not is_approved: - sb = ' — release candidate' - line = '[Bakker, M., Post, V., Langevin, C.D., Hughes, J.D., ' + \ - 'White, J.T., Leaf, A.T., Paulinski, S.R., Larsen, J.D., ' + \ - 'Toews, M.W., Morway, E.D., Bellino, J.C., Starn, J.J., ' + \ - 'and Fienen, M.N., ' + \ - '{}, '.format(now.year) + \ - 'FloPy v{}{}: '.format(version, sb) + \ - 'U.S. Geological Survey Software Release, ' + \ - '{}, '.format(now.strftime('%d %B %Y')) + \ - 'http://dx.doi.org/10.5066/F7BK19FH]' + \ - '(http://dx.doi.org/10.5066/F7BK19FH)' + line = get_software_citation(version, is_approved) elif 'Disclaimer' in line: line = disclaimer terminate = True f.write('{}\n'.format(line)) if terminate: break + + f.close() # write disclaimer markdown file @@ -264,6 +297,34 @@ def update_readme_markdown(vmajor, vminor, vmicro): return +def update_notebook_examples_markdown(): + # create disclaimer text + is_approved, disclaimer = get_disclaimer() + + # define branch + if is_approved: + branch = 'master' + else: + branch = 'develop' + + # read notebook_examples.md into memory + fpth = os.path.join(paths[6], files[6]) + with open(fpth, 'r') as file: + lines = [line.rstrip() for line in file] + + # rewrite notebook_examples.md + terminate = False + f = open(fpth, 'w') + for line in lines: + if '[Binder]' in line: + # [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/modflowpy/flopy.git/develop) + line = '[![Binder](https://mybinder.org/badge_logo.svg)]' + \ + '(https://mybinder.org/v2/gh/modflowpy/flopy.git/' + \ + '{}'.format(branch) + ')' + f.write('{}\n'.format(line)) + f.close() + + def update_USGSmarkdown(vmajor, vminor, vmicro): # get branch branch = get_branch() @@ -295,19 +356,13 @@ def update_USGSmarkdown(vmajor, vminor, vmicro): f.write('---\n') f.write('title: FloPy Release Notes\n') f.write('author:\n') - f.write(' - Mark Bakker\n') - f.write(' - Vincent Post\n') - f.write(' - Christian D. Langevin\n') - f.write(' - Joseph D. Hughes\n') - f.write(' - Jeremy T. White\n') - f.write(' - Andrew T. Leaf\n') - f.write(' - Scott R. Paulinski\n') - f.write(' - Joshua D. Larsen\n') - f.write(' - Michael W. Toews\n') - f.write(' - Eric D. Morway\n') - f.write(' - Jason C. Bellino\n') - f.write(' - Jeffrey Starn\n') - f.write(' - Michael N. Fienen\n') + for author in authors: + sv = author.split() + tauthor = '{}'.format(sv[1]) + if len(sv) > 2: + tauthor += ' {}.'.format(sv[2][0]) + tauthor += ' {}'.format(sv[0]) + f.write(' - {}\n'.format(tauthor)) f.write('header-includes:\n') f.write(' - \\usepackage{fancyhdr}\n') f.write(' - \\usepackage{lastpage}\n') @@ -330,6 +385,9 @@ def update_USGSmarkdown(vmajor, vminor, vmicro): writeline = False elif line == 'How to Cite': writeline = True + elif 'http://dx.doi.org/10.5066/F7BK19FH' in line: + writeline = True + line = get_software_citation(version, is_approved) elif line == 'MODFLOW Resources': writeline = False elif line == 'Disclaimer': From ee855c339d626223ce0f0e1168bf6e6af8bfd068 Mon Sep 17 00:00:00 2001 From: jdhughes-usgs Date: Thu, 12 Dec 2019 16:36:28 -0500 Subject: [PATCH 2/2] refactor(release): clean-up make-release script and markdown --- docs/make_release.md | 5 +++++ release/make-release.py | 23 +++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/make_release.md b/docs/make_release.md index 95fed2f348..3a4615c076 100644 --- a/docs/make_release.md +++ b/docs/make_release.md @@ -18,6 +18,11 @@ Instructions for making a FloPy release 1. Increment `major`, `minor`, and/or `micro` numbers in `flopy/version.py`, as appropriate. +## Update the Software/Code citation for FloPy + +1. Update the `authors` list in `release/make-release.py` for the Software/Code citation for FloPy, if required. + + ## Build USGS release notes 1. Manually run `make-release.py` in the `release/` directory to update version information using: diff --git a/release/make-release.py b/release/make-release.py index 4a30ea891d..8285b2b180 100644 --- a/release/make-release.py +++ b/release/make-release.py @@ -27,6 +27,16 @@ pak = 'flopy' +# authors list for Software/Code citation for FloPy +# author should be defined LastName FirstName MiddleInitial +# MiddleInitial can be absent. Use spaces instead of commas to separate +# LastName, FirstName, and MiddleInitial. +authors = ['Bakker Mark', 'Post Vincent', 'Langevin Christian D', + 'Hughes Joseph D', 'White Jeremy T', 'Leaf Andrew T', + 'Paulinski Scott R', 'Larsen Joshua D', 'Toews Michael W', + 'Morway Eric D', 'Bellino Jason C', 'Starn Jeffrey J', + 'Fienen Michael N'] + approved = '''Disclaimer ---------- @@ -54,16 +64,6 @@ resulting from the authorized or unauthorized use of the software. ''' -# author list for software citation -# author should be defined LastName FirstName MiddleInitial -# MiddleInitial can be absent. Use spaces instead of commas to separate -# LastName, FirstName, and MiddleInitial. -authors = ['Bakker Mark', 'Post Vincent', 'Langevin Christian D', - 'Hughes Joseph D', 'White Jeremy T', 'Leaf Andrew T', - 'Paulinski Scott R', 'Larsen Joshua D', 'Toews Michael W', - 'Morway Eric D', 'Bellino Jason C', 'Starn Jeffrey J', - 'Fienen Michael N'] - def get_disclaimer(): # get current branch @@ -124,6 +124,7 @@ def get_tag(v0, v1, v2): tag = '.'.join(tag_type) return tag + def get_software_citation(version, is_approved): now = datetime.datetime.now() sb = '' @@ -150,7 +151,6 @@ def get_software_citation(version, is_approved): return line - def update_version(): try: fpth = os.path.join(paths[0], files[0]) @@ -285,7 +285,6 @@ def update_readme_markdown(vmajor, vminor, vmicro): if terminate: break - f.close() # write disclaimer markdown file