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

Extras require for spyndex #17

Open
bastiencyr opened this issue Feb 27, 2023 · 3 comments
Open

Extras require for spyndex #17

bastiencyr opened this issue Feb 27, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@bastiencyr
Copy link

bastiencyr commented Feb 27, 2023

Hello,

The current dependencies management includes dev packages like earthengine-api. earthengine-api is heavy and users of spyndex don't necessary need it.
So it's better to mark this dependency as a dev dependency. You can for example use the extras_require key in setup.py file. It would looks like this :

import io
import os
import re

from setuptools import find_packages, setup


def read(filename):
    ...

setup(
    name="spyndex",
    version="0.3.0",
    [...]
    install_requires=[
        "dask>=2021.9.1",
        "matplotlib",
        "numpy",
        "pandas",
        "python-box>=6.0",
        "requests",
        "seaborn",
        "xarray",
    ],
  extras_require={
        "dev": ["earthengin-api", "eemont>=0.3.6"],
    },
)

You can then install the regular version of this package with pip install . or the dev version with pip install .[dev]

Thanks !

@bastiencyr bastiencyr changed the title earthengine-api should not be in the depedencies earthengine-api should not be in the dependencies Feb 27, 2023
@davemlz
Copy link
Member

davemlz commented Jul 10, 2023

Hi @bastiencyr!

Thank you for the suggestion! GEE is not a dev dep. But I understand what you are saying, and it makes sense. However, it is then unclear where to draw the line (or how many lines to draw, aka multiple extras). Someone using just rasterio would say that they don't need xarray in the deps.

I will keep it simple for now and leave them in deps, satisfying all possible needs. Nevertheless, if it causes trouble, please feel free to reopen this issue!

Best,

David

@davemlz davemlz closed this as completed Jul 10, 2023
@bastiencyr
Copy link
Author

bastiencyr commented Jul 10, 2023

Hey,
You're right, GEE is indeed used in the code and I didn't see this: https://github.com/awesome-spectral-indices/spyndex/blob/main/spyndex/spyndex.py

However, ee and eemont are very heavy (~100Mb). Docker images built with spyndex take space. We can create profile and install spyndex with the right option. For example, pip install spyndex[all] to install all depedencies or pip install spyndex[ee] to install spyndex only with ee support. It can be done with the following configuration:

extras_require={
        "all": ["spyndex[ee]", "spyndex[rasterio]"},
        "ee": ["earthengin-api", "eemont>=0.3.6"],
        "rasterio": [...],
    },

I didn't test this configuration.

We can renamed this issue in "Create optional dependencies list to lighten the size of spyndex package" , and thus, I don't think this issue has to be closed.

@davemlz davemlz reopened this Jul 11, 2023
@davemlz davemlz changed the title earthengine-api should not be in the dependencies Extra requires for spyndex Jul 11, 2023
@davemlz davemlz changed the title Extra requires for spyndex Extras require for spyndex Jul 11, 2023
@davemlz davemlz self-assigned this Jul 11, 2023
@davemlz
Copy link
Member

davemlz commented Jul 11, 2023

This is exactly what I wanted to avoid. But I understand you. I will keep this Issue open (and see what others thinks) and will think and work on it later on ;)

@davemlz davemlz added question Further information is requested enhancement New feature or request labels Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants