Skip to content
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
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DEFAULT_GOAL := all
sources = python/jsrun tests
# Pinned so lint results stay reproducible; bump deliberately.
ruff_version = 0.16.10

# using pip install cargo (via maturin via pip) doesn't get the tty handle
# so doesn't render color without some help
Expand Down Expand Up @@ -37,18 +39,18 @@ build-profiling:

.PHONY: format ## Auto-format rust and python source files
format:
uv tool run ruff format $(sources)
uv tool run ruff@$(ruff_version) format $(sources)
cargo fmt

.PHONY: lint-python ## Lint python source files
lint-python:
uv tool run ruff check $(sources)
uv tool run ruff format --check $(sources)
uv tool run ruff@$(ruff_version) check $(sources)
uv tool run ruff@$(ruff_version) format --check $(sources)

.PHONY: lint-python-fix ## Auto-fix python linting issues
lint-python-fix:
uv tool run ruff check --fix $(sources)
uv tool run ruff format $(sources)
uv tool run ruff@$(ruff_version) check --fix $(sources)
uv tool run ruff@$(ruff_version) format $(sources)

.PHONY: lint-rust ## Lint rust source files
lint-rust:
Expand Down
28 changes: 14 additions & 14 deletions python/jsrun/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""High-level Python bindings for the jsrun runtime."""

import contextvars
import asyncio
import atexit
import contextvars
import threading
from dataclasses import dataclass
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any, TypeVar, cast, overload

from ._jsrun import (
Expand Down Expand Up @@ -92,7 +92,7 @@ def _schedule_owner_cleanup(slot: _RuntimeSlot) -> None:
owner.add_done_callback(lambda _: slot.close())


setattr(Runtime, "bind", _runtime_bind)
Runtime.bind = _runtime_bind


_default_runtime_var: contextvars.ContextVar[_RuntimeSlot | None] = (
Expand Down Expand Up @@ -234,22 +234,22 @@ def bind_object(name: str, obj: dict) -> None:


__all__ = [
"eval",
"eval_async",
"get_default_runtime",
"close_default_runtime",
"bind_function",
"bind_object",
"Runtime",
"RuntimeConfig",
"InspectorConfig",
"InspectorEndpoints",
"SnapshotBuilder",
"JavaScriptError",
"JsFunction",
"JsStream",
"JsUndefined",
"Runtime",
"RuntimeConfig",
"RuntimeStats",
"JavaScriptError",
"RuntimeTerminated",
"SnapshotBuilder",
"bind_function",
"bind_object",
"close_default_runtime",
"eval",
"eval_async",
"get_default_runtime",
"undefined",
"JsStream",
]
2 changes: 1 addition & 1 deletion python/jsrun/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def main() -> None:
except JavaScriptError as e:
print(f"JavaScript Error: {e}", file=sys.stderr)
sys.exit(1)
except Exception as e:
except Exception as e: # noqa: BLE001 - CLI entrypoint reports any failure
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)

Expand Down
Loading