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:
We split off the Rust-based render subcommand into a 'feature'.
This is the default feature.
If, while installing bentopy, it turns out there is no Rust compiler, a warning is printed that this is the case. This warning explains that you can do two things:
Install Rust (recommended).
Disable the Rust-reader feature.
The latter option activates the pure-Python fallback.
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.
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.