lymp icon indicating copy to clipboard operation
lymp copied to clipboard

Remove pymongo dependency

Open vog opened this issue 6 years ago • 2 comments

The dependency of pymongo just for the BSON encoding is a bit annoying. Is it feasible to get rid of it?

For example, would to be possible to use a stand-alone BSON library such as https://github.com/py-bson/bson ?

Even more so, would it make sense to just include the needed parts of the BSON implementation directly in srcs/lymp.py? (i.e. the contents of https://github.com/py-bson/bson/blob/master/bson/codec.py)

That way, we'd have zero external dependencies besides Python itself.

vog avatar Oct 07 '18 07:10 vog

Hi @vog, we most likely could use the stand-alone library with no costs. I was also thinking about switching to JSON. The gains associated with a slightly smaller package to send are very small. Being able to use the two great JSON libraries in OCaml (yojson) and Python (json, which is even part of the standard library, requiring no installation) would be better in terms of maintenance and probably even overall performance.

Do you have a specific need that would make it preferable to have no external dependency ?

Thanks for the input :)

dbousque avatar Oct 07 '18 09:10 dbousque

I also wouldn't mind switching to JSON. This is what I usually do, e.g. when interfacing Python with C or C++ with complex data structures.

My first use case is interfacing with the Python stadard library in areas where the OCaml libraries have not (yet) received enough power of volunteers.

The second use case is having all used Python libraries part of the application's release, where I don't want to pull in more libraries than the ones I really use - let alone making a pymongo installation a requirement of the target system.

Note that both use cases are not yet in production. I was planning to do some generic bridge to execute a Python process from OCaml and exchange JSON structures, to make my above mentioned use cases possible. But then saw your library which does exactly what I want, does it the way I want, except for that pymongo/bson thing.

vog avatar Oct 12 '18 07:10 vog