cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
265 stars 62 forks source link

[Feature Request]: Split into labextension(or + serverextension) and python package #240

Closed specter119 closed 3 years ago

specter119 commented 3 years ago

Problem

I would like the package split into lab extension and python package since I use multiple envs for different usage, then the lab extension can be installed to the master env for visualization and the python package can be installed to the slave env to offer APIs.

Then the lab extension may only depend on jupyterlab, while the python package will depend on networkx etc.

Proposed Solution

I have no experience in developing experiencing in jupyterlab, maybe https://github.com/jupyter-widgets/ipyleaflet, https://github.com/matplotlib/ipympl can be examples?

Additional context

marimeireles commented 3 years ago

Hey @specter119, thanks for opening the issue.

I would like the package split into lab extension and python package

I don't really know if this is possible and I'm not sure on how to approach this, but if you figure out a way of doing this I'll happily review a PR!

Is there anything that prevents you of installing the same package on both environments?

ianhi commented 3 years ago

I would like the package split into lab extension and python package

You mean to split up the python package into two separate python packages?

Is your goal to not depend on networkx in the base env or is it avoid jupyterlab in the other envs? For the latter note that the extension doesn't actually depend on jupyterlab. For the former I think this actually already achievable by only installing the npm package (the old way of installing extensions) with jupyter labextension install jupyter-cytoscape although this will require you to build jlab again. I think we would also need to push an update to the npm package.

specter119 commented 3 years ago

My goal is avoiding jupyterlab in the other envs, it's heavy for a env offering kernel.

ianhi commented 3 years ago

oooh that's actually great, because I think that what you want is already happening. That is pip install ipycytoscape does not depend on jupyterlab. It depends on jupyterlab-widgets which is suggestive of a dependency, happily however it does actually depend on jlab. See https://github.com/jupyter-widgets/ipywidgets/pull/2995 for discussion on this.

When you are installing ipycytoscape into the other envs are you getting jupyterlab pulled in as well? Because I think that that would be a bug.

For me in a fresh pip install ipycytoscape does not seem to pull in jupyterlab:

mamba create -n test python
conda activate test
pip install ipycytoscape

installs these packages:

ipython-genutils, traitlets, six, pyrsistent, attrs, wcwidth, tornado, pyzmq, python-dateutil, pyparsing, ptyprocess, parso, jupyter-core, jsonschema, webencodings, pygments, pycparser, prompt-toolkit, pickleshare, pexpect, packaging, nest-asyncio, nbformat, MarkupSafe, jupyter-client, jedi, decorator, backcall, async-generator, testpath, pandocfilters, nbclient, mistune, jupyterlab-pygments, jinja2, ipython, entrypoints, defusedxml, cffi, bleach, terminado, Send2Trash, prometheus-client, nbconvert, ipykernel, argon2-cffi, notebook, widgetsnbextension, jupyterlab-widgets, spectate, networkx, ipywidgets, ipycytoscape
specter119 commented 3 years ago

@ianhi thanks in advance. @marimeireles thanks all of you for development. I think this issue can be close now, however, things talked here should be mentioned in the readme.

marimeireles commented 3 years ago

Hey @specter119 glad you found a solution with Ian! :) Thanks for the kind words. Lots of ipycytoscape has Ian's contributions on it. Please feel free to add this info to the README in a way you think it'll be useful to people. Cheers!