Skip to content

Commit

Permalink
Fixed mypyc wheels failing in generate_tree (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
trag1c authored May 29, 2024
1 parent a2642be commit 779a2c5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion crossandra/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <trag1cdev@yahoo.com>" }]
license = { text = "MIT" }
Expand Down

0 comments on commit 779a2c5

Please sign in to comment.