Python 3.12 compatibility#58
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
…common (compatible w/ both 3.11 and 3.12)
…ources._common (compatible w/ both 3.11 and 3.12)" This reverts commit b39eaef.
…ed importlib.resources._common.get_package()
|
@joelaforet, combing through I've made headway in some places but run into problems on others. Diving into the leads given in #58, the specific break was due to deprecation of As far as other dependencies, mBuild seems to be causing an inordinate amount of issues, including:
There also seems to be some sensitivity to installation order, i.e. whether pip-installing polymerist then installing mbuild and or creating an env from a conda.yml and pip-installing afterwards. Digging into that more will take time and might require some extra eyes, but I'm hoping resolving that will be the trickiest blocker to getting 3.12 support in. It's not clear to me as-writing where other incompatibilities may lie; for now, I've removed all upper version pins in the shipped env .ymls and will add them back in if necessary. |
|
I dug into the Python 3.12 dependency failures and opened a small follow-up PR with the proposed metadata/env changes: #59.\n\nSummary of findings:\n- The source-level Python 3.12 incompatibility is the private importlib.resources._common usage in pkginspect.py. The current PR fix using ModuleSpec.submodule_search_locations for package detection looks like the right minimal fix.\n- Current conda-forge can solve python=3.12 with mbuild + openff-toolkit, and also with mbuild-base + openff-toolkit-base. That pair does not appear to be the current hard blocker.\n- The actual hard dependency conflict is in the broader optional/test stack: current mbuild pulls gmso>=0.16.1, which requires numpy>=2.0, while espaloma_charge pulls dgl -> tensorflow-base=2.17.0, whose Python 3.12 build requires numpy>=1.26.4,<2.0a0. This explains the order-dependent NumPy backtracking/regression behavior.\n- The saved sequential-install logs in polymerist_py312_context were pinned to python 3.13.*, not 3.12. For this PR, requires-python should not be opened to unbounded >=3.11 unless we also intend to validate Python 3.13+.\n\nConcrete recommendation:\n- Keep the pkginspect.py importlib fix from this PR.\n- Set requires-python to >=3.11,<3.13 for this pass.\n- Do not force numpy>=2.0 in pyproject while Espaloma/TensorFlow remains in the supported/tested dependency stack. Leave numpy unconstrained at the Polymerist package level and let environment-specific solves choose the compatible side.\n- Restore the unrelated setuptools<82, packmol<=20.15.1, and lammps<=2024.08.29 pins unless/until there is a separate PR validating those changes.\n\nValidation I ran:\n- mamba dry-run solve for the updated Python 3.12 runtime dependency set succeeded.\n- mamba dry-run python=3.12 mbuild openff-toolkit succeeded.\n- Focused test: mamba run -n polymerist-env python -m pytest -q polymerist/tests/genutils/importutils/test_pkginspect.py -> 44 passed, 9 xfailed. |
…w/ newer versions
…ort in tensorflow sub-deps
Description
Update package code and build config to allow use with Python 3.12+ as Python 3.11 enters end-of-life.
Todos
Notable points that this PR has either accomplished or will accomplish.
pip install polymeristwithout dependency conflicts in envirnment with at least Python 3.12Questions
espaloma-chargefrom:Status