Open matt-codecov opened 3 weeks ago
As we write Python bindings we should consider whether we want to pepper PyO3 attributes throughout the code or introduce some dedicated types to serve as a Python bridge.
I might be biased towards the solution in https://github.com/getsentry/ophio?tab=readme-ov-file#repo-structure. The repo there is split into a pure-rust crate, a pyo3 bindings crate, plus a python project that defines pyi
typings and re-exports types into a module/package hierarchy.
pyproject.toml
.github/workflows/publish.yml
, invokes maturin to build artifacts + publish to PyPI (needs Trent to set something up on the PyPI side but then works like magic)src/lib.rs
binds some Rust functions to Python + creates a Python module which refers to some Rust types that will be exported as classes. Poke around their definitions for more detail.cc_rustyribs/__init__.py
defines some Python functions + re-exports the Python-bound Rust typesSet up maturin and write our first Python bindings:
parse_pyreport()
which takes two filepaths and returns a Python-bound Rust reportSqliteReport
For purposes of this task, the
SqliteReport
binding just needs to be able to be passed around in Python and doesn't need to expose any functionality.codecov-rs
should first-and-foremost be a standalone Rust library and we don't want our near-term Python integration needs to shape its design. As we write Python bindings we should consider whether we want to pepper PyO3 attributes throughout the code or introduce some dedicated types to serve as a Python bridge.