Skip to content
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

Create a pure-Python fallback for render #10

Open
ma3ke opened this issue Mar 13, 2024 · 0 comments
Open

Create a pure-Python fallback for render #10

ma3ke opened this issue Mar 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ma3ke
Copy link
Collaborator

ma3ke commented Mar 13, 2024

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.

@ma3ke ma3ke added the enhancement New feature or request label Mar 13, 2024
@ma3ke ma3ke changed the title Create a pure-Python fallback for _render_ Create a pure-Python fallback for render Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant