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

Make some dependencies optional #116

Open
jtpio opened this issue Dec 12, 2024 · 4 comments
Open

Make some dependencies optional #116

jtpio opened this issue Dec 12, 2024 · 4 comments
Assignees

Comments

@jtpio
Copy link
Contributor

jtpio commented Dec 12, 2024

Thanks for putting this library together!

Currently there seems to be quite a few dependencies listed here:

python = ">=3.9,<4"
shiny = ">=0.7.0"
htmltools = ">=0.5.1"
jinja2 = ">=3.1.3"
pydantic = ">=2.5.3"
anywidget = ">=0.9.0"
pandas = {version = "^2.1.4", optional = true}
geopandas = {version = "^0.14.2", optional = true}

But it looks like some of them may not be necessary in some situations. For example JupyterLab users may not need the dependency on shiny.

So maybe it would be possible to move some of these to an extras group?

@jtpio
Copy link
Contributor Author

jtpio commented Dec 12, 2024

As a side-effect, this could help allow running maplibre in a WebAssembly environment like JupyterLite, which could then also enable some nice use cases such as hosting example notebooks on GitHub Pages, with everything running in the browser.

However it does not seem possible to install maplibre in JupyterLite at the moment when testing on https://jupyterlite.github.io/demo/lab/index.html, due to these extra dependencies:

import micropip
await micropip.install('maplibre', keep_going=True)

image

@crazycapivara
Copy link
Contributor

crazycapivara commented Dec 14, 2024

@jtpio Yes you are right.
Initially maplibre was developed as a addon for Shiny for Python and I only added the ipywidget as a side effect. Therefore, we have the Shiny dependency. But now I believe more people use the ipywidget. I have to check if I can just make the Shiny dependency optional. Another solution I already thought about was to split the package in an ipywidget and a shiny part.
Nevertheless if you need a working Web Assembly, you can use the one from ShinyLive, which is based on pyodide and contains all the needed libraries.

@crazycapivara
Copy link
Contributor

#118

@jtpio
Copy link
Contributor Author

jtpio commented Dec 15, 2024

Thanks for the reply and the extra context!

Initially maplibre was developed as a addon for Shiny for Python and I only added the ipywidget as a side effect. Therefore, we have the Shiny dependency. But now I believe more people use the ipywidget. I have to check if I can just make the Shiny dependency optional. Another solution I already thought about was to split the package in an ipywidget and a shiny part.

Yes that makes sense, sometimes it's easier and faster to make opinionated choices when getting started. A split of packages sounds like it would allow for greatly flexibility 👍

if you need a working Web Assembly

Thanks, I think the main motivation was to use it in a notebook with JupyterLite specifically, which would require installing the maplibre package in a WebAssembly environment. But if there is a dedicated ipywidget package then it should be much easier normally (especially with anywidget used under the hood).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants