Skip to content

Setup: 'formats' for all user-facing extras - #639

Closed
clbarnes wants to merge 1 commit into
imageio:masterfrom
clbarnes:all-extra
Closed

clbarnes wants to merge 1 commit into
imageio:masterfrom
clbarnes:all-extra

Conversation

@clbarnes

@clbarnes clbarnes commented Jun 3, 2021

Copy link
Copy Markdown
Contributor

This was initially going to be a prelude to adding more formats which require their own dependencies (scipy and hdf5 for .mat files, hdf5 for hdf5 files, zarr for zarr and N5 arrays), but from #574 it looks like the plugin system is being overhauled so I may hold off on those.

@FirefoxMetzger

Copy link
Copy Markdown
Contributor

Thanks for this @clbarnes . I like the way you restructured the setup.py giving the extra_requires a dedicated section for backends. The PR sounds related to #633 , I wonder if you are aware of it, and if you think this goes in the same direction.

Note: We used to call backends formats, but backends draws a more clear distinction between what is a way to represent images (format), what is an addon to imageio (plugin), and what is an external thing that drives a plugin (backend)).

@clbarnes

clbarnes commented Jun 3, 2021 •

Copy link
Copy Markdown
Contributor Author

The PR sounds related to #633 , I wonder if you are aware of it, and if you think this goes in the same direction

I think they are in the same direction, but can happily coexist. Extras are flexible enough that we could even group the extras (potentially with some namespacing); some could refer directly to plugins, then the use case extras could sit on top and refer to those plugin extras.

We used to call backends formats

Sure, I'll change the name of that extra! Although then the "fits" -> "astropy" mapping is a little confusing. I also considered an "everything-but-gdal" extra because I can never install the damn thing 🙄

@FirefoxMetzger

Copy link
Copy Markdown
Contributor

Although then the "fits" -> "astropy" mapping is a little confusing.

That's true. Would it be cleaner to name the extra_requires based on the plugins? In this case the fits plugin uses astropy as a backend and provides support for the - equally named - fits format. Does this make sense?

because I can never install the damn thing

This is another aspect I am thinking about regarding a "all"/"formats"/"plugins"/"backends" target in the extra requirements. Some people, e.g., those using pypy, may not be able to use all backends that are compatible with imageio due to platform constraints. On the other hand pip install imageio[formats] would suggest that this just works, or is at least smart enough to skip backends that don't work on the user's architecture. The latter being a bit unintuitive, because "I used [formats], why do I not have backend X?". I'm not sure what a good solution is in this case.

@clbarnes

clbarnes commented Jun 4, 2021

Copy link
Copy Markdown
Contributor Author

Does this make sense?

Sounds good to me!

I'm not sure what a good solution is in this case.

A few libraries (trimesh springs to mind), have an "easy" extra which installs all of the packages it expects to be easily installable; maybe that's the way. Users can always specify multiple individual extras to get around it so long as they're well documented. People using non-CPython distributions are likely to know enough about the limitations of those distributions to be able to work around but we could always drop a line into the readme about it. I think you're right that dynamically detecting which libraries are likely to be easy to install would be surprising behaviour, not to mention a headache to maintain, especially as more compiled libraries are (should be) transitioning to PEP518 build systems.

@FirefoxMetzger FirefoxMetzger mentioned this pull request Jun 14, 2021
@FirefoxMetzger

Copy link
Copy Markdown
Contributor

@clbarnes #574 is merged :) Are you still interested in adding support for zarr, ,mat etc.?

@clbarnes

Copy link
Copy Markdown
Contributor Author

Awesome! I'll raise issues and self assign them for when I get round to it. I'll close this for the moment too as quite a lot will have changed under the hood.

@clbarnes clbarnes closed this Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants