From 09710e3eab3975c08e45ef0e891e556a0acfc58e Mon Sep 17 00:00:00 2001 From: rmorshea Date: Mon, 28 Jun 2021 19:55:35 -0700 Subject: [PATCH] add changelog entry for 0.30.0 also adds script to get PRs merged since the last release to make writing future changelog entries easier --- docs/source/changelog.rst | 43 ++++++++++++++++++++++++ noxfile.py | 36 +++----------------- scripts/latest_pull_requests.py | 59 +++++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 31 deletions(-) create mode 100644 scripts/latest_pull_requests.py diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index b5870c08e..9f1803716 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1,6 +1,49 @@ Changelog ========= +0.30.0 +------ + +With recent changes to the custom component interface, it's now possible to remove all +runtime reliance on NPM. Doing so has many virtuous knock-on effects: + +1. Removal of large chunks of code +2. Greatly simplifies how users dynamically experiment with React component libraries, + because their usage no longer requires a build step. Instead they can be loaded in + the browser from a CDN that distributes ESM modules. +3. The built-in client code needs to make fewer assumption about where static resources + are located, and as a result, it's also easier to coordinate the server and client + code. +4. Alternate client implementations benefit from this simplicity. Now, it's possible to + install idom-client-react normally and write a ``loadImportSource()`` function that + looks for route serving the contents of `IDOM_WEB_MODULES_DIR.` + +This change includes large breaking changes: + +- The CLI is being removed as it won't be needed any longer +- The `idom.client` is being removed in favor of a stripped down ``idom.web`` module +- The `IDOM_CLIENT_BUILD_DIR` config option will no longer exist and a new + ``IDOM_WEB_MODULES_DIR`` which only contains dynamically linked web modules. While + this new directory's location is configurable, it is meant to be transient and should + not be re-used across sessions. + +The new ``idom.web`` module takes a simpler approach to constructing import sources and +expands upon the logic for resolving imports by allowing exports from URLs to be +discovered too. Now, that IDOM isn't using NPM to dynamically install component +libraries ``idom.web`` instead creates JS modules from template files and links them +into ``IDOM_WEB_MODULES_DIR``. These templates ultimately direct the browser to load the +desired library from a CDN. + +**Pull Requests** + +- Add changelog entry for 0.30.0 - :pull:`415` +- Fix typo in index.rst - :pull:`411` +- Add event handlers docs - :pull:`410` +- Misc doc improvements - :pull:`409` +- Port first IDOM article to docs - :pull:`408` +- Test build in CI - :pull:`404` +- Remove all runtime reliance on NPM - :pull:`398` + 0.29.0 ------ diff --git a/noxfile.py b/noxfile.py index 9084feb2d..6e31e67e9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -3,9 +3,8 @@ import functools import os import re -import subprocess from pathlib import Path -from typing import Any, Callable, Tuple +from typing import Any, Callable import nox from nox.sessions import Session @@ -175,36 +174,11 @@ def test_docs(session: Session) -> None: session.run("sphinx-build", "-b", "doctest", "docs/source", "docs/build") -@nox.session -def commits_since_last_tag(session: Session) -> None: +@nox.session(reuse_venv=True) +def latest_pull_requests(session: Session) -> None: """A basic script for outputing changelog info""" - rst_format = "--format=rst" in session.posargs - - latest_tag = ( - subprocess.check_output(["git", "describe", "--tags", "--abbrev=0"]) - .decode() - .strip() - ) - commit_references = ( - subprocess.check_output( - ["git", "log", "--pretty=reference", f"{latest_tag}..HEAD"] - ) - .decode() - .strip() - .split("\n") - ) - - def parse_commit_reference(commit_ref: str) -> Tuple[str, str, str]: - commit_sha, remainder = commit_ref.split(" ", 1) - commit_message, commit_date = remainder[1:-1].rsplit(", ", 1) - return commit_sha, commit_message, commit_date - - for sha, msg, _ in map(parse_commit_reference, commit_references): - if rst_format: - sha_repr = f":commit:`{sha}`" - else: - sha_repr = sha - print(f"- {msg} - {sha_repr}") + session.install("requests", "python-dateutil") + session.run("python", "scripts/latest_pull_requests.py", *session.posargs) def install_requirements_file(session: Session, name: str) -> None: diff --git a/scripts/latest_pull_requests.py b/scripts/latest_pull_requests.py new file mode 100644 index 000000000..0239e344a --- /dev/null +++ b/scripts/latest_pull_requests.py @@ -0,0 +1,59 @@ +from __future__ import annotations + +import sys +from datetime import datetime +from typing import Any, Iterator + +import requests +from dateutil.parser import isoparse + + +REPO = "idom-team/idom" +STR_DATE_FORMAT = r"%Y-%m-%d" + + +def last_release() -> datetime: + response = requests.get(f"https://api.github.com/repos/{REPO}/releases/latest") + return isoparse(response.json()["published_at"]) + + +def pull_requests_after(date: datetime) -> Iterator[Any]: + then = date.strftime(STR_DATE_FORMAT) + now = datetime.now().strftime(STR_DATE_FORMAT) + query = f"repo:{REPO} type:pr merged:{then}..{now}" + + page = 0 + while True: + page += 1 + response = requests.get( + "https://api.github.com/search/issues", + {"q": query, "per_page": 15, "page": page}, + ) + + response_json = response.json() + + if response_json["incomplete_results"]: + raise RuntimeError(response) + + items = response_json["items"] + if items: + yield from items + else: + break + + +FORMAT_TEMPLATES = { + "md": f"- {{title}} - [#{{number}}](https://github.com/{REPO}/pull/{{number}})", + "rst": "- {title} - :pull:`{number}`", + "text": "- {title} - #{number}", +} + + +def main(format: str = "text"): + template = FORMAT_TEMPLATES[format] + for pr in pull_requests_after(last_release()): + print(template.format(**pr)) + + +if __name__ == "__main__": + main(*sys.argv[1:])