Skip to content

adapt for QCSchema v2 and Python v3.14#170

Merged
awvwgk merged 19 commits intodftd3:mainfrom
loriab:qcsk_v2_adapt
Mar 29, 2026
Merged

adapt for QCSchema v2 and Python v3.14#170
awvwgk merged 19 commits intodftd3:mainfrom
loriab:qcsk_v2_adapt

Conversation

@loriab
Copy link
Copy Markdown
Contributor

@loriab loriab commented Mar 16, 2026

Here's an adaptation for QCSchema v2 and Python 3.14. This and dftd4/dftd4#341 are counterparts. Please let me know of any changes you'd like.

  • No change in compatibility with current (~v0.30) and recent QCElemental for Python <3.14 . These will continue to run QCSchema v1 only, and those QCElementals need Pydantic 1.10.17 or 2.x.
  • With QCElemental >= v0.50.0rc3 (current available through -c conda-forge/label/qcelemental_dev, dftd3-python can run QCSchema v1 or v2 for all Pythons, except 3.14, where Pydantic retired the v1 API. Pydantic >=2.11 will be required (2.12 for Py 3.14). This can be seen in the test_qcschema patterns where 312 runs QCSchema v1 and skips 2, 313 runs both, and 314 runs 2 and skips v1, as illustrated in the dftd4 PR.
  • The mac and windows wheel lanes were throwing errors like the below, so I updated to the latest cibuildwheel in the major series. Perhaps associated with [2.x] Update virtualenv URLs to avoid blob URLs pypa/cibuildwheel#2775
+ Download https://github.com/pypa/get-virtualenv/blob/20.26.4/public/virtualenv.pyz?raw=true to /Users/runner/Library/Caches/cibuildwheel/virtualenv-20.26.4.pyz Traceback (most recent call last):
...
File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/urllib/request.py", line 611, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 429: Too Many Requests Error: Process completed with exit code 1.
  • Sorry for hacking up the test file so extensively. Python 3.14 not being able to form QCSchema v1 models means I can't just take the v1 models and run .convert_v(2) on them to submit to run_qcschema. The diff is a little easier to read with whitespace tracking off.
  • Associated with update to qcschema py314 conda-forge/dftd3-python-feedstock#33 and has been tested locally with QCEngine and Psi4
  • I didn't try to impose qcel version constraints in pyproject.toml because qcel is optional, existing envs continue to work, and the new features will appear naturally when v0.50.0 moves beyond pre-release.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.01%. Comparing base (a9b90a0) to head (730d18b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
python/dftd3/qcschema.py 86.15% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #170      +/-   ##
==========================================
+ Coverage   65.84%   66.01%   +0.17%     
==========================================
  Files          34       34              
  Lines        4793     4841      +48     
  Branches     1670     1670              
==========================================
+ Hits         3156     3196      +40     
- Misses        683      691       +8     
  Partials      954      954              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loriab loriab marked this pull request as ready for review March 22, 2026 08:55
awvwgk
awvwgk previously requested changes Mar 28, 2026
Copy link
Copy Markdown
Member

@awvwgk awvwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the qcschema support. I tested it locally but found that I could not get it to work with Python 3.14 and an older qcelemental version (which seems to install just fine together).

This PR adds a lot of code duplication and stray imports, which will make this very hard to maintain. I started to do some cleanup, but I think it will probably need more work.

@loriab
Copy link
Copy Markdown
Contributor Author

loriab commented Mar 28, 2026

Thanks for updating the qcschema support. I tested it locally but found that I could not get it to work with Python 3.14 and an older qcelemental version (which seems to install just fine together).

Right in that Python 3.14 can work only with QCSchema v2, and QCSchema v2 is only available from QCElemental >=0.50.0rc3, which one can get from pypi or -c conda-forge/label/qcelemental_dev. So Python 3.14 and an older qcelemental version can't work. I didn't try to constrain the installation versions since qcel is an optional dependency and nothing that was working should break.

This PR adds a lot of code duplication and stray imports, which will make this very hard to maintain. I started to do some cleanup, but I think it will probably need more work.

Yes, there's a lot of code duplication in the tests. I factored out molecule and some other large chunks, and I could rearrange for less duplication — I wasn't sure what balance between dupl. and lines with only whitespace change was best. I'm not quite following "stray imports," as the below was the only import change in the qcschema.py file.

    if (schver := atomic_input.schema_version) == 1:
        from qcelemental.models import AtomicInput, AtomicResult, ComputeError

    elif schver == 2:
        from qcelemental.models.v2 import AtomicInput, AtomicResult, ComputeError, FailedOperation

I rebased this locally after the changes to main, but I see you've also reconciled with main. I'll have to compare my local and this version closer later.

Thanks for the review and comments!

@awvwgk
Copy link
Copy Markdown
Member

awvwgk commented Mar 28, 2026

I did a preliminary cleanup of the version, please verify that it works as you intended and then I think it is good to merge.

@awvwgk awvwgk dismissed their stale review March 28, 2026 09:40

Comments addressed

@loriab
Copy link
Copy Markdown
Contributor Author

loriab commented Mar 28, 2026

Excluding pyscf for py314 should help that lane. I'm working on local testing ...

@loriab
Copy link
Copy Markdown
Contributor Author

loriab commented Mar 28, 2026

Ok, CI is passing again and py314 is being tested. I've tested the new versions of the schema files against a local QCEngine and Psi4 with py313. So I think this is good to go.

Thanks for the cleanup. I'll follow this pattern for xtb rather than the dftd4 pattern, if that sounds good.

Co-authored-by: Sebastian Ehlert <[email protected]>
@awvwgk
Copy link
Copy Markdown
Member

awvwgk commented Mar 29, 2026

Thanks for the cleanup. I'll follow this pattern for xtb rather than the dftd4 pattern, if that sounds good.

For tblite and xtb that would be preferable. Maybe it would also be good to refactor the dftd4 one to be consistent.

@awvwgk awvwgk merged commit fa84d6a into dftd3:main Mar 29, 2026
28 checks passed
@loriab loriab deleted the qcsk_v2_adapt branch March 29, 2026 17:52
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.

3 participants