Rust bindings (mir-sys crate) - #49
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #49 +/- ##
========================================
Coverage 56.39% 56.39%
========================================
Files 620 620
Lines 25891 25891
Branches 2279 2279
========================================
Hits 14601 14601
Misses 11290 11290 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @Choochmeque, can you book a meeting to discuss this? Thanks! |
pmaciel
left a comment
There was a problem hiding this comment.
Remarks:
- can you add headers to every added source file (.h, .cc, .rs, .toml), similar to the C++ sources (like MIRJob.h and others); we have adopted SPDX headers but haven't transitioned yet
- style:
- can you remove lines like //-------------------------...
- two empty lines between: license, headers/pre-processor directives, namespace opening/closing, code propper (class declarations, methods implementation, etc.)
- remove functionality related to mir_tool_call, representation_from (we're transitioning out of this)
- rename the create... methods with make... (this is for consistency with the python bindings)
I don't see that this bindings makes optional use of metkit (but, it's also fine like this.)
It also is disabling tests, which might be part of an implicit contract that these are to be built separately from a main build that actually tests, and stops if tests fail? It is missing tests and/or examples, which are extremely valuable as a high-level documentation or starting points for a newcomer -- specifically the processing of GRIB messages to/from memory are extremely valuable. A unit test and a (small) Jupyter notebook at least?
Note that when I mean "I don't like" or "I prefer" it really is just personal preference and no criticism, just a point of discussion that might sway to a compromise we'd both be happy with!
| @@ -0,0 +1,90 @@ | |||
| // mir job bridge — implementation. | |||
| #include "Job.h" | |||
There was a problem hiding this comment.
header order should be (separate groups with empty line):
- class declaration (correct for this one)
- c headers
- c++ headers
- upstream projects first (eckit, eccodes, atlas, metkit, in this order)
- system/platform headers if needed
Always prefix the headers with relative to project root (so the hierarchy is immediately visible)
| @@ -0,0 +1,70 @@ | |||
| // mir job bridge — wraps `mir::api::MIRJob`. | |||
There was a problem hiding this comment.
These comments aren't necessary (I'm being pedantic)
|
|
||
| //---------------------------------------------------------------------------------------------------------------------- | ||
|
|
||
| /// A description of the transformation to apply, not the transformation itself: |
There was a problem hiding this comment.
I prefer long comments using the block version (/* /, or in this case /* */). Since you're refering to reusing MIRJob, also document that the input (MIRInput argument) is consumed with next()
| #include <string> | ||
| #include <vector> | ||
|
|
||
| namespace mir_bridge { |
There was a problem hiding this comment.
Discussion only frst - is "bridge" the terminology? I would prefer bindings documentation-wise -- the c++ namespace should really be mir::rust (not bindings not bridge)
There was a problem hiding this comment.
"bridge" is just a name - happy to go with mir::rust.
|
|
||
| //---------------------------------------------------------------------------------------------------------------------- | ||
|
|
||
| /// Static accessors for the mir library itself. Holds no state; it exists as a |
There was a problem hiding this comment.
This comment says 3 times the same thing
| /// base — only a subclass can render the contents. The setters shadow inherited | ||
| /// overloads purely so Rust passes `&str` and `&[i64]` instead of building | ||
| /// `CxxString` and `CxxVector` at every call site. | ||
| class Parametrisation final : public mir::param::SimpleParametrisation { |
There was a problem hiding this comment.
The bindings's Parametrisation are the c++'s SimpleParametrisation. Good change because "Simple" is not a great name and we don't want that to leak. In an eckit module, I refer to this kind as "Custom" (as in, a custom, user-driven parametrisation). What do you think?
There was a problem hiding this comment.
Do you mean rename class Parametrisation to Custom? Because SimpleParametrisation will not leak to rust anyway.
| "-DCMAKE_BUILD_TYPE={}", | ||
| bindman_utils::cmake_build_type() | ||
| )) | ||
| .arg("-DENABLE_TESTS=OFF") |
There was a problem hiding this comment.
cargo builds mir only to link it, and never runs mir's C++ tests, so building them just adds time.
| @@ -0,0 +1,53 @@ | |||
| [package] | |||
| name = "mir-sys" | |||
| version = "1.28.2" | |||
There was a problem hiding this comment.
Can this be made dynamic? We are already ahead of this, and with a planned 2.0 release this year, or early next year
| "eckit-sys/eckit-spec", | ||
| "eckit-sys/eckit-geo", | ||
| "eckit-sys/geo-codec-grids", | ||
| "metkit-sys/vendored", |
There was a problem hiding this comment.
In our stacks we build metkit after atlas/before mir, maybe this order should generally be reflected here
| @@ -0,0 +1,18 @@ | |||
| # mir-sys | |||
|
|
|||
| Low-level Rust bindings to ECMWF's [mir](https://github.com/ecmwf/mir) (Meteorological Interpolation and Regridding) C++ library. | |||
…per, and Parametrisation classes
…rsion consistency
…Output, and Parametrisation files for cleaner code.
…sys version to 1.30.0
b08baad to
0f1e9bb
Compare
Description
Full implementation of the -sys crate for mir
Contributor Declaration
By opening this pull request, I affirm the following: