KingsburyLab / pyEQL

A Python library for solution chemistry
Other
64 stars 17 forks source link

Testing, documentation, and exception handling for Apple Silicon #111

Closed rkingsbury closed 5 months ago

rkingsbury commented 5 months ago

Summary

Partially addresses #109 by detecting OSError that may result from Apple silicon trying to use phreeqpython. phreeqpython and PHREEQC itself do not support ARM64 as far as I can tell, but we can at least detect this situation and allow everything in Solution that does not depend on phreeqpython to work.

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 85.71429% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 82.24%. Comparing base (f00d960) to head (b8b0705). Report is 4 commits behind head on main.

Files Patch % Lines
src/pyEQL/solution.py 0.00% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #111 +/- ## ========================================== + Coverage 82.18% 82.24% +0.06% ========================================== Files 10 10 Lines 1448 1453 +5 Branches 250 293 +43 ========================================== + Hits 1190 1195 +5 + Misses 221 220 -1 - Partials 37 38 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

yuxuanzhuang commented 5 months ago

Hi! I assume the job is still only running on Ubuntu. I believe you need to change runs-on

https://github.com/KingsburyLab/pyEQL/actions/runs/8147303075/job/22267731867?pr=111

yuxuanzhuang commented 5 months ago

And macos-14 (the M1 macOS runner) should also be added. If you check https://github.com/KingsburyLab/pyEQL/actions/runs/8158585151/job/22300886092?pr=111, you can see that x86 packages are installed in macos-latest.

rkingsbury commented 5 months ago

And macos-14 (the M1 macOS runner) should also be added. If you check https://github.com/KingsburyLab/pyEQL/actions/runs/8158585151/job/22300886092?pr=111, you can see that x86 packages are installed in macos-latest.

Yes, thanks! Having some trouble getting python to install properly on that runner though. See https://github.com/actions/setup-python/issues/825

yuxuanzhuang commented 5 months ago

Could you try to put it in os as well? as in https://github.com/MDAnalysis/mdanalysis/pull/4442/files

rkingsbury commented 5 months ago

Alright, got the M1 runner added to CI, and added a try/except that should allow pyEQL to be used. An error will be logged (and by default, shown to the user) telling them that equilibrate and other methods that depend on PHREEQC won't work, but otherwise pyEQL should function normally.

I will make an update to the docs to mention this limitation shortly.

It isn't possible (without significant effort) to get the existing test suite to pass without these methods in place, so I've separated the M1 test into an optional GH action that we can use to keep an eye on this. Do you know if there's a way to mark a Github Action as an "expected failure"?

yuxuanzhuang commented 5 months ago

I assume you can mark failed tests with @pytest.mark.xfail(platform.machine() == "arm64" and platform.system() == "Darwin"). Not sure there's anything one can do with GitHub action.