Skip to content

Commit 06496b8

Browse files
committed
Include fixes from #16
1 parent 8232c3e commit 06496b8

7 files changed

Lines changed: 23 additions & 12 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ repos:
4040
- id: ruff-format
4141
name: ruff format
4242
description: Format python code with `ruff`.
43-
entry: uv run ruff format
43+
entry: uv run ruff format impl/py
4444
language: system
4545
files: \.py$
4646
pass_filenames: false
4747
- id: ruff-check
4848
name: ruff
4949
description: Check python code with `ruff`.
50-
entry: uv run ruff check --fix --exit-non-zero-on-fix
50+
entry: uv run ruff check --fix --exit-non-zero-on-fix impl/py
5151
language: system
5252
files: \.py$
5353
pass_filenames: false

impl/py/pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ classifiers = [
2727
]
2828

2929
dependencies = [
30-
# TODO: Temporarily disabled
31-
# "pycapnp ~= 2.0.0"
30+
"pycapnp~=2.0.0",
3231
]
3332

3433
[tool.hatch.build.targets.wheel]
3534
packages = ["src/jeff"]
3635

36+
[tool.uv.sources]
37+
pycapnp = { git = "https://github.com/mlxd/pycapnp", branch = "mlxd/update_gh_actions" }
38+
3739
[build-system]
3840
requires = ["hatchling"]
3941
build-backend = "hatchling.build"

impl/py/src/jeff/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def load_module(path: str) -> Module:
5555
"""Load a jeff module from file."""
5656

5757
with open(path, "rb") as f:
58-
return Module._read_from_buffer(schema.Module.read(f)) # type: ignore
58+
return Module._read_from_buffer(schema.Module.read(f))
5959

6060

6161
#################

impl/py/src/jeff/capnp/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
def load_schema() -> Any:
14-
import capnp # type: ignore[unused-ignore, import-not-found]
14+
import capnp # type: ignore[import-untyped]
1515

1616
capnp.remove_import_hook()
1717

@@ -95,6 +95,4 @@ def is_dirty(self) -> bool:
9595
return self._is_dirty
9696

9797

98-
# TODO: Temporarily disabled
99-
# schema = load_schema()
100-
schema = None
98+
schema = load_schema()

impl/py/src/jeff/module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def refresh(self) -> None:
8787

8888
# Reusing an existing message is a bad idea as any new allocations will leave the old ones
8989
# in the message, bloating its size.
90-
new_data = schema.Module.new_message() # type: ignore
90+
new_data = schema.Module.new_message()
9191
string_table = self._string_table
9292
self._write_to_buffer(new_data, string_table)
9393

@@ -98,7 +98,7 @@ def write_out(self, path: str) -> None:
9898
self.refresh()
9999

100100
with open(path, "wb") as f:
101-
self._raw_data.write(f)
101+
self._raw_data.as_builder().write(f)
102102

103103
@staticmethod
104104
def _read_from_buffer(module: schema.Module) -> Module: # type: ignore

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fix-rs:
2727
cargo clippy --all-targets --all-features --workspace --fix --allow-staged --allow-dirty
2828
# Auto-fix all the lints in the python code.
2929
fix-py:
30-
uv run ruff check --fix
30+
uv run ruff check --fix impl/py
3131

3232
# Format all the code in the repository.
3333
format: format-rs format-py

uv.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)