Feature: pip-installable MDSplus "local" wheel - #3078
Draft
dgarnier wants to merge 1 commit into
Draft
Conversation
dgarnier
force-pushed
the
python-local-wheel
branch
from
July 26, 2026 09:58
581164b to
892608b
Compare
Build a small MDSplus wheel, at install time, into <prefix>/python/wheelhouse.
Its only payload is a MDSplus.pth (+ a _mdsplus_bootstrap.py it imports) that
points a Python environment at this install's python/MDSplus package -- a
redirect, not a copy. Gated behind ENABLE_PYTHON_LOCAL_WHEEL (default ON).
Why a wheel instead of PYTHONPATH=$MDSPLUS_DIR/python: setting PYTHONPATH makes
`import MDSplus` work but leaves the environment with no record that MDSplus is
installed. Shipping it as a real distribution means:
- MDSplus's dependencies (numpy, ...) are pulled in automatically by the
resolver instead of being wrangled out of band;
- it installs into a venv / uv-managed env and just works;
- other pyprojects can depend on `MDSplus` and resolve it from the local
wheelhouse (pip/uv --find-links, or a flat uv index) -- no per-project or
per-CI PYTHONPATH plumbing;
- being a redirect, it always imports the MDSplus that matches the installed
C libraries.
At import time the bootstrap back-determines MDSPLUS_DIR from the install the
wheel was built for and sets up its environment -- convenient for testing:
- startup is minimal: set MDSPLUS_DIR to the baked install (or $MDSPLUS_DIR
if it was relocated) and prepend its python/ to sys.path;
- on the first `import MDSplus`, if MDSPLUS_DIR was rewritten or the env is
not sourced, a one-shot import hook sources the install's setup.sh (honoring
local envsyms) and merges the resulting environment;
- it never spawns a process at plain startup and can never break the
interpreter; MDSPLUS_LOCAL_WHEEL_DISABLE=1 turns it off.
The wheel is assembled by make_wheel.py using only the standard library (no
build backend, no pip build isolation, no network); its dependencies and
metadata are copied from python/MDSplus/pyproject.toml so tooling reports the
genuine package info.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dgarnier
force-pushed
the
python-local-wheel
branch
from
July 27, 2026 12:08
892608b to
d1ed40d
Compare
github-actions Bot
pushed a commit
to dgarnier/homebrew-plasma
that referenced
this pull request
Jul 27, 2026
Carry the python-local-wheel feature (MDSplus/mdsplus#3078) as a patch: a redirect wheel is built into <prefix>/python/wheelhouse at install time (ENABLE_PYTHON_LOCAL_WHEEL), replacing the formula-built copy wheel, so venv/uv environments can `pip install --find-links` it. Test block: pin the venv to brewed python@3.13 (a uv-managed python3.13 earlier on PATH ships a pip too old for Homebrew's release-cooldown --uploaded-prior-to=P1D flag), assert the .pth redirect actually installs, and only exact-match the version on stable builds (Homebrew's HEAD-<sha> label never equals MDSplus's release tag). Revision bump so existing installs pick up the wheelhouse. Closes #34. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Darren Garnier <dgarnier@reinrag.net>
Contributor
Author
|
Testing this patch with homebrew here: https://github.com/dgarnier/homebrew-plasma/releases/tag/mdsplus-alpha_release-7-160-2_1 can install on macOS with: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As promised in the discussion about #3074, I had an idea for a re-direct python wheel.
The idea is just build a wheel that does the minimum and make a .pth. Claude and
I got together and got a little more clever than that, so we don't need to run python
packaging tools during the build.
An optional build step (
ENABLE_PYTHON_LOCAL_WHEEL, default on, easy to turnoff) that writes a small MDSplus wheel into
<prefix>/python/wheelhouse. Thewheel is a redirect, not a copy: its only payload is a
MDSplus.pththat addsthis install's
python/MDSplusto a Python environment.This is a nice-to-have, not a need-to-have. The usual
PYTHONPATH=$MDSPLUS_DIR/pythonworks fine for most uses. This method adds some other niceties.
pip install MDSplus --find-links $MDSPLUS_DIR/python/wheelhouseinto a venv pulls innumpyautomatically, which a barePYTHONPATHdoes not;MDSplusas a dependency and resolve it from thewheelhouse (
pip/uv --find-links) rather than wiringPYTHONPATHin eachproject or CI job.
Kept deliberately small and self-contained so it's cheap to maintain or ignore:
one
python/local_wheel/subdir, a stdlib-onlymake_wheel.py(no buildbackend, no network), and the
.pth/bootstrap. Nothing else depends on it, andit's behind a flag. Metadata and dependencies are copied from
python/MDSplus/pyproject.tomlsopip showreports the real package.Behavior of the redirect at runtime:
MDSPLUS_DIRto the install the wheel was builtfor (or
$MDSPLUS_DIRif it was relocated) and prepend itspython/tosys.path;import MDSplus, if needed, a one-shot hook sources thatinstall's
setup.shto populate the environment (handy for pointing athrowaway venv at a specific build when testing);
interpreter, and
MDSPLUS_LOCAL_WHEEL_DISABLE=1disables it.Draft while it gets more testing. See
python/local_wheel/README.mdfor usage.