Skip to content

[BUG] Make pyspark an optional extra on overture-schema-pyspark - #660

Open
Adam Lastowka (Rachmanin0xFF) wants to merge 4 commits into
mainfrom
Rachmanin0xFF/659-pyspark-optional-extra
Open

[BUG] Make pyspark an optional extra on overture-schema-pyspark#660
Adam Lastowka (Rachmanin0xFF) wants to merge 4 commits into
mainfrom
Rachmanin0xFF/659-pyspark-optional-extra

Conversation

@Rachmanin0xFF

Copy link
Copy Markdown
Contributor

Summary

Fixes #659. overture-schema-pyspark declared pyspark>=3.4 as a hard dependency, so installing the package resolves pyspark on every runtime — including ones (Glue, EMR) that already bundle their own PySpark and shouldn't have this package re-resolving a different version underneath it.

Change

Moves pyspark into [project.optional-dependencies] as a spark extra:

[project.optional-dependencies]
spark = ["pyspark>=3.4"]

pip install overture-schema-pyspark now resolves cleanly against a runtime-provided PySpark. Standalone environments building their own install overture-schema-pyspark[spark].

Verified

  • No other package in this repo depends on overture-schema-pyspark or imports pyspark directly — nothing else relies on the dependency being unconditional.
  • CI's make checkuv sync --all-packages --all-extras already installs all extras, so test coverage is unaffected.
  • Confirmed locally: uv sync --locked --package overture-schema-pyspark no longer pulls in pyspark.

Draft while this gets a look — no urgency on merge timing from my end.

pyspark was a hard dependency, so installing overture-schema-pyspark
resolved pyspark on every runtime, including ones (Glue, EMR) that already
bundle their own PySpark and don't want this package re-resolving it.

Moved it to a spark optional-dependency extra instead. Standalone
environments building their own PySpark now install
overture-schema-pyspark[spark]; runtime-provided-PySpark environments
install the bare package.

No other package in this repo depends on overture-schema-pyspark or
imports pyspark directly, and CI's make check already runs uv sync
--all-extras, so test coverage is unaffected.

Signed-off-by: Adam Lastowka <adamlastowka@gmail.com>
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

🗺️ Schema reference docs preview is live!

🌍 Preview https://staging.overturemaps.org/schema/pr/660/schema/index.html
🕐 Updated Aug 14, 2026 06:04 UTC
📝 Commit 0027e5e
🔧 env SCHEMA_PREVIEW true

Note

♻️ This preview updates automatically with each push to this PR.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me. Thx Adam Lastowka (@Rachmanin0xFF).

Seth Fitzsimmons (@sethfitz) could you take a look?

@vcschapp

Copy link
Copy Markdown
Collaborator

Adam Lastowka (@Rachmanin0xFF) is this meant to still be in draft mode?

@vcschapp Victor Schappert (vcschapp) changed the title [FIX] Make pyspark an optional extra on overture-schema-pyspark [BUG] Make pyspark an optional extra on overture-schema-pyspark Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do Glue/EMR manage their installed version of PySpark? It seems like “pip” (whichever) should be able to resolve the provided (external to the virtualenv) version, but that probably involves weird uv incantations. Or is it a version conflict?

No objections to doing it this way though.

@Rachmanin0xFF
Adam Lastowka (Rachmanin0xFF) marked this pull request as ready for review August 14, 2026 01:14
Copilot AI lite review requested due to automatic review settings August 14, 2026 01:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts overture-schema-pyspark packaging so environments that already bundle PySpark (e.g., AWS Glue/EMR) can install without re-resolving a potentially conflicting pyspark wheel.

Changes:

  • Moved pyspark>=3.4 from hard dependencies to an optional spark extra in packages/overture-schema-pyspark/pyproject.toml.
  • Updated uv.lock to reflect the new optional dependency/extra metadata.
  • Added a changelog entry documenting the new installation behavior.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
uv.lock Updates lock metadata so pyspark is only required when the spark extra is selected.
packages/overture-schema-pyspark/pyproject.toml Moves pyspark into [project.optional-dependencies] under the spark extra.
packages/overture-schema-pyspark/changelog.d/659.bugfix.md Documents the dependency change and how to install with/without PySpark.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/overture-schema-pyspark/pyproject.toml
@Rachmanin0xFF

Adam Lastowka (Rachmanin0xFF) commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Victor Schappert (@vcschapp) I was keeping it as a draft because I had Claude vibe-code it while I was in a rush and I hadn't had a chance to actually review it yet.

Seth Fitzsimmons (@sethfitz) I don't think it ever reaches pip at all, Glue just injects it right into the runtime and pip never has visibility into what version is present. So this is probably the easiest fix.

Importing overture.schema.pyspark without the spark extra installed
surfaced a bare ModuleNotFoundError: No module named 'pyspark', with
no indication that installing overture-schema-pyspark[spark] fixes it.

Guard the package's top-level imports and re-raise with an actionable
message pointing at the extra. Narrowed to ModuleNotFoundError on
pyspark specifically, so a genuinely broken pyspark install or an
unrelated missing dependency still surfaces its own real error.

Signed-off-by: Adam Lastowka <adamlastowka@gmail.com>
model_names,
validate_model,
)
except ModuleNotFoundError as e:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PySpark imports are a more appropriate place to put this guard, if we go with it.

I had the same initial reaction as Copilot, but talked myself out of it because PySpark is a special snowflake and the whole package effectively depends on it.

Testing the optional dependency at a direct import of pyspark is more
precise than wrapping the package's own re-exports and disambiguating
the exception by module name: an unrelated missing dependency now
surfaces its own error through the real imports instead of being caught
and inspected. Per review feedback on the extras change.

Signed-off-by: Adam Lastowka <adamlastowka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] overture-schema-pyspark declares pyspark as a hard dependency instead of an optional extra

4 participants