Skip to content

build: fix pythonwrapper brittleness and split pip requirements#534

Merged
oharboe merged 1 commit intomainfrom
python-dependency-fix
Mar 13, 2026
Merged

build: fix pythonwrapper brittleness and split pip requirements#534
oharboe merged 1 commit intomainfrom
python-dependency-fix

Conversation

@oharboe
Copy link
Collaborator

@oharboe oharboe commented Mar 12, 2026

Replace the brittle subprocess + PYTHONPATH propagation hack in pythonwrapper/python.py with runpy.run_path(), which runs scripts in-process and inherits sys.path natively. This avoids breakage when rules_python changes its bootstrap (as happened with 1.7+).

Split requirements.in into three tiers so downstream consumers of bazel-orfs only resolve the packages they actually need:

  • Core (requirements.in): PyYAML only — needed by ORFS flow
  • Features (requirements_features.in): matplotlib, najaeda — for orfs_ppa() and naja
  • Examples (requirements_examples.in, dev_dependency): pandas, optuna, plotly, kaleido — for DSE and test plots

Also drop dead pandas dependency from pythonwrapper (no ORFS flow script imports it).

Replace the brittle subprocess + PYTHONPATH propagation hack in
pythonwrapper/python.py with runpy.run_path(), which runs scripts
in-process and inherits sys.path natively. This avoids breakage
when rules_python changes its bootstrap (as happened with 1.7+).

Split requirements.in into three tiers so downstream consumers of
bazel-orfs only resolve the packages they actually need:

- Core (requirements.in): PyYAML only — needed by ORFS flow
- Features (requirements_features.in): matplotlib, najaeda — for
  orfs_ppa() and naja
- Examples (requirements_examples.in, dev_dependency): pandas,
  optuna, plotly, kaleido — for DSE and test plots

Also drop dead pandas dependency from pythonwrapper (no ORFS flow
script imports it).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Øyvind Harboe <[email protected]>
@oharboe
Copy link
Collaborator Author

oharboe commented Mar 13, 2026

@maliberty @hzeller FYI

@oharboe oharboe merged commit 58451e5 into main Mar 13, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant