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

nanobind support? #261

Open
wojdyr opened this issue Dec 10, 2024 · 3 comments
Open

nanobind support? #261

wojdyr opened this issue Dec 10, 2024 · 3 comments

Comments

@wojdyr
Copy link

wojdyr commented Dec 10, 2024

I've been using m.css for a pybind11 module for a few years.
Recently, I migrated this module to nanobind, which is a next-gen library from the same author as pybind11.
I wonder, are there any plans for nanobind support in m.css?
If not, any hints what could be used as a replacement?

@mosra
Copy link
Owner

mosra commented Dec 10, 2024

Oh, support for that definitely makes sense. I was personally playing with the idea of switching to nanobind as well, unfortunately projects that depend on my library use pybind11 so I can't really. Though there's a way to make a project support both, because the API syntax isn't too different. (Which of course won't help if you wanted to get rid of pybind11 in the first place...)

(an hour passes)

So, I got curious and tried patching one of the pybind11 tests and ... it doesn't seem to be too bad: #262

Unfortunately I don't think I can find time to finish this right now or this week, but this is definitely doable. Do you have any time frame in which you'd want to see the support being done? Can't promise I'll match that, but I can try.

@wojdyr
Copy link
Author

wojdyr commented Dec 10, 2024

Great, thanks! I don't have any time frame and can easily wait a couple months.

Nanobind can natively generate pyi stub files. I was thinking, could this be used as an input for m.css?

@mosra
Copy link
Owner

mosra commented Dec 10, 2024

Not really. It'd be one extra indirection, meaning an extra chance for bugs to appear, and as the stubs usually remove all traces of the underlying support library, it'd be no longer possible to detect that nanobind was used and apply nanobind-specific workarounds for it.

But if you have a way to restore some partial pybind11 compatibility (basically what I did in #262 for the test file) and can temporarily build against that just for doc generation, that's a way. But gemmi seems quite large, not sure if that's a manageable path forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants