From bca1b05a48657548cf451cedb81d014eb1581d3e Mon Sep 17 00:00:00 2001 From: tangkong Date: Fri, 30 Jun 2023 13:29:26 -0700 Subject: [PATCH 1/6] BLD: use pyproject extras to match new ci-helpers --- dev-requirements.txt | 1 + github_deploy_key_pcdshub_typhos.enc | 1 - pyproject.toml | 6 ++++++ 3 files changed, 7 insertions(+), 1 deletion(-) delete mode 100644 github_deploy_key_pcdshub_typhos.enc diff --git a/dev-requirements.txt b/dev-requirements.txt index 3aadbc0b..5de2f537 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -5,6 +5,7 @@ jinja2<3.1 line_profiler pytest pytest-benchmark +pytest-cov pytest-qt pytest-timeout simplejson diff --git a/github_deploy_key_pcdshub_typhos.enc b/github_deploy_key_pcdshub_typhos.enc deleted file mode 100644 index dc979d6c..00000000 --- a/github_deploy_key_pcdshub_typhos.enc +++ /dev/null @@ -1 +0,0 @@ -gAAAAABgma3xdixpQyBuXlnQntL7IJLk-5eWniHENKximqr2BCDmsI-IKxAm8nmKyTJ9qPHB6pYl5cfC2J7ZlWnXQuYksH1TrUAZjy2c4Sll2YfEDIrOSZbtqQjt4LD3Sdlqt5ukGGPbmsTspiD8C70K0zczXu-Vc6EjHJyW5FYP0Lzfx8qvOomW4mnITO5oRiAsApyvpa7AKm7SlIJreVTOwOnuui5b_aRSt0NdTbsU1EegycwEQA1gCLvJgmhSQdBajQtZ8_uiDWhff-Ug74HlD1mspS2mG79z-pMKiP2S6A_-6BhC02mi111zJf4j04slyarWWe3fmxWugrz-1vPncaeECKPoIZLDKuA-ney1HNWA_djzp1qX2b19VjPJeCmadKouXXIr2f_zFqCKEXdwoJno1VGai8CdEk2ppGd5p6qJSIIA-ifGxguDhJtlSZT9tIJAIYDog5Yroaxzxw-5qHYaNMxT07efW_WzkpvfvvETVzC3bBvit69KkJhPXE3q8X82_reeDxxVJXgcfwqWr34xo1_AJOMBV19rTDjJniRKtKzfWIpMEHv3NZipwZQp0Cfm1kdjC83iqQO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ecAP1jmVfVliA0QSpT3CJDViB2h_rOHRzORL2m2nmZe9vW8UbqsUlTxLTN2CxQ5lpMlP7xtd_R5MDVICqPrlo920GAYDbsYuN6Naa6vtD0BBtwV18HbW45TCJRgkjkxjODuQacdHbzBLJzbkRnZhw5uUZACQ5NZ6jz1RJfPb6k0Gj1jZT37XWdEGXuFDXT4et3XtURKa6eEF-_s-96jfGX43EoNyml1P1AMHmehOeHte06pWS-OjpD4tAeTJhrskHLt9HQjtEZJlIfbC7Fl1ETP6lnI67437jCaQpT8Awal64ptyuacOEXpTlUdN5ju7ParAtzRtY8aX2cKQyLpexFZATIKqhfbsG0H6zmJ4h1DmegQi1HCWfT-kfyl79N3rzogGMUHvPM0QlB3DxNg0y8H7goEWA3kBYKjOZaWaySzzuPCJHYWvKv-gEzWFCCnNjrqNJzu2jDrQH4Pu47KDTSS4pqr3v_wiGcx17tKv7So2Aix9T5OXpFuMFfrJf9-0ez4rg6EeKOlEXUN2Tcan7nN7DGJDKfwLJT7QK0Fb4l47eeeXbyODlZv3V9SC5rrdmfnMSKW7EbDnlnCunZatlL4UKcWb6BXb6MZtxYr5hslMxbZKB1xl3pnbP2RgFCoyf1Vgg6lhKQznQ39VGyHw== diff --git a/pyproject.toml b/pyproject.toml index 65a0d7db..8466ebd2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,9 @@ TyphosSignalPanelPlugin = "typhos.panel:TyphosSignalPanel" HappiPlugin = "typhos.plugins:HappiPlugin" SignalPlugin = "typhos.plugins:SignalPlugin" +[tool.pytest.ini_options] +addopts = "--cov=." + [tool.setuptools.packages.find] where = [ ".",] include = [ "typhos*",] @@ -59,3 +62,6 @@ file = [ "requirements.txt",] [tool.setuptools.dynamic.optional-dependencies.test] file = "dev-requirements.txt" + +[tool.setuptools.dynamic.optional-dependencies.doc] +file = "docs-requirements.txt" From 44db186a2e50cd2ffdabd44f047fa20f30f8863b Mon Sep 17 00:00:00 2001 From: tangkong Date: Fri, 30 Jun 2023 14:18:45 -0700 Subject: [PATCH 2/6] DOC: add pre-release notes scripts --- docs/pre-release-notes.sh | 37 ++++++ docs/release_notes.py | 114 ++++++++++++++++++ docs/source/release_notes.rst | 3 +- docs/source/upcoming_changes.rst | 8 ++ .../upcoming_release_notes/template-full.rst | 36 ++++++ .../upcoming_release_notes/template-short.rst | 22 ++++ 6 files changed, 218 insertions(+), 2 deletions(-) create mode 100755 docs/pre-release-notes.sh create mode 100644 docs/release_notes.py create mode 100644 docs/source/upcoming_changes.rst create mode 100644 docs/source/upcoming_release_notes/template-full.rst create mode 100644 docs/source/upcoming_release_notes/template-short.rst diff --git a/docs/pre-release-notes.sh b/docs/pre-release-notes.sh new file mode 100755 index 00000000..6e1e12b6 --- /dev/null +++ b/docs/pre-release-notes.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +ISSUE=$1 +shift +DESCRIPTION=$* + +if [[ -z "$ISSUE" || -z "$DESCRIPTION" ]]; then + echo "Usage: $0 (ISSUE NUMBER) (DESCRIPTION)" + exit 1 +fi + +re_issue_number='^[1-9][0-9]*$' + +if ! [[ "$ISSUE" =~ $re_issue_number ]]; then + echo "Error: Issue number is not a number: $ISSUE" + echo + echo "This should preferably be the issue number that this pull request solves." + echo "We may also accept the Pull Request number in place of the issue." + exit 1 +fi + +echo "Issue: $ISSUE" +echo "Description: $DESCRIPTION" + +FILENAME=source/upcoming_release_notes/${ISSUE}-${DESCRIPTION// /_}.rst + +pushd "$(dirname "$0")" || exit 1 + +sed -e "s/IssueNumber Title/${ISSUE} ${DESCRIPTION}/" \ + "source/upcoming_release_notes/template-short.rst" > "${FILENAME}" + +if ${EDITOR} "${FILENAME}"; then + echo "Adding ${FILENAME} to the git repository..." + git add "${FILENAME}" +fi + +popd || exit 0 diff --git a/docs/release_notes.py b/docs/release_notes.py new file mode 100644 index 00000000..97956038 --- /dev/null +++ b/docs/release_notes.py @@ -0,0 +1,114 @@ +import sys +import time +from collections import defaultdict +from pathlib import Path + +# find the pre-release directory and release notes file +THIS_DIR = Path(__file__).resolve().parent +PRE_RELEASE = THIS_DIR / 'source' / 'upcoming_release_notes' +TEMPLATE = PRE_RELEASE / 'template-short.rst' +RELEASE_NOTES = THIS_DIR / 'source' / 'release_notes.rst' + +# Set up underline constants +TITLE_UNDER = '#' +RELEASE_UNDER = '=' +SECTION_UNDER = '-' + + +def parse_pre_release_file(path): + """ + Return dict mapping of release notes section to lines. + + Uses empty list when no info was entered for the section. + """ + print(f'Checking {path} for release notes.') + with path.open('r') as fd: + lines = fd.readlines() + + section_dict = defaultdict(list) + prev = None + section = None + + for line in lines: + if prev is not None: + if line.startswith(SECTION_UNDER * 2): + section = prev.strip() + continue + if section is not None and line[0] in ' -': + notes = section_dict[section] + if len(line) > 6: + notes.append(line) + section_dict[section] = notes + prev = line + + return section_dict + + +def extend_release_notes(path, version, release_notes): + """ + Given dict mapping of section to lines, extend the release notes file. + """ + with path.open('r') as fd: + lines = fd.readlines() + + new_lines = ['\n', '\n'] + date = time.strftime('%Y-%m-%d') + release_title = f'{version} ({date})' + new_lines.append(release_title + '\n') + new_lines.append(len(release_title) * RELEASE_UNDER + '\n') + new_lines.append('\n') + for section, section_lines in release_notes.items(): + if section == 'Contributors': + section_lines = sorted(list(set(section_lines))) + if len(section_lines) > 0: + new_lines.append(section + '\n') + new_lines.append(SECTION_UNDER * len(section) + '\n') + new_lines.extend(section_lines) + new_lines.append('\n') + + output_lines = lines[:2] + new_lines + lines[2:] + + print('Writing out release notes file') + for line in new_lines: + print(line.strip('\n')) + with path.open('w') as fd: + fd.writelines(output_lines) + + +def main(version_number: str): + section_notes = parse_pre_release_file(TEMPLATE) + to_delete = [] + for path in PRE_RELEASE.iterdir(): + if path.name[0] in '1234567890': + to_delete.append(path) + extra_notes = parse_pre_release_file(path) + for section, notes in section_notes.items(): + notes.extend(extra_notes[section]) + section_notes[section] = notes + + extend_release_notes(RELEASE_NOTES, version_number, section_notes) + + print( + "* Wrote release notes. Please perform the following manually:", + file=sys.stderr, + ) + for path in to_delete: + print(f" git rm {path}", file=sys.stderr) + print(f" git add {RELEASE_NOTES}", file=sys.stderr) + + +if __name__ == '__main__': + if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} VERSION_NUMBER", file=sys.stderr) + sys.exit(1) + + version_number = sys.argv[1] + + if not version_number.startswith("v"): + print( + f"Version number should start with 'v': {version_number}", + file=sys.stderr + ) + sys.exit(1) + + main(version_number) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index c0745b58..c13c7f13 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -1,6 +1,5 @@ -================= Release History -================= +################ v2.4.1 (2023-4-4) ================= diff --git a/docs/source/upcoming_changes.rst b/docs/source/upcoming_changes.rst new file mode 100644 index 00000000..1323597c --- /dev/null +++ b/docs/source/upcoming_changes.rst @@ -0,0 +1,8 @@ +Upcoming Changes +################ + +.. toctree:: + :maxdepth: 1 + :glob: + + upcoming_release_notes/[0-9]* diff --git a/docs/source/upcoming_release_notes/template-full.rst b/docs/source/upcoming_release_notes/template-full.rst new file mode 100644 index 00000000..9f86b87e --- /dev/null +++ b/docs/source/upcoming_release_notes/template-full.rst @@ -0,0 +1,36 @@ +IssueNumber Title +################# + +Update the title above with your issue number and a 1-2 word title. +Your filename should be issuenumber-title.rst, substituting appropriately. + +Make sure to fill out any section that represents changes you have made, +or replace the default bullet point with N/A. + +API Changes +----------- +- List backwards-incompatible changes here. + Changes to PVs don't count as API changes for this library, + but changing method and component names or changing default behavior does. + +Features +-------- +- List new updates that add utility to many classes, + provide a new base classes, add options to helper methods, etc. + +Bugfixes +-------- +- List bug fixes that are not covered in the above sections. + +Maintenance +----------- +- List anything else. The intent is to accumulate changes + that the average user does not need to worry about. + +Contributors +------------ +- List your github username and anyone else who made significant + code or conceptual contributions to the PR. You don't need to + add reviewers unless their suggestions lead to large rewrites. + These will be used in the release notes to give credit and to + notify you when your code is being tagged. diff --git a/docs/source/upcoming_release_notes/template-short.rst b/docs/source/upcoming_release_notes/template-short.rst new file mode 100644 index 00000000..5e544ecf --- /dev/null +++ b/docs/source/upcoming_release_notes/template-short.rst @@ -0,0 +1,22 @@ +IssueNumber Title +################# + +API Changes +----------- +- N/A + +Features +-------- +- N/A + +Bugfixes +-------- +- N/A + +Maintenance +----------- +- N/A + +Contributors +------------ +- N/A From 507e12b06a4272f6f9ed2ed9deecc5c1c9c64abe Mon Sep 17 00:00:00 2001 From: tangkong Date: Fri, 30 Jun 2023 14:19:03 -0700 Subject: [PATCH 3/6] DOC: add pre-release notes --- .../556-bld_pyproj_extras.rst | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst diff --git a/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst b/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst new file mode 100644 index 00000000..e33193f5 --- /dev/null +++ b/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst @@ -0,0 +1,23 @@ +556 bld_pyproj_extras +################# + +API Changes +----------- +- N/A + +Features +-------- +- N/A + +Bugfixes +-------- +- N/A + +Maintenance +----------- +- Add pre-release notes scripts +- Update build requirements to use pip-provided extras for documentation and test builds + +Contributors +------------ +- tangkong From 2cd715c541c921b2a5ba3bcb1b3dc087b1ca7f4c Mon Sep 17 00:00:00 2001 From: tangkong Date: Fri, 30 Jun 2023 14:23:44 -0700 Subject: [PATCH 4/6] DOC: fix unintended indent --- docs/source/release_notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index c13c7f13..a8dc9a94 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -1,4 +1,4 @@ - Release History +Release History ################ v2.4.1 (2023-4-4) From 17080a4ecb3d8566923974d3a45ab1bbc8dbe31c Mon Sep 17 00:00:00 2001 From: tangkong Date: Fri, 30 Jun 2023 14:28:10 -0700 Subject: [PATCH 5/6] DOC: rst is finicky --- docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst b/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst index e33193f5..91c37357 100644 --- a/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst +++ b/docs/source/upcoming_release_notes/556-bld_pyproj_extras.rst @@ -1,5 +1,5 @@ 556 bld_pyproj_extras -################# +##################### API Changes ----------- From 87f777bf3a0fe1f5fafe86cc16b687216f196825 Mon Sep 17 00:00:00 2001 From: tangkong Date: Fri, 30 Jun 2023 14:44:55 -0700 Subject: [PATCH 6/6] DOC: update(?) Makefile to help docs build, msphinx deprecated? --- docs/Makefile | 4 ++-- docs/source/release_notes.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index e17be1a6..4406ac98 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,8 +2,8 @@ # # You can set these variables from the command line. -SPHINXOPTS = -W -SPHINXBUILD = python -msphinx +SPHINXOPTS = +SPHINXBUILD = sphinx-build SPHINXPROJ = Typhos SOURCEDIR = source BUILDDIR = build diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index a8dc9a94..d2b0f1c1 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -1,5 +1,5 @@ Release History -################ +############### v2.4.1 (2023-4-4) =================