You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our number of dependencies is rapidly increasing. We should think about which of these dependencies are required (install_requires) vs. optional (extras_require). Here is a proposal:
Required: dependencies that are needed to do just about anything with TorchGeo
Optional: dependencies that are only needed for optional functionality, or for a small number of datasets
This gets a bit tricky, and is currently at odds with our dependency list. For example, rasterio is only used in RasterDataset, and fiona is only used in VectorDataset. While almost half of our datasets are RasterDataset, ony 1 is currently VectorDataset. Also, matplotlib is only needed to plot example samples.
Here is another proposal:
Required: any dependency that is used in regular usage
Optional: dependencies used only in rare cases (single dataset)
This may be a better default. Most users will likely run pip install torchgeo, which will install only the things in install_requires. We don't want a useless installation to be the default, and extras_require is off by default. Alternatively, we could do a better job of documenting the recommended way to install TorchGeo and specify that you may want pip install torchgeo[datasets,train] or something like that.
Another thing to consider is how to handle these optional imports. We can't put them at the module level (in the case of datasets) so we use lazy imports instead. We also may want to create a wrapper like importorraise (akin to pytest's importorskip) that prints a more useful error message upon ImportError. We could go even further and use lazy imports for almost all imports, not just optional ones. This will greatly speed up importing torchgeo.
The text was updated successfully, but these errors were encountered:
Our number of dependencies is rapidly increasing. We should think about which of these dependencies are required (
install_requires
) vs. optional (extras_require
). Here is a proposal:This gets a bit tricky, and is currently at odds with our dependency list. For example,
rasterio
is only used inRasterDataset
, andfiona
is only used inVectorDataset
. While almost half of our datasets areRasterDataset
, ony 1 is currentlyVectorDataset
. Also,matplotlib
is only needed to plot example samples.Here is another proposal:
This may be a better default. Most users will likely run
pip install torchgeo
, which will install only the things ininstall_requires
. We don't want a useless installation to be the default, andextras_require
is off by default. Alternatively, we could do a better job of documenting the recommended way to install TorchGeo and specify that you may wantpip install torchgeo[datasets,train]
or something like that.Another thing to consider is how to handle these optional imports. We can't put them at the module level (in the case of datasets) so we use lazy imports instead. We also may want to create a wrapper like
importorraise
(akin topytest
'simportorskip
) that prints a more useful error message uponImportError
. We could go even further and use lazy imports for almost all imports, not just optional ones. This will greatly speed up importing torchgeo.The text was updated successfully, but these errors were encountered: