Closed mcflugen closed 3 years ago
@mcflugen This is awesome! I'll update the docs with these changes.
@mdpiper I ended up changing the package section so that name refers to the full name of the new package. That is, if you want the new package to be called pymt_heat, you would do the following
[package]
name = "pymt_heat"
rather than name = "heat"
.
For babelize generate
I added new options to specify values in the library section and removed the --entry-points
option. The example in the README now becomes,
$ babelize generate babel.toml \
--no-input \
--package=pymt_hydrotrend \
--summary="PyMT plugin for hydrotrend" \
--langauge=c \
--library=bmi_hydrotrend \
--header=bmi_hydrotrend.h \
--class=register_bmi_hydrotrend \
--name=Hydrotrend \
--requirement=hydrotrend
Only a single library can be specified with babelize generate
. I realize it's not great and isn't concise but it works to get someone started. I'm happy to consider alternatives, if you have ideas.
@mcflugen Thanks for doing this. I'll update the README and the docs to use the new syntax.
This pull request does a couple things: add tests for wrapping C++ libraries, changes babel.toml (while maintaining backward compatibility).
The main change to babel.toml is to the library section: it is now a dictionary of dictionaries (or table of tables) and removes the entry_point key. The new format (in toml) looks like the following:
In yaml land this would be,
Using the old-style entry_points, the above is equivalent to HeatBMI=heat_bmi:Heat (notice the old-style doesn't specify a header file, which is a problem for some languages). Multiple
[library.*]
sections can be provided but, as of now, they all have to be of the same language.Another change is that the plugin section is now called package as it describes the newly-created Python package. The keys are the same, i.e.
The way things are right now, the above would create a new package called pymt_heat but I think we should change it so that a user proves the full name of the package (i.e.
name = pymt_heat
).