marrink-lab / bentopy

Packs stuff in boxes
4 stars 0 forks source link

Create a pure-Python fallback for render #10

Open ma3ke opened 5 months ago

ma3ke commented 5 months ago

For now, we require a Rust toolchain to install bentopy. This is necessary, because the render subcommand relies on our Rust library for writing out structures based on the placement list pack creates. But it may be desirable, for whatever reason, to have the ability to just use a pure-Python fallback that does the same thing.

The disadvantage of this fallback would be that it is very slow. (That is the whole reason I made the Rust render-placements application in the first place.) But it does provide an escape hatch.

It should be more or less trivial to implement. We already have the MDAnalysis dependency anyway.

The way it works could be as follows:

For testing purposes, we can just leave in the Python fallback anyways, whether Rust-render exists or not. If it does not exist, the fallback is used. If it does exist, but you pass a --fallback option (or something like it), the Python render is used.

It may be good to print out a small, friendly warning when the fallback is used, if the performance gap is very large.

I do propose we make this much later. While things are still subject to change, I prefer to only maintain one implementation of the render feature.