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
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ markers = [
data_file = "/tmp/wherewolf/.coverage"
timid = true

[tool.ty.rules]
# pyspark is an optional extra, so ty sees two different worlds. Without the extra
# installed, `from pyspark.sql import ...` is an unresolved-import; with it, that
# import resolves but `SparkSession.builder` does not (pyspark declares it as a
# classproperty ty cannot follow), producing unresolved-attribute instead. The two
# configurations therefore need opposite `ty: ignore` comments, and whichever set is
# not needed is reported as an unused directive. CI's lint leg installs
# `--extra spark`; a plain `uv sync` does not. Silencing unused-directive reports is
# what lets both suppressions coexist. Do not remove the `ty: ignore` comments in
# src/wherewolf/execution/spark_engine.py or tests/conftest.py because they look
# unused locally — they are load-bearing in the other configuration.
unused-ignore-comment = "ignore"

[dependency-groups]
dev = [
"hatch>=1.17.0",
Expand Down
2 changes: 1 addition & 1 deletion src/wherewolf/execution/spark_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _get_session(self) -> Any:
spark_session = import_module("pyspark.sql").SparkSession
root_session = (
# pyspark exposes `builder` dynamically, which ty cannot resolve.
spark_session.builder.appName("Wherewolf")
spark_session.builder.appName("Wherewolf") # ty: ignore[unresolved-attribute]
.master("local[1]")
.config("spark.driver.memory", "512m")
.config("spark.ui.enabled", "false")
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def spark_session() -> Iterator[Any]:
)

session = (
SparkSession.builder.appName("wherewolf-tests")
SparkSession.builder.appName("wherewolf-tests") # ty: ignore[unresolved-attribute]
.master("local[1]")
.config("spark.driver.memory", "512m")
.config("spark.ui.enabled", "false")
Expand Down
Loading