Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overhaul psi4 detection parsing #418

Merged
merged 5 commits into from
Aug 14, 2023
Merged

overhaul psi4 detection parsing #418

merged 5 commits into from
Aug 14, 2023

Conversation

loriab
Copy link
Collaborator

@loriab loriab commented Aug 7, 2023

Description

The existing psi4 detection has worked great when psi4 is in order and conda environments prevail, but #389 and #292 show that if something is set up a little wrong with psi4, then everything devolves into an IndexError with the existing psi4 detection.

This PR improves matters by

  • in the complete-the-psithon-psiapi-pair blocks:
    • only doing string-safe operations on stdout
    • forming clearer error responses
    • catching stderr instead of tossing it and parsing stdout anyways
    • getting rid of env passing. As @Flamefire pointed out, the psi4 module is already in sys.path or which_import wouldn't have worked. unlike Prepend psiimport path instead of overwriting $PYTHONPATH #389, code is now passing no env so current env is used (and can provide numpy, etc.). I've tested that there's no need to provide env=os.environ to get current env.
    • checking returncode
    • it was also not showing error messages when psithon found but not psiapi b/c final check was of psithon only. now checking at the weak point
  • in the version fn:
    • only doing string-safe operations on stdout
    • catching stderr instead of tossing it and parsing stdout anyways
    • checking returncode

Hopefully this will be more robust. closes #389 closes #391 closes #292

Changelog description

Status

  • Code base linted
  • Ready to go

@codecov
Copy link

codecov bot commented Aug 7, 2023

Codecov Report

Merging #418 (a0ce68a) into master (034fd1a) will decrease coverage by 0.17%.
Report is 2 commits behind head on master.
The diff coverage is 28.00%.

Additional details and impacted files

Copy link
Collaborator

@WardLT WardLT left a comment

Choose a reason for hiding this comment

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

LGTM. I do like that we've reduced the number of times environment variables are changed.

@loriab
Copy link
Collaborator Author

loriab commented Aug 14, 2023

Yes, if there was any good reason behind that env reset, I haven't been able to reconstruct it. It'll be nice to get good traceback back, rather than remembering that IndexError in psi4 found() means the version/tag is broken.

@loriab loriab merged commit 6db2494 into MolSSI:master Aug 14, 2023
15 checks passed
@loriab loriab deleted the psifoundagain branch August 14, 2023 15:34
@loriab loriab mentioned this pull request Aug 17, 2023
2 tasks
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.

qcengine info psi4 harness raises exception if system uses pyenv
2 participants