boltz2-python-client v0.5.2.post1 - clean-install fix (lazy-import pandas) - #35
Open
nil16 wants to merge 1 commit into
Open
boltz2-python-client v0.5.2.post1 - clean-install fix (lazy-import pandas)#35nil16 wants to merge 1 commit into
nil16 wants to merge 1 commit into
Conversation
…ndas) PEP 440 post-release patch on top of v0.5.2 (just merged in #34). No public API changes; fixes a long-standing packaging defect that has been present since v0.5.0 and was carried into v0.5.2 unchanged. Caught during TestPyPI clean-install validation of v0.5.2: boltz2_client/virtual_screening.py did `import pandas as pd` at module top, but pandas is only declared in the [dev] extra (not a runtime dependency). Any clean pip install boltz2-python-client python -c "import boltz2_client" raised `ModuleNotFoundError: No module named 'pandas'`. The CLI (including the `boltz2 --version` flag added in 0.5.2) was equally unreachable on a clean install. Existing users almost universally have pandas pre-installed in their data-science envs, which is why this had not been reported. Fix: defer `import pandas as pd` into the four methods that actually use it (`CompoundLibrary.from_csv`, `VirtualScreeningResult.{to_dataframe,get_top_hits,get_statistics_by_group}`), add `from __future__ import annotations` so the `pd.DataFrame` return-type annotations are evaluated lazily, and add a `TYPE_CHECKING: import pandas as pd` block so static type checkers and IDEs continue to resolve the annotations. Verification on a clean venv with no pandas: pip install boltz2_python_client-0.5.2.post1-py3-none-any.whl python -c "import boltz2_client" # OK (was ModuleNotFoundError) boltz2 --version # boltz2 0.5.2.post1 134/134 unit tests pass; sdist + wheel both pass `twine check` with PEP 625-compliant filenames. Tagged on gitlab-master as v0.5.2.post1. Made-with: Cursor
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.
PEP 440 post-release patch on top of #34 (
v0.5.2). Tagged on gitlab-master asv0.5.2.post1. No public API changes; fixes a long-standing packaging defect.TL;DR
Three files, +56/-6. Defers an
import pandas as pdfrom module top into the four methods that actually use it, sopip install boltz2-python-clientfollowed byimport boltz2_clientworks on a clean env.pandasis not a runtime dependency (it's[dev]-only) — that's the root cause.Why
Caught during TestPyPI clean-install validation of
v0.5.2. The bug actually existed in0.5.0and0.5.1already published on PyPI:The CLI (including the
boltz2 --versionflag added inv0.5.2) was equally unreachable on a clean install. We never noticed because almost everyone haspandaspre-installed in their data-science env.What changed
boltz2_client/virtual_screening.pyimport pandas as pd.from __future__ import annotationsso thepd.DataFramereturn-type annotations on the affected methods are evaluated lazily and do not requirepandasat import time.TYPE_CHECKING: import pandas as pdblock so static type checkers and IDEs can still resolve those annotations.import pandas as pdinside the four methods that actually use pandas:CompoundLibrary.from_csvVirtualScreeningResult.to_dataframeVirtualScreeningResult.get_top_hitsVirtualScreeningResult.get_statistics_by_groupCalling any of those methods still requires pandas (unchanged); importing the package, running the CLI, and every other code path no longer does.
boltz2_client/__init__.py__version__0.5.2 -> 0.5.2.post1.CHANGELOG.md[0.5.2.post1] - 2026-02-24entry placed above[0.5.2]documenting the packaging fix and rationale.Verification
134/134unit tests pass on the post1 commit (no regression from the lazy-import refactor).twine checkPASSED for both wheel and sdist of0.5.2.post1.boltz2_python_client-0.5.2.post1-py3-none-any.whlandboltz2_python_client-0.5.2.post1.tar.gz.v0.5.2..v0.5.2.post1patch (modulo theexamples/nims/boltz-2/prefix). Verified by automated comparison.ModuleNotFoundError.Test plan
To reproduce the clean-install fix:
Note on PyPI plan
Once this PR is merged,
0.5.2.post1will be uploaded to TestPyPI first (clean-install validated) and then the same bytes to PyPI.pip install boltz2-python-clientwill resolve to0.5.2.post1for users onpip>=20.3. The0.5.2slot on TestPyPI is permanently sealed with the broken artifact (PyPI's policy); the0.5.2slot on PyPI will remain unused.Made with Cursor