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

Support for JupyterLab 2 #301

Merged
merged 2 commits into from
Apr 7, 2020
Merged

Conversation

consideRatio
Copy link
Contributor

@consideRatio consideRatio commented Mar 19, 2020

Fixes #299. JupyterLab 2.0.0 is out, and this jupyterlab extension have conflicting dependencies. Note that the failing CI test is related to #300 which is not associated with this PR.

References for JupyterLab extension migration

PR summary

  • Dependency bumps and refactoring.
  • Moved various webpack loaders from being dependencies to being devDependencies.
  • Updated a development setup note in the README.
  • Bumped package.json's version to 1.1.3, and setup.py's imported version to 1.3.1.

Try PR

conda install jupyterlab=2
jupyter labextension update @jupyter-widgets/jupyterlab-manager

git clone https://github.com/consideratio/qgrid
cd qgrid
git checkout jlab2

pip install -e .
jlpm install --cwd ./js # like npm install ./js but with guaranteed to use jupyterlab's node
jupyter labextension link ./js

jupyter lab

# code in a cell
import qgrid
import pandas as pd
df = pd.DataFrame({'X':[78,85,96,80,86], 'Y':[84,94,89,83,86],'Z':[86,97,96,72,83]});
qgrid.show_grid(df, show_toolbar=True)

Todo after merge

  • Fix Pytest fails on master branch #300 - a pytest is failing in master currently, which is the same failure noticed in this PR.
  • Release version 1.1.3 of the npm package.
  • Release version 1.3.1 of the python package. It has been referencing a hardcoded version of the labextension 1.1.1 before, so when the 1.1.2 was released, that made it fail to accept being used together with it. After this PR, we reference 1.1.3 instead.

Screenshot

image

- Update the python package coupling to the JupyterLab extension to be
less strict, allowing for a coupling to `^1.1.2` instead of exactly
`^1.1.1`. This is very relevant if we make a small bump to the extension
but don't want to make a new release of qgrid, or if qgrid would be
installed by conda and it's availability was delayed so the newer npm
package was available but the python package was outdated and coupled to
the old versions specifically.
- Move various loaders that are only used by webpack to build the json
files from being dependencies to being devDependencies.
- Bump versions of various dependencies to avoid security issues found
in packages by npm.
@consideRatio
Copy link
Contributor Author

@gerrymanoim perhaps you could review this? I've worked to debug many extensions lately and feel pretty good about this PR at this point.

@RobinL
Copy link

RobinL commented Mar 27, 2020

Worth noting i was having problems with qgrid on Jupyter 2.0.1. I can confirm that when I pulled consideRatio:jlab2 and installed, everything works fine 👍. Here's the Dockerfile that demonstrates this : https://github.com/ministryofjustice/analytics-platform-jupyter-notebook/blob/spark_24_qgrid/all-spark-notebook/Dockerfile. Thanks @consideRatio

@julitopower
Copy link

I followed somewhat different instructions (npm install fails for some reason) and got this working:

git clone https://github.com/consideratio/qgrid
cd qgrid
git checkout jlab2

jlpm --cwd js install
pip install -e .

jupyter labextension link ./js

My environment:

$ jupyter --version
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : not installed
ipython          : 7.13.0
ipykernel        : 5.2.0
jupyter client   : 6.1.2
jupyter lab      : 2.0.1
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.4
traitlets        : 4.3.3

@consideRatio
Copy link
Contributor Author

I followed somewhat different instructions (npm install fails for some reason) and got this working:

git clone https://github.com/consideratio/qgrid
cd qgrid
git checkout jlab2

jlpm --cwd js install
pip install -e .

jupyter labextension link ./js

Ah! jlpm install == jlpm == npm install almost, but with jlpm you are guaranteed to use the same node that jupyterlab will rely on, so your version is better.

@SylvainCorlay
Copy link

That would be fantastic if this was merged!

@gerrymanoim
Copy link
Contributor

Hey @consideRatio - apologies for the delay, we've been a bit scattered transitioning to WFH and I missed this. Looking now.

@gerrymanoim
Copy link
Contributor

This looks great, thanks!

@gerrymanoim gerrymanoim merged commit d5240d5 into quantopian:master Apr 7, 2020
@gerrymanoim
Copy link
Contributor

That's out now:

Thanks again for the great PR and sorry for the delay on getting this merged.

consideRatio added a commit to consideRatio/qgrid that referenced this pull request Apr 7, 2020
In quantopian#301 I forgot to bump this to 1.1.3, which probably is a harmless
mistake, but it can be good for anyone in the future to have an easier
time making the next release to have this align with the other versions.
gerrymanoim pushed a commit that referenced this pull request Apr 7, 2020
In #301 I forgot to bump this to 1.1.3, which probably is a harmless
mistake, but it can be good for anyone in the future to have an easier
time making the next release to have this align with the other versions.
@GraemeHutcheon
Copy link

Hi,
Should I now be able to do a conda update --all
and then issue

pip install qgrid
jupyter labextension install qgrid2

now in with pip freeze | grep -i grid

qgrid==1.3.1

and with jupyter labextension list

qgrid2 v1.1.3 enabled OK

As I still appear to be getting Error displaying widget: model not found

What am I supposed to be doing?

Thanks Graeme

@lopisan
Copy link

lopisan commented Apr 27, 2020

Hi,
Should I now be able to do a conda update --all
and then issue

pip install qgrid
jupyter labextension install qgrid2

now in with pip freeze | grep -i grid

qgrid==1.3.1

and with jupyter labextension list

qgrid2 v1.1.3 enabled OK

As I still appear to be getting Error displaying widget: model not found

What am I supposed to be doing?

Thanks Graeme

I just struggled to make qgrid work in Jupyter lab 2.0.1 - what helped me was:

  1. pip install qgrid==1.3.1
  2. jupyter labextension uninstall qgrid2
  3. jupyter labextension install qgrid2

Also check that you have no other qgrid labextensions installed (I've had qgrid and @8080labs/qgrid which I had to uninstall)

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 this pull request may close these issues.

Pytest fails on master branch jupyterlab 2.0.0 - Error displaying widget: model not found
7 participants