Skip to content

Commit

Permalink
Release 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 6, 2024
1 parent 50732cf commit 8e5e4cb
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/crate-ci/typos
# install: cargo install typos-cli
# run: typos

[default.extend-words]
teh = "teh" # part of @teh-cmc
35 changes: 20 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
# `egui_tiles` Changelog


## [Unreleased](https://github.com/rerun-io/egui_tiles/compare/latest...HEAD)
## [0.7.0](https://github.com/rerun-io/egui_tiles/compare/0.6.0...0.7.0) - 2024-02-06
* Add an API to move an existing tile to an give container and position index [#44](https://github.com/rerun-io/egui_tiles/pull/44)
* Properly handle grid layout with `Tree::move_tile_to_container()` [#45](https://github.com/rerun-io/egui_tiles/pull/45)
* Turn some warn logging to debug logging [#47](https://github.com/rerun-io/egui_tiles/pull/47)
* Add an `EditAction` parameter to the `Behavior::on_edit()` call [#48](https://github.com/rerun-io/egui_tiles/pull/48)
* Update to `egui` 0.26 [#49](https://github.com/rerun-io/egui_tiles/pull/49)


## [0.6.0](https://github.com/rerun-io/egui_tiles/compare/0.5.0...0.6.0) - 2024-01-08
* Update to egui 0.25 (#43)
* Update to egui 0.25 [#43](https://github.com/rerun-io/egui_tiles/pull/43)


## [0.5.0](https://github.com/rerun-io/egui_tiles/compare/0.4.0...0.5.0) - 2024-01-04
* Pass `TileId` to `make_active` closure (#35)
* Add `SimplificationOptions::OFF` (#38)
* Add `Tree::simplify_children_of_tile` (#39) (#41)
* Expose the internal `u64` part of `TileId` (#40)
* Fix simplification errors that result in warnings after removing panes (#41)
* Add `Tree::active_tiles` for getting visible tiles (#42)
* Pass `TileId` to `make_active` closure [#35](https://github.com/rerun-io/egui_tiles/pull/35)
* Add `SimplificationOptions::OFF` [#38](https://github.com/rerun-io/egui_tiles/pull/38)
* Add `Tree::simplify_children_of_tile` [#39) [#41](https://github.com/rerun-io/egui_tiles/pull/41)
* Expose the internal `u64` part of `TileId` [#40](https://github.com/rerun-io/egui_tiles/pull/40)
* Fix simplification errors that result in warnings after removing panes [#41](https://github.com/rerun-io/egui_tiles/pull/41)
* Add `Tree::active_tiles` for getting visible tiles [#42](https://github.com/rerun-io/egui_tiles/pull/42)


## [0.4.0](https://github.com/rerun-io/egui_tiles/compare/0.3.1...0.4.0) - 2023-11-23
* Fix Id clash when using multiple `Tree`s (#32)
* Scrollable tab bar (#9)
* `Behavior::on_tab_button` can now add context menus, on hover ui etc. (#23)
* `serde` is now and optional dependency (#13)
* Fix Id clash when using multiple `Tree`s [#32](https://github.com/rerun-io/egui_tiles/pull/32)
* Scrollable tab bar [#9](https://github.com/rerun-io/egui_tiles/pull/9)
* `Behavior::on_tab_button` can now add context menus, on hover ui etc. [#23](https://github.com/rerun-io/egui_tiles/pull/23)
* `serde` is now and optional dependency [#13](https://github.com/rerun-io/egui_tiles/pull/13)
* Update to egui 0.24
* Update MSRV to Rust 1.72


## [0.3.1](https://github.com/rerun-io/egui_tiles/compare/0.3.0...0.3.1) - 2023-09-29
* Report edits to user with `Behavior::on_edit` (#29)
* Make `Tree::simplify` public (#28)
* Add `Shares::set_share` method (#25)
* Report edits to user with `Behavior::on_edit` [#29](https://github.com/rerun-io/egui_tiles/pull/29)
* Make `Tree::simplify` public [#28](https://github.com/rerun-io/egui_tiles/pull/28)
* Add `Shares::set_share` method [#25](https://github.com/rerun-io/egui_tiles/pull/25)


## [0.3.0](https://github.com/rerun-io/egui_tiles/compare/0.2.0...0.3.0) - 2023-09-28
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name = "egui_tiles"
readme = "README.md"
repository = "https://github.com/rerun-io/egui_tiles"
rust-version = "1.72"
version = "0.6.0"
version = "0.7.0"

[package.metadata.docs.rs]
all-features = true
Expand Down
188 changes: 188 additions & 0 deletions generate_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
#!/usr/bin/env python3

"""
Summarizes recent PRs based on their GitHub labels.
The result can be copy-pasted into CHANGELOG.md,
though it often needs some manual editing too.
"""

import argparse
import multiprocessing
import os
import re
import sys
from datetime import date
from dataclasses import dataclass
from typing import Any, List, Optional

import requests
from git import Repo # pip install GitPython
from tqdm import tqdm

OWNER = "rerun-io"
REPO = "egui_tiles"
INCLUDE_LABELS = False # It adds quite a bit of visual noise
OFFICIAL_DEVS = [
"abey79",
"emilk",
"teh-cmc",
]


@dataclass
class PrInfo:
gh_user_name: str
pr_title: str
labels: List[str]


@dataclass
class CommitInfo:
hexsha: str
title: str
pr_number: Optional[int]


def get_github_token() -> str:
import os

token = os.environ.get("GH_ACCESS_TOKEN", "")
if token != "":
return token

home_dir = os.path.expanduser("~")
token_file = os.path.join(home_dir, ".githubtoken")

try:
with open(token_file, "r") as f:
token = f.read().strip()
return token
except Exception:
pass

print(
"ERROR: expected a GitHub token in the environment variable GH_ACCESS_TOKEN or in ~/.githubtoken"
)
sys.exit(1)


# Slow
def fetch_pr_info_from_commit_info(commit_info: CommitInfo) -> Optional[PrInfo]:
if commit_info.pr_number is None:
return None
else:
return fetch_pr_info(commit_info.pr_number)


# Slow
def fetch_pr_info(pr_number: int) -> Optional[PrInfo]:
url = f"https://api.github.com/repos/{OWNER}/{REPO}/pulls/{pr_number}"
gh_access_token = get_github_token()
headers = {"Authorization": f"Token {gh_access_token}"}
response = requests.get(url, headers=headers)
json = response.json()

# Check if the request was successful (status code 200)
if response.status_code == 200:
labels = [label["name"] for label in json["labels"]]
gh_user_name = json["user"]["login"]
return PrInfo(gh_user_name=gh_user_name, pr_title=json["title"], labels=labels)
else:
print(f"ERROR {url}: {response.status_code} - {json['message']}")
return None


def get_commit_info(commit: Any) -> CommitInfo:
match = re.match(r"(.*) \(#(\d+)\)", commit.summary)
if match:
title = str(match.group(1))
pr_number = int(match.group(2))
return CommitInfo(hexsha=commit.hexsha, title=title, pr_number=pr_number)
else:
return CommitInfo(hexsha=commit.hexsha, title=commit.summary, pr_number=None)


def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix) :]
return text # or whatever


def print_section(crate: str, items: List[str]) -> None:
if 0 < len(items):
print(f"#### {crate}")
for line in items:
print(f"* {line}")
print()


def main() -> None:
parser = argparse.ArgumentParser(description="Generate a changelog.")
parser.add_argument("--commit-range", help="e.g. 0.24.0..HEAD", required=True)
args = parser.parse_args()

repo = Repo(".")
commits = list(repo.iter_commits(args.commit_range))
commits.reverse() # Most recent last
commit_infos = list(map(get_commit_info, commits))

pool = multiprocessing.Pool()
pr_infos = list(
tqdm(
pool.imap(fetch_pr_info_from_commit_info, commit_infos),
total=len(commit_infos),
desc="Fetch PR info commits",
)
)

prs = []
unsorted_commits = []

for commit_info, pr_info in zip(commit_infos, pr_infos):
hexsha = commit_info.hexsha
title = commit_info.title
title = title.rstrip(".").strip() # Some PR end with an unnecessary period
pr_number = commit_info.pr_number

if pr_number is None:
# Someone committed straight to main:
summary = f"{title} [{hexsha[:7]}](https://github.com/{OWNER}/{REPO}/commit/{hexsha})"
unsorted_commits.append(summary)
else:
# We prefer the PR title if available
title = pr_info.pr_title if pr_info else title
labels = pr_info.labels if pr_info else []

if "exclude from changelog" in labels:
continue
if "typo" in labels:
# We get so many typo PRs. Let's not flood the changelog with them.
continue

summary = f"{title} [#{pr_number}](https://github.com/{OWNER}/{REPO}/pull/{pr_number})"

if INCLUDE_LABELS and 0 < len(labels):
summary += f" ({', '.join(labels)})"

if pr_info is not None:
gh_user_name = pr_info.gh_user_name
if gh_user_name not in OFFICIAL_DEVS:
summary += f" (thanks [@{gh_user_name}](https://github.com/{gh_user_name})!)"

prs.append(summary)

# Clean up:
for i in range(len(prs)):
line = prs[i]
line = line[0].upper() + line[1:] # Upper-case first letter
prs[i] = line

print()
print(f"Full diff at https://github.com/rerun-io/egui_tiles/compare/{args.commit_range}")
print()
print_section("PRs", prs)
print_section("Unsorted commits", unsorted_commits)

if __name__ == "__main__":
main()

0 comments on commit 8e5e4cb

Please sign in to comment.