simpeg / geoana

Interactive geoscience (mostly) analytic functions.
MIT License
22 stars 9 forks source link

hard vs. soft dependencies #32

Open lheagy opened 2 years ago

lheagy commented 2 years ago

I think much like the discussion we had at the April 6 SimPEG meeting about keeping the core set of dependencies of SimPEG quite lightweight, it would be good to do that for geoana as well.

Currently, the requirements are:

        'future',
        'numpy>=1.8',
        'scipy>=0.13',
        'matplotlib',
        'properties',
        'vectormath',
        'utm',
        'empymod'

31 will remove the properties and vectormath dependencies.

I propose that the core set of dependencies be limited to

and that utm, empymod, matplotlib are all soft dependencies, much like we have done in discretize.

lheagy commented 1 year ago

Some of this has been resolved with removing properties (in #31), but we are still requiring utm for example, which isn't necessary for most geoana code

prisae commented 1 year ago

You could reduce the core dependencies to scipy only, as numpy is a dependency of scipy anyway and handled that way.

jcapriot commented 1 year ago

I have reduced it down to just numpy, scipy, and libdlf (which itself only depends on numpy).

rowanc1 commented 1 year ago

If utm is removed, I think this will start to work in JupyterLite: image

This would open up all sorts of possibilities for adding interactive widgets to static websites!

jcapriot commented 1 year ago

Well, that's great! Also, I was having some very odd build-matrix errors due to numba on the conda-forge side trying to release 0.4.1 on https://github.com/conda-forge/geoana-feedstock/pull/21

rowanc1 commented 1 year ago

I think that it should now work on pyodide, but it needs a built bundle: https://packaging.python.org/en/latest/tutorials/packaging-projects/#generating-distribution-archives

This is the pyodide docs: https://pyodide.org/en/stable/usage/faq.html#why-can-t-micropip-find-a-pure-python-wheel-for-a-package

Do you know how to do this @jcapriot?

For example this repo has: image

geoana only has the source: image

jcapriot commented 1 year ago

We could provide an py3 any-wheel. (There are external libraries in geoana, but I've been sure to have fall-back python only versions of them as well).

rowanc1 commented 1 year ago

I think that if we get that up there we can do things like this really easily! This still requires a server, but would love to be able to bypass that and get it up and running in jupyter lite!

geoana

There are a few examples of doing that here.

rowanc1 commented 1 year ago

Yep, tested locally and all we need is the geoana-0.5.0-py3-none-any.whl which is the result of python3 -m build in the repository as is and then getting that up to pypi. When that is done, it will work in JupyerLite/pyodide, and allows for all sorts of cool things. I will put an example together.

rowanc1 commented 1 year ago

Works if we add that to the build!

https://github.com/simpeg/geoana/assets/913249/73fe671f-54be-47f6-b715-ba1c4a9dd28e

Source: https://rowanc1.github.io/geoana-docs/

Right now I am just hosting the built file on curvenote, but hopefully we can get it on pypi!