-
Notifications
You must be signed in to change notification settings - Fork 0
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 python bindings #6
base: main
Are you sure you want to change the base?
Conversation
826bb80
to
bd1b2a3
Compare
One idea I had one the weekend which might be a nice solution for allowing to add more comparison policies then the already implemented ones would be to add a template parameter pack and running
for each passed policy. I'll set this PR back to draft and test that out first as it would solve the issue with the missing tests (I think). |
Ok, that actually worked out quite well. I rearranged the bindings a little and added the missing unit tests. It is now possible to add a comparison policy as a template parameter to the |
3106fac
to
fd4a2fe
Compare
Rebased on current master. |
fd4a2fe
to
2d872aa
Compare
2d872aa
to
fbeec5a
Compare
Rebased to |
If pybind is available, this will compile the bindings, copy the python files to the build directory and add the test to ctest.
…separate namespaces.
More documentation
fbeec5a
to
3b5261d
Compare
Rebased to main |
As promised, here is a taste of what's to come :)
This contributes python bindings. Since this is a templated library, the python bindings have to be compiled at a later point in time, when the types are known. Therefore, we don't ship the bindings directly but rather add a convenience function that allows binding the types once the template arguments are known.
Now util_caching brings some extra challenges because it is possible to use it with very different kinds of keys. I solved it by adding two binding functions. One to bind a types you need for a number based key and an analogous one for time based keys.
When pybind is available and
BUILD_TEST=TRUE
, a python module is built that allows running unit tests (almost) equivalent to the currently implemented ones.[EDIT] The following is outdated and has been fixed, see comment below.
There are two things missing right now. This line as well as this test.
The first one would require calling
Since these binds some of the same types as the existing statement, the resulting modules can't be loaded in the same python file.
Similarly, adding the
SomePolicyWithoutParams
would require a new module.We could add those but in my opinion it would just add quite an overhead for a very small gain therefore I chose not to add it but we can of course discuss that.