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

cartopy as an optional dependency #318

Closed
rafa-guedes opened this issue May 20, 2024 · 2 comments · Fixed by #319
Closed

cartopy as an optional dependency #318

rafa-guedes opened this issue May 20, 2024 · 2 comments · Fixed by #319

Comments

@rafa-guedes
Copy link
Contributor

Thanks for providing this very useful library. I was wondering if you would consider making cartopy an optional dependency instead of a required one. Cartopy is a relatively large dependency which fails to build easily in some systems, and it is not required if one only requires the data access capability in the library. It looks like cartopy is used in the hrrr_zarr.py and accessors.py modules, perhaps some try/except conditional import in those modules with an appropriate exception message indicating the required dependency needs to be installed could work? I'm happy to submit a pull request if you think this is helpful.

@rafa-guedes
Copy link
Contributor Author

And perhaps the same for scikit-learn!

@blaylockbk
Copy link
Owner

Hi @rafa-guedes,

Glad you find Herbie useful. Yes, this is something I have thought about too, but never bothered to do it since I use Cartopy all the time. I wondered how long it would take before someone said something when I added scikit-learn as a new dependency; didn't take long 😆

Yes, I'd be open to a PR if you want to take a stab at it. Keeping it super simple with try/except statements should be good. Perhaps even matplotlib could be optional?

  • Add try/execpt statements for extra imports
  • Edit pyproject.toml to something like this
    dependencies = [
    -   "cartopy",
        "cfgrib",
    -   "matplotlib",
        "metpy",
        "numpy",
        "pandas",
        "pygrib",
    -   "scikit-learn",
        "toml",
        "xarray",
    ]
    
    [project.optional-dependencies]
    
    + extras = ["cartopy", "matplotlib", "scikit-learn"]
    
  • Update docs to explain how to pip install dependencies for extra features. (The conda-forge recipe would keep all dependencies listed as required.)

@blaylockbk blaylockbk linked a pull request Jun 1, 2024 that will close this issue
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 a pull request may close this issue.

2 participants