Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C and Python binding ? #7

Open
natir opened this issue Aug 27, 2020 · 4 comments
Open

Add C and Python binding ? #7

natir opened this issue Aug 27, 2020 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@natir
Copy link
Owner

natir commented Aug 27, 2020

Except for Iterator it seems very easy to create a C and Python binding with cbindgen and pyo3. (maybe @luizirber can help use for python binding ?)

@natir natir added the enhancement New feature or request label Aug 27, 2020
@natir natir added this to the Road to 1.0 milestone Aug 27, 2020
@luizirber
Copy link
Contributor

I would suggest the C API first, because then it can be used with pretty much any language. Maybe https://github.com/lu-zero/cargo-c is a good helper for that, since it add some niceties for making it easier to link with C code (like pkg-config confs).

For sourmash I used https://github.com/getsentry/milksnake, which uses cffi for creating Python bindings. The nice thing is that it can use the header generated by cargo-c and doesn't need other Rust code, like PyO3 would, but PyO3 makes nicer Python APIs by default (the milksnake approach is lower-level).

@Daniel-Liu-c0deb0t
Copy link
Collaborator

For now, I feel like adding other language bindings is lower on the priority list than implementing all of the features that we want. However, I've found Rust to work very well with C (I have not tested Rust + Python yet), even when writing the bindings by hand, so this is definitely possible in the future.

@natir
Copy link
Owner Author

natir commented Aug 31, 2020

I agree with you it's not the main priority but I think if we want nuc2bit will be used we need a minimal C binding.

@Daniel-Liu-c0deb0t
Copy link
Collaborator

Yes, we can definitely keep this on the roadmap.

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

No branches or pull requests

3 participants