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/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 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 diff --git a/justfile b/justfile index 073e0b0..f5f8dc5 100644 --- a/justfile +++ b/justfile @@ -2,10 +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 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" }