Closed banesullivan closed 11 months ago
@banesullivan Thank you for opening this issue!
I agree that EOmaps is currently installing a lot of optional dependencies that are not needed for basic functionalities.
The reason why I choose to be quite extensive at the moment is twofold:
1) I wanted EOmaps to become a package that is intended for a broad audience of geo-data scientists, and not all of them are experts in what's going on behind the scenes of a python package.
If optional dependencies require some c++ libraries like GDAL, PROJ, running pip install geopandas
after a conda install -c conda-forge eomaps
can potentially break the whole environment and from my experience this is one of the main reasons why I encounter a lot of people that think it is difficult to setup python for geo-data analysis.
2) My main target from the start was to use conda
since it solved all problems I ever had with (geo related) python environments. Now the biggest problem here is that conda
has no suitable "easy-to-use" machinery for optional dependencies (such as pip). Setting up meta-packages similar to matplotlib-base
would be nice, but it just feels like a lot of work (and maintenance work) if I want to support multiple different sets of dependencies. (see https://github.com/conda/conda/issues/7502)
I am unsure if implementing optional dependencies with pip and keeping the full install on conda is a good idea or if this might cause confusion. On the other hand, I am not sure how I would even implement a conda metapackage... Any help/insights on this are very much appreciated!
Concerning the handling of optional dependencies.... I need to explicitly test this to be 100% sure but in general I think that optional dependencies should already be treated as expected (except that they are installed...)!
xmltodict
You are right... this was a dependency back in EOmaps v2.0 but it's no longer required and should be removed! This must have slipped under my radar, thanks for pointing this out!
packaging
:
As I see it it is a really widely used library to parse and compare package versions (after pkg_resources
was deprecated)
A quick check in my current environment (mamba repoquery whoneeds -t packaging
) reveals the following relevant EOmaps dependencies that already use it: matplotlib-base
, geopandas-base
, rioxarray
, pytest
, pytest-cov
, xarray
, sphinx
. Also setuptools
is vendoring it since v8.0 (see here). Since it already shipps with core-dependencies of EOmaps, I don't really see a reason to replace it.
pyepsg
:
Again right... this used to be an explicit dependency but it is no longer required.
descartes
:
This is an optional dependency of cartopy
for geometry plotting.
First draft for optional dependency groups now implemented in the PR that implements the switch from setup.py
to pyproject.toml
: #216 !
Optional pip
dependency groups are now included in EOmaps v8.0
(see #205)!
Is your feature request related to a problem? Please describe. EOmaps has quite a few hard requirements under it's basic installation mode:
pip install EOmaps
. I'm curious if we could trim down the requirements to a critical few to minimize the impact of installing EOmaps?I realize that many of these dependencies are indeed mission-critical (matplotlib, numpy, cartopy), but other dependencies may be more for user convenience or used for specific tasks.
Keeping the core, hard dependencies of a Python package slim ensures that the package remains lightweight and easy to install, reducing the risk of compatibility issues and dependency conflicts. Leveraging Python packaging's structure for optional dependencies allows for greater flexibility and customization, enabling users to tailor the package to their specific needs without being burdened by unnecessary components.
However, I want you to do whatever makes the most sense for most users. If you think most users want all of these, give them all of these! I just thought I'd raise this as it was a bit of a red flag to see so many dependencies without any optional.
Describe the solution you'd like Would it make sense to group some of these dependencies using
extras_requires
(or optional-dependencies in the new setuptools paradigm)? I think you'll have a better understand of which groups to implement but I'm imagining something like:Perhaps remove the following:
xmltodict
: I don't see this used anywhere? Perhaps it's optional to Pandas? If so, I don't recommend making it a hard requirement unless you are directly relying on itpackaging
: Can we use a standard library to accomplish what you need?pyepsg
: Again not directly seeing this used.descartes
: Again not directly seeing this usedAnd set the dependencies as:
I see that you are already handling many of these dependencies as "optional" in a sense, like here:
https://github.com/raphaelquast/EOmaps/blob/71361494f5af1fb6674c9862339d0e40946f5e89/eomaps/shapes.py#L1269-L1274
But this isn't well handled everywhere:
https://github.com/raphaelquast/EOmaps/blob/71361494f5af1fb6674c9862339d0e40946f5e89/eomaps/shapes.py#L259
As a second part of this issue/request, I'm curious if you could make sure that optional dependencies are well-handled throughout the library: raising user-friendly exceptions when not available (as you have above)
Describe alternatives you've considered
If nothing else, I think it would be great to explain the purpose of each dependency
Additional context Add any other context or screenshots about the feature request here.