RMG-Py icon indicating copy to clipboard operation
RMG-Py copied to clipboard

Overhaul RMG-RMS Python-Julia dependencies & Add tests for many testless Arkane network algorithms

Open hwpang opened this issue 11 months ago • 6 comments

Motivation or Problem

PythonCall.jl, CondaPkg.jl, and PythonPlot.jl supersede PyCall.jl, Conda.jl, and PyPlot.jl packages. The latter have caused many troubles during RMS installation.

Some key differences between PythonCall and PyCall

  • PythonCall has a compatible JuliaCall package that provide symmetric interface going from Julia to Python and Python to Julia
  • "PythonCall by default never copies mutable objects when converting, but instead directly wraps the mutable object. This means that modifying the converted object modifies the original, and conversion is faster" (See here)

I put together a RMG-RMS twin PR at https://github.com/ReactionMechanismGenerator/ReactionMechanismSimulator.jl/pull/256 to switch to use PythonCall.jl, CondaPkg.jl, and PythonPlot.jl from their old versions PyCall.jl, Conda.jl, and PyPlot.jl.

This PR makes necessary changes on the RMG end to keep the RMG-RMS compatibility.

Moreover, during working on this, I found that many new network algorithms in Arkane are not tested. I have added additional tests for them.

Description of Changes

Some major changes include

  • Use pyjuliacall instead of pyjulia to call Julia modules from Python.
  • Use juliaup to install Julia instead of using the julia binary from conda-forge. I have found that user the latter can cause many issues on the RMG end as it doesn't check package depedencies appropriately. juliaup is Julia's official version manager.
  • Get rid of unnecessary dependencies on pyrms and diffeqpy. We use diffeqpy to get CVODE_BDF and solve but that is unnecessary. Now we get CVODE_BDF from Sundials and solve from SciMLBase. This helps RMG to reduce package dependencies even more.

Testing

A clear and concise description of testing that you've done or plan to do.

Reviewer Tips

Suggestions for verifying that this PR works or other notes for the reviewer.

hwpang avatar Mar 22 '24 18:03 hwpang

@hwpang also consider editing the Dockerfile: https://github.com/ReactionMechanismGenerator/RMG-Py/blob/14e4861035c0fb0d2ea9761bb338355724748727/Dockerfile#L65

JacksonBurns avatar Apr 03 '24 18:04 JacksonBurns

@hwpang also consider editing the Dockerfile:

https://github.com/ReactionMechanismGenerator/RMG-Py/blob/14e4861035c0fb0d2ea9761bb338355724748727/Dockerfile#L65

It doesn't seem that this can be removed by this PR. From here, it sees that is used to avoid compilation overhead

hwpang avatar Apr 03 '24 21:04 hwpang

Codecov Report

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

Project coverage is 55.45%. Comparing base (7519944) to head (4bec89e). Report is 18 commits behind head on main.

:exclamation: Current head 4bec89e differs from pull request most recent head a7fe72f

Please upload reports for the commit a7fe72f to get more accurate results.

Files Patch % Lines
rmgpy/pdep/sls.py 22.22% 14 Missing :warning:
rmgpy/rmg/reactors.py 70.27% 11 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2640      +/-   ##
==========================================
+ Coverage   54.88%   55.45%   +0.57%     
==========================================
  Files         125      125              
  Lines       37025    37057      +32     
==========================================
+ Hits        20321    20551     +230     
+ Misses      16704    16506     -198     

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

codecov[bot] avatar Apr 05 '24 00:04 codecov[bot]

All tests have passed 🥳🥳🥳 @mjohnson541 Could you review before I clean up the commits? @JacksonBurns Let's work out a plan on the merge sequence with your other PRs

hwpang avatar Apr 05 '24 02:04 hwpang

@JacksonBurns @mjohnson541 I've addressed most of the comments and have a couple of clarifying questions

hwpang avatar Apr 25 '24 20:04 hwpang

@mjohnson541 @JacksonBurns I have addressed all the comments. Please review/approve. Thanks.

hwpang avatar May 14 '24 14:05 hwpang

The CI is failing because PythonCall.jl has recently added a requirement for python version to be >=3.8 here. During RMG subgroup discussion, we have decided to wait to merge this PR after #2635.

hwpang avatar Jun 07 '24 15:06 hwpang

@hwpang I'm revisiting this following some of the discussion in #2684 - I realize now that using the conda binary for juliaup might not be the best idea and that we would be better off using their official installation instructions. I say this because there are already reports on the juliaup conda feedstock that it is installing packages in the incorrect conda environment: https://github.com/conda-forge/juliaup-feedstock/issues/62

The official juliaup installation instructions say to use a shell script (https://github.com/JuliaLang/juliaup?tab=readme-ov-file#mac-and-linux) and provide a GitHub actions step for our CI (https://github.com/JuliaLang/juliaup?tab=readme-ov-file#continuous-integration-ci) - your thoughts?

JacksonBurns avatar Jun 27 '24 14:06 JacksonBurns

I just tested setting JULIAUP_DEPOT_PATH to a path inside the env before telling juliaup to install julia, without setting it it installs .julia etc in the default location for julia (not ideal for conda), with it defined it installs it where I told it to, so we probably need to set that to a path we choose inside the conda environment.

mjohnson541 avatar Jun 27 '24 15:06 mjohnson541

Development moved to https://github.com/ReactionMechanismGenerator/RMG-Py/pull/2687

JacksonBurns avatar Jun 28 '24 15:06 JacksonBurns