From 2c0fadcc0df7b5207b3c2f85f8e220f4d10c538d Mon Sep 17 00:00:00 2001 From: trag1c Date: Wed, 29 May 2024 15:41:56 +0200 Subject: [PATCH 1/5] Replaced typing.cast with an assert to make mypyc happy --- crossandra/lib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crossandra/lib.py b/crossandra/lib.py index 79a55c0..cda3501 100644 --- a/crossandra/lib.py +++ b/crossandra/lib.py @@ -37,7 +37,8 @@ def generate_tree(inp: Iterable[tuple[str, Enum]]) -> Tree: curr = result for c in k[:-1]: curr = cast(Tree, curr.setdefault(c, {})) - if dct := cast(Tree, curr.get(k[-1])): + if dct := curr.get(k[-1]): + assert isinstance(dct, dict) # noqa: S101 (needed for mypyc) dct[""] = v else: curr[k[-1]] = v From 8debec6fb94dec54e17fb69dd95de6a330002417 Mon Sep 17 00:00:00 2001 From: trag1c Date: Wed, 29 May 2024 15:42:01 +0200 Subject: [PATCH 2/5] Included mypyc in mypy requirement --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 831c606..d5da5d0 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -mypy ~= 1.10.0 +mypy[mypyc] ~= 1.10.0 pytest ~= 8.2.0 pytest-cov ~= 5.0.0 ruff ~= 0.4.2 From c7083729848d6a83b3bf4d7b1d270a5f2dd06159 Mon Sep 17 00:00:00 2001 From: trag1c Date: Wed, 29 May 2024 15:42:10 +0200 Subject: [PATCH 3/5] Added a recipe for building mypyc wheels locally --- justfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/justfile b/justfile index 073e0b0..66e1303 100644 --- a/justfile +++ b/justfile @@ -2,6 +2,11 @@ default: @just --list +build: + uv pip uninstall crossandra 2> /dev/null + rm -rf build + python setup.py install + install: uv venv uv pip install . -r dev-requirements.txt From ca42f4d649a61a2773b87c533f931f50935b3737 Mon Sep 17 00:00:00 2001 From: trag1c Date: Wed, 29 May 2024 15:46:43 +0200 Subject: [PATCH 4/5] Bumped version, updated changelog --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 693f328..e0c8a3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.2.1] - 2024-05-29 + +### Fixed +- Fixed mypyc wheels failing to generate a tree for a non-empty enum ([#36]) + +[#36]: https://github.com/trag1c/crossandra/issues/36 + ## [2.2.0] - 2024-05-29 ### Added @@ -135,3 +142,4 @@ Initial release 🎉 [2.0.0]: https://github.com/trag1c/crossandra/compare/1.3.0...2.0.0 [2.1.0]: https://github.com/trag1c/crossandra/compare/2.0.0...2.1.0 [2.2.0]: https://github.com/trag1c/crossandra/compare/2.1.0...2.2.0 +[2.2.1]: https://github.com/trag1c/crossandra/compare/2.2.0...2.2.1 diff --git a/pyproject.toml b/pyproject.toml index 1bf7031..ba6d12e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "crossandra" -version = "2.2.0" +version = "2.2.1" description = "A fast and simple enum/regex-based tokenizer with decent configurability" authors = [{ email = "trag1c " }] license = { text = "MIT" } From cff52596a634c6b55dfc5454aef8c7038b5c2e46 Mon Sep 17 00:00:00 2001 From: trag1c Date: Wed, 29 May 2024 15:47:14 +0200 Subject: [PATCH 5/5] Added recipe descriptions --- justfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/justfile b/justfile index 66e1303..f5f8dc5 100644 --- a/justfile +++ b/justfile @@ -2,15 +2,18 @@ default: @just --list +# Builds mypyc wheels locally build: uv pip uninstall crossandra 2> /dev/null rm -rf build python setup.py install +# Installs the project install: uv venv uv pip install . -r dev-requirements.txt +# Runs pytest, mypy, ruff check: python -m pytest --cov crossandra --cov-report term-missing mypy --strict crossandra tests