Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed mypyc wheels failing in generate_tree #37

Merged
merged 5 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>" }]
license = { text = "MIT" }
Expand Down
Loading