You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I really like cppimport for quick tests and local work. However, there's one irritating part I always have to look up:
/*<%setup_pybind11(cfg)%>*/
This has two issues - one it's a special, parsed magic that requires changing the C++ code, and two, it's hard-coded into cppimport; if someone wanted to support something besides pybind11, it would need a new function like this. I'd like to propose a plugin system that allows pybind11 to declare what it needs for setup that could also be used elsewhere. I can help get the pybind11 part into the pybind11 package. :)
The idea I'm currently thinking of is the following. Users could use:
It would be also available in cpp mode to support "classic" usage:
/*<%cppimport.plugin.pybind11.setup(cfg)%>*/
A package (pybind11 in this case) would implement an entrypoint, cppimport.setup: pybind11 = .... When you access cppimport.plugin.<attr>, it looks for <attr> item in the cppimport.setup entry points. If found, it calls it with some to-be-determined API, possibly just "cfg" like the current setup_pybind11. No modification or special magic comments needed in the source code.
Thoughts? Also, a way to set config options would be important, which I haven't addressed above. I think import_hook could be replaced with something callable, like setup_import_hook, which would take cfg options. imp* could take configuration options too.
The text was updated successfully, but these errors were encountered:
Sorry for such a delayed response! I would be supportive of a change like this. I think your proposed API is pretty reasonable. I won't have time to work on this, but I would happily review some changes! Thanks so much for thinking about this in detail.
I really like cppimport for quick tests and local work. However, there's one irritating part I always have to look up:
This has two issues - one it's a special, parsed magic that requires changing the C++ code, and two, it's hard-coded into cppimport; if someone wanted to support something besides pybind11, it would need a new function like this. I'd like to propose a plugin system that allows pybind11 to declare what it needs for setup that could also be used elsewhere. I can help get the pybind11 part into the pybind11 package. :)
The idea I'm currently thinking of is the following. Users could use:
It would be also available in cpp mode to support "classic" usage:
A package (pybind11 in this case) would implement an entrypoint,
cppimport.setup: pybind11 = ...
. When you accesscppimport.plugin.<attr>
, it looks for<attr>
item in thecppimport.setup
entry points. If found, it calls it with some to-be-determined API, possibly just "cfg" like the currentsetup_pybind11
. No modification or special magic comments needed in the source code.Thoughts? Also, a way to set config options would be important, which I haven't addressed above. I think
import_hook
could be replaced with something callable, likesetup_import_hook
, which would take cfg options.imp*
could take configuration options too.The text was updated successfully, but these errors were encountered: