Skip to content

Add C++ & Fortran Backends#87

Merged
ecisneros8 merged 23 commits into
pyrometheus:mainfrom
henryleberre:cpp-fortran
Oct 16, 2024
Merged

Add C++ & Fortran Backends#87
ecisneros8 merged 23 commits into
pyrometheus:mainfrom
henryleberre:cpp-fortran

Conversation

@henryleberre
Copy link
Copy Markdown
Member

Purpose

This Pull Request adds C++ and Fortran code generators ("backends") to Pyrometheus.

Testing

In an effort to standardize testing and Pyrometheus' API across languages, bindings from C++ and Fortran to Python are used to keep a single "backend"-agnostic test-suite written in Python (as apposed to writing the tests in all three languages). CMake, f2py, and pybind11 are used to generate the bindings while dynamic module imports and monkeypatching in Python ensures the tests can interact with each implementation seamlessly.

As a result, the C++ and Fortran backends are as well tested as the original Python one is. All three backends are now tested in CI, no matter the branch.

Breaking Changes

The only breaking change I am aware of is the renaming of the species_name and species_index methods to, respectively, get_species_name and get_species_index in the Python backend. It keeps the naming scheme consistent.

Credit

Esteban (@ecisneros8) and myself (@henryleberre).

@henryleberre henryleberre added the enhancement New feature or request label Oct 6, 2024
Copy link
Copy Markdown
Collaborator

@ecisneros8 ecisneros8 left a comment

Choose a reason for hiding this comment

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

@henryleberre thanks for working on this. I think this is elegant, and overall fantastic work. I left a few comments that should be easy to address. Let me know if you have any questions.

Comment thread test/backends.py
Comment thread test/backends.py
Comment thread test/backends.py
Comment thread test/backends.py
Comment thread test/backends.py
Comment thread test/test.py Outdated
Comment thread test/test.py
Comment thread test/test.py
Comment thread test/backends.py
Comment thread test/backends.py
@ecisneros8
Copy link
Copy Markdown
Collaborator

@henryleberre I left some more comments on my original review. I'll also look at the docstrings asap. Thanks again for working on this. Very nice work!

Copy link
Copy Markdown
Collaborator

@ecisneros8 ecisneros8 left a comment

Choose a reason for hiding this comment

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

Hi @henryleberre, I went over the docstrings for the backend wrappers. Thanks for adding these. I have just one comment. Great work!

Comment thread test/backends.py
Copy link
Copy Markdown
Collaborator

@ecisneros8 ecisneros8 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 working on this @henryleberre !

@ecisneros8 ecisneros8 merged commit 337aac5 into pyrometheus:main Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants