use packmol from PyPI - #87
Conversation
WalkthroughRemoves the bundled Packmol submodule and its build hook, deletes the Packmol Python wrapper, updates pyproject (version bump and external packmol dependency), simplifies CI to a single pypi-publish job, and updates pack() to require an external Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer / CI trigger
participant OldCI as Old CI (matrix)
participant BuildOld as Build jobs
participant Hook as hatch_build (compile)
participant PyPI as PyPI
Dev->>OldCI: push/release/PR
OldCI->>BuildOld: matrix builds (wheels, sdist)
BuildOld->>Hook: run hatch_build -> compile Packmol
Hook-->>BuildOld: include compiled binary in wheel
BuildOld->>PyPI: upload artifacts
sequenceDiagram
autonumber
participant Dev as Developer / CI trigger
participant NewCI as New CI (pypi-publish)
participant Build as Build step
participant PyPI as PyPI
Dev->>NewCI: workflow_dispatch / release
NewCI->>Build: checkout → setup-uv → build (uses `packmol` dependency)
Build->>PyPI: publish built wheel directly
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pyproject.toml (1)
42-42: Script entry point references removed module.The script entry point
packmol = "molify.packmol:packmol_cli"referencesmolify.packmol:packmol_cli, but according to the AI summary, the entiresrc/molify/packmol.pymodule was removed in this PR. This will cause an import error when users install the package.Apply this diff to remove the stale entry point:
-[project.scripts] -packmol = "molify.packmol:packmol_cli" -
🧹 Nitpick comments (1)
src/molify/pack.py (1)
171-172: Update docstring to mention system PATH requirement.The docstring should explicitly state that the
packmolparameter expects an executable that's either in the system PATH or provided as an absolute path, and that users must install Packmol separately (e.g., viapip install packmol).Apply this diff to clarify the documentation:
packmol : str, optional - The path to the packmol executable. + The path to the packmol executable, by default "packmol". + Requires packmol to be installed (pip install packmol) and + available in PATH, or provide an absolute path to the executable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
.github/workflows/build-wheels.yaml(1 hunks).gitmodules(0 hunks)external/packmol(0 hunks)hatch_build.py(0 hunks)pyproject.toml(2 hunks)src/molify/pack.py(2 hunks)src/molify/packmol.py(0 hunks)
💤 Files with no reviewable changes (4)
- hatch_build.py
- .gitmodules
- src/molify/packmol.py
- external/packmol
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: pytest (3.10, windows-latest)
- GitHub Check: pytest (3.11, macos-15-intel)
- GitHub Check: pytest (3.10, macos-latest)
- GitHub Check: pytest (3.10, macos-15-intel)
- GitHub Check: pytest (3.12, ubuntu-latest)
- GitHub Check: pytest (3.12, windows-latest)
- GitHub Check: pytest (3.11, windows-latest)
- GitHub Check: pytest (3.12, macos-15-intel)
- GitHub Check: pytest (3.13, macos-15-intel)
- GitHub Check: pytest (3.13, windows-latest)
🔇 Additional comments (1)
.github/workflows/build-wheels.yaml (1)
9-25: LGTM! Excellent simplification.The workflow is significantly cleaner now that Packmol is an external dependency rather than a bundled binary. The shift to a single-job,
uv-based build pipeline removes complexity around matrix builds, submodule handling, and platform-specific binary compilation.
| "ase>=3.25.0", | ||
| "matplotlib>=3.10.1", | ||
| "networkx>=3.4.2", | ||
| "packmol>=0.1.0", |
There was a problem hiding this comment.
🧩 Analysis chain
Verify that packmol version 0.1.0 is available on PyPI.
The PR description mentions waiting for a PyPI release with the correct version number. Ensure that packmol>=0.1.0 is published and accessible before merging.
🌐 Web query:
Is packmol version 0.1.0 or higher available on PyPI?
💡 Result:
Short answer: No — the PACKMOL program is not published as a "packmol" package on PyPI. It is distributed from the project (source/binaries) and via conda-forge (or via the Packmol.jl wrapper). See the official project and installation instructions. [1][2]
Sources:
- Packmol official (download/install instructions). [1]
- Packmol GitHub repository. [2]
- Example PyPI-using projects recommending conda install -c conda-forge packmol (e.g., mdinterface). [3]
Remove or correct the invalid packmol dependency in pyproject.toml.
The PACKMOL program is not published as a "packmol" package on PyPI. The line "packmol>=0.1.0", will fail during package installation when pip cannot resolve this dependency. It is distributed from the project source/binaries and via conda-forge. Either remove this dependency if it's optional, or update to use the correct package distribution method (conda-forge), or verify if there is a different PyPI package that provides the required functionality.
🤖 Prompt for AI Agents
In pyproject.toml around line 15, the dependency entry "packmol>=0.1.0" is
invalid because PACKMOL is not published to PyPI; remove this line or move it to
optional/development extras and update installation docs to instruct users to
install PACKMOL via conda-forge (or from project binaries) instead;
alternatively, if you rely on a different PyPI package that wraps PACKMOL,
replace the entry with that validated package name and version and add a note in
pyproject or README about the required external installation method.
| tolerance: float = 2, | ||
| verbose: bool = False, | ||
| packmol: str | None = None, | ||
| packmol: str = "packmol", |
There was a problem hiding this comment.
🧩 Analysis chain
Breaking change: Verify documentation and migration guide.
Changing from packmol: str | None = None to packmol: str = "packmol" is a breaking change. Users who previously relied on the bundled Packmol binary will now need to install Packmol separately and ensure it's available in their system PATH.
Run the following script to check if the README or documentation mentions the new Packmol installation requirement:
🏁 Script executed:
#!/bin/bash
# Check if documentation mentions packmol installation requirement
echo "=== Checking README ==="
fd -t f "README" --exec cat {} \; | grep -i "packmol" -C 3
echo -e "\n=== Checking docs directory ==="
fd -t f . docs/ --exec grep -l "packmol" {} \; 2>/dev/null | head -5
echo -e "\n=== Checking for installation instructions ==="
rg -i "install.*packmol|packmol.*install|pip install.*packmol" -C 2Length of output: 967
🏁 Script executed:
#!/bin/bash
# Check documentation content and changelog
echo "=== README content (full) ==="
fd -t f "README*" --exec cat {} \;
echo -e "\n=== Checking docs/source/index.rst ==="
cat docs/source/index.rst 2>/dev/null | head -100
echo -e "\n=== Looking for CHANGELOG or version notes ==="
fd -t f "CHANGELOG|HISTORY|CHANGES|NEWS" --exec cat {} \; 2>/dev/null | head -50
echo -e "\n=== Checking if pack.py has error messages about packmol ==="
rg -n "packmol" src/molify/pack.py | head -20Length of output: 6392
🏁 Script executed:
#!/bin/bash
# Check setup configuration and error handling
echo "=== Checking setup.py / pyproject.toml ==="
fd -t f "setup.py|pyproject.toml|setup.cfg" --exec cat {} \;
echo -e "\n=== Error handling in pack.py around line 227-234 ==="
sed -n '220,240p' src/molify/pack.py
echo -e "\n=== Full _run_packmol function ==="
sed -n '63,80p' src/molify/pack.pyLength of output: 2791
🌐 Web query:
What does the packmol package on PyPI provide?
💡 Result:
There isn't an official "packmol" Python library on PyPI that contains the PACKMOL solver itself. PACKMOL is a standalone packing program (source/binaries distributed from the project site and via conda-forge) that creates initial molecular configurations for MD simulations. PyPI instead hosts related packages that wrap or integrate PACKMOL (e.g. packmol-step — a SEAMM plug‑in for building periodic fluid boxes; mdapackmol — an MDAnalysis wrapper around Packmol). [1][2][3]
Sources:
- PACKMOL official site / project (download, description). [1]
- packmol-step (PyPI) — SEAMM plug‑in using Packmol. [2]
- mdapackmol (PyPI) — MDAnalysis wrapper around Packmol. [3]
🌐 Web query:
packmol PyPI package what is it
💡 Result:
Short answer: "Packmol" is primarily a standalone program (written in Fortran) that builds initial molecular configurations by packing molecules into user‑defined regions for molecular‑dynamics or docking setups. It is not primarily a pure‑Python PyPI package — instead you usually install the Packmol executable (e.g., from the Packmol GitHub/releases or via conda‑forge) and use Python wrappers on PyPI that call it (examples: mdapackmol, packmol-step). Sources: Packmol GitHub (project & install info) [1], PyPI pages for Python wrappers (mdapackmol, packmol‑step) [2][3].
References
- Packmol GitHub (project, build/install instructions). [1]
- mdapackmol — "An MDAnalysis wrapper around Packmol" (PyPI). [2]
- packmol-step — SEAMM/Packmol plugin (PyPI). [3]
🌐 Web query:
packmol 0.1.0 PyPI package
💡 Result:
There is no official PyPI package named "packmol" (version 0.1.0) — PACKMOL is distributed from its upstream site and via OS packages; Python wrappers/integration packages exist on PyPI (e.g., packmol-step, mdapackmol). Sources: PACKMOL upstream (download/docs). [1] Packmol-step on PyPI. [2] MDAPackmol on PyPI. [3]
Sources
- PACKMOL homepage (upstream downloads/docs). [1]
- packmol-step on PyPI (example PyPI package integrating PACKMOL). [2]
- mdapackmol on PyPI (MDAnalysis wrapper around PACKMOL). [3]
🏁 Script executed:
#!/bin/bash
# Check if there's actually a packmol package on PyPI or if this is a broken dependency
echo "=== Searching for any reference to packmol package in repo ==="
rg -i "packmol" pyproject.toml setup.py setup.cfg 2>/dev/null
echo -e "\n=== Checking if packmol is imported anywhere ==="
fd -t f "\.py$" --exec grep -l "import packmol\|from packmol" {} \; 2>/dev/null
echo -e "\n=== Looking at imports in pack.py ==="
head -30 src/molify/pack.pyLength of output: 1268
🏁 Script executed:
#!/bin/bash
# Final verification - check git history or comments about packmol dependency
echo "=== Checking git log for packmol changes ==="
git log --oneline -20 2>/dev/null | head -10
echo -e "\n=== Check if this is perhaps a typo or if packmol.py file exists ==="
fd -t f "packmol" src/
echo -e "\n=== Look at molify.packmol module (referenced in pyproject.toml) ==="
fd -t f "packmol.py" --exec head -50 {} \;Length of output: 649
🏁 Script executed:
#!/bin/bash
# Check the latest commit details
echo "=== Full commit message for latest packmol change ==="
git show df9c6e8 --stat 2>/dev/null
echo -e "\n=== What changed in that commit ==="
git show df9c6e8 --no-stat 2>/dev/null | head -100
echo -e "\n=== Check if packmol package actually exists by searching PyPI ==="
python3 << 'EOF'
import urllib.request
import json
try:
with urllib.request.urlopen("https://pypi.org/pypi/packmol/json") as response:
data = json.loads(response.read().decode())
print(f"Package found: {data['info']['name']}")
print(f"Latest version: {data['info']['version']}")
print(f"Description: {data['info']['summary']}")
except urllib.error.HTTPError as e:
print(f"Package not found on PyPI (HTTP {e.code})")
EOFLength of output: 2740
Multiple critical issues: Broken dependency, misleading documentation, and unhandled breaking change.
The breaking change itself is legitimate, but the implementation has critical flaws:
-
Broken PyPI dependency:
pyproject.tomllistspackmol>=0.1.0, but web search confirms no official PyPI package named "packmol" exists. Installation will fail with "ERROR: Could not find a version that satisfies the requirement packmol>=0.1.0". -
Outdated README: README states "The molify package ships with an installation of packmol" — this is now false and will confuse users.
-
Insufficient error handling: The subprocess call to packmol (line 72 in
_run_packmol) will fail silently or with a cryptic error if the executable is missing. No validation before attempting execution. -
Missing installation guidance: Users upgrading will face installation failure, then need to manually install packmol externally — but there's no documentation explaining this requirement or how to install the actual PACKMOL binary from the official source.
Remove the broken packmol>=0.1.0 dependency from pyproject.toml, update the README and documentation to clearly state that PACKMOL must be installed separately (e.g., via conda-forge or from the official GitHub), and add validation in the code to provide a helpful error message if the packmol executable is not found.
🤖 Prompt for AI Agents
In src/molify/pack.py around line 149, the constant packmol: str = "packmol" and
related code must guard against missing external PACKMOL binary and inform
docs/package metadata: update code to check for the packmol executable before
invoking subprocess (use shutil.which or pathlib to verify PATH), raise a clear,
user-facing exception with actionable install instructions (e.g., "PACKMOL
executable not found; install via conda-forge or from
https://github.com/wordom/packmol") if not found, and ensure subprocess calls
only run after this validation; separately remove the invalid pyproject
dependency on packmol>=0.1.0 and update README/docs to state PACKMOL is an
external dependency with installation guidance.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pyproject.toml (1)
42-42: ---Critical: Remove entry point that references deleted module.
The entry point at line 42 (
packmol = "molify.packmol:packmol_cli") referencesmolify.packmol, which no longer exists—src/molify/packmol.pyhas been removed in this PR. This will causeModuleNotFoundError: No module named 'molify.packmol'when users invoke thepackmolCLI command.Remove this entry point from
pyproject.tomlline 42, or restore thepackmolwrapper module if it should remain available.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (1)
pyproject.toml(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: pytest (3.11, macos-latest)
- GitHub Check: pytest (3.10, macos-15-intel)
- GitHub Check: pytest (3.11, windows-latest)
- GitHub Check: pytest (3.12, macos-15-intel)
- GitHub Check: pytest (3.13, macos-15-intel)
- GitHub Check: pytest (3.11, macos-15-intel)
- GitHub Check: pytest (3.12, windows-latest)
- GitHub Check: pytest (3.13, windows-latest)
🔇 Additional comments (1)
pyproject.toml (1)
3-3: Version bump is appropriate.The patch version increment (0.2.0 → 0.2.1) aligns with refactoring the packmol integration without breaking the public API.
| "ase>=3.25.0", | ||
| "matplotlib>=3.10.1", | ||
| "networkx>=3.4.2", | ||
| "packmol>=21.1.2", |
There was a problem hiding this comment.
🧩 Analysis chain
Critical: Invalid PyPI dependency — packmol is not published on PyPI.
The dependency "packmol>=21.1.2" cannot be resolved. The PACKMOL program is not distributed as a package on PyPI; it is distributed via GitHub releases, conda-forge, or compiled from source. This matches the issue flagged in the previous review. The PR description indicates the checklist item "wait for PyPI release of packmol with correct version number" is still unchecked, confirming the PyPI package is not yet available.
pip install molify will fail when this dependency cannot be resolved.
Please confirm the package availability:
If PACKMOL is not published to PyPI, consider:
- Making it optional: Move to
[project.optional-dependencies]or[dependency-groups]dev if packmol is only needed for certain features. - Using conda instead: Update installation docs to guide users to
conda install -c conda-forge packmolbeforepip install molify. - Waiting for upstream: Ensure the PACKMOL project actually publishes to PyPI before merging this PR.
🌐 Web query:
Is there a "packmol" package version 21.1.2 available on PyPI?
💡 Result:
Short answer: No — Packmol (including v21.1.2) is not available on PyPI. Packmol is distributed from its source/GitHub and via conda-forge (conda); mbuild and other docs note PACKMOL is not on pip. (github.com)
Citations:
Critical: Remove invalid PyPI dependency — packmol is not published on PyPI.
Packmol (including v21.1.2) is not available on PyPI and is distributed from its source/GitHub and via conda-forge. The dependency "packmol>=21.1.2" cannot be resolved during pip install molify, causing installation to fail. The PR description checklist confirms the PyPI release is still pending (unchecked item: "wait for PyPI release of packmol with correct version number").
Remove this line from pyproject.toml or move packmol to optional dependencies until the package is officially released to PyPI. If packmol is required for certain features only, use [project.optional-dependencies] and update documentation to guide users to install via conda install -c conda-forge packmol first.
🤖 Prompt for AI Agents
In pyproject.toml around line 15, the dependency "packmol>=21.1.2" is invalid
because Packmol is not on PyPI; remove that line or move packmol into
[project.optional-dependencies] (e.g. extras like "packmol") and update project
docs/README to instruct users to install packmol via conda-forge (conda install
-c conda-forge packmol) before using the features that require it; ensure the
packaging metadata no longer references a non-PyPI requirement so pip install
molify succeeds.
-[ ] wait for PyPI release of packmol with correct version number
Summary by CodeRabbit
Chores
New Requirements
Behavior Changes
Version