Giter VIP home page Giter VIP logo

Comments (5)

mwouts avatar mwouts commented on August 25, 2024

Hi @djangoliv , thank you for the suggestion and for the code snippet. Yes indeed I do like the idea to have something like an on/off toggle, that sounds great.

On the way towards such an extension I see two points that we should discuss:

  • Do we want to bundle the extension with the Python package, or not? If I am correct the extension should be installed only in the Jupyter environment, while the Python package should be installed only in the kernel used by the notebook, so probably there is no big incentive to link the two?
  • Where does the output of the requestExecute goes? Probably it is not displayed at all in the notebook? If not, until we solve #51 , the absence of the init_notebook_mode cell is going to break the HTML export of the notebook.

Let me know if you have any advice regarding the above. Thanks!

from itables.

djangoliv avatar djangoliv commented on August 25, 2024

Hello @mwouts

You're right, it may be better to make two separate repository (a jupyterlab-itables project).

Indeed, the output is not displayed and the init_notebook_mode code will not be present in the HTML export.

Personally it doesn't bother me. Since the code just replaces the table visualization.
The exported code will remain consistent and display the tables in a classic way.

Otherwise, the button could generate and execute the init cell at the beginning of the notebook.

from itables.

mwouts avatar mwouts commented on August 25, 2024

Hello @djangoliv , I have created a draft extension at https://github.com/mwouts/jupyterlab-itables

However when I try to install it with

jupyter labextension develop . --overwrite

then I run into this error:

    src/index.ts(7,63): error TS2344: Type 'INotebookModel' does not satisfy the constraint 'IModel'.
      Types of property 'sharedModel' are incompatible.
        Property 'dirty' is missing in type 'ISharedNotebook' but required in type 'ISharedDocument'.

Do you think you can iterate on top of my draft?
Thanks!

(full logs) /home/marc/GitHub/jupyterlab-itables/setup.py:65: DeprecatedWarning: create_cmdclass is deprecated as of 0.8 and will be removed in 1.0. " Use `wrap_installers` to handle prebuild steps in cmdclass. Use `get_data_files` to handle data files. Use `include_package_data=True` and `MANIFEST.in` for package data.

cmdclass = create_cmdclass(
/home/marc/GitHub/jupyterlab-itables/setup.py:71: DeprecatedWarning: install_npm is deprecated as of 0.8 and will be removed in 1.0. Use npm_builder and wrap_installers
install_npm(
Obtaining file:///home/marc/GitHub/jupyterlab-itables
Installing collected packages: jupyterlab-itables
Running setup.py develop for jupyterlab-itables
ERROR: Command errored out with exit status 1:
command: /home/marc/miniconda3/envs/jupytext-dev/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/marc/GitHub/jupyterlab-itables/setup.py'"'"'; file='"'"'/home/marc/GitHub/jupyterlab-itables/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps
cwd: /home/marc/GitHub/jupyterlab-itables/
Complete output (73 lines):
/home/marc/GitHub/jupyterlab-itables/setup.py:65: DeprecatedWarning: create_cmdclass is deprecated as of 0.8 and will be removed in 1.0. "
Use wrap_installers to handle prebuild steps in cmdclass.
Use get_data_files to handle data files.
Use include_package_data=True and MANIFEST.in for package data.

  cmdclass = create_cmdclass(
/home/marc/GitHub/jupyterlab-itables/setup.py:71: DeprecatedWarning: install_npm is deprecated as of 0.8 and will be removed in 1.0. Use `npm_builder` and `wrap_installers`
  install_npm(
running develop
running jsdeps
yarn not found, ignoring yarn.lock file
Installing build dependencies with npm.  This may take a while...
> jlpm install
yarn install v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@jupyterlab/application > @jupyterlab/[email protected]" has unmet peer dependency "react@^17.0.1".
warning "@jupyterlab/application > @lumino/[email protected]" has unmet peer dependency "[email protected]".
warning "@jupyterlab/docregistry > @jupyterlab/[email protected]" has unmet peer dependency "react@^17.0.1".
warning "@jupyterlab/builder > @jupyterlab/buildutils > verdaccio > [email protected]" has unmet peer dependency "typanion@*".
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
[4/4] Building fresh packages...
success Saved lockfile.
$ jlpm run clean && jlpm run build:prod
yarn run v1.22.17
$ jlpm run clean:lib
$ rimraf lib tsconfig.tsbuildinfo
Done in 1.61s.
yarn run v1.22.17
$ jlpm run build:lib && jlpm run build:labextension
$ tsc
src/index.ts(7,63): error TS2344: Type 'INotebookModel' does not satisfy the constraint 'IModel'.
  Types of property 'sharedModel' are incompatible.
    Property 'dirty' is missing in type 'ISharedNotebook' but required in type 'ISharedDocument'.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/marc/GitHub/jupyterlab-itables/setup.py", line 81, in <module>
    setup(**setup_args)
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 637, in run
    [self.run_command(cmd) for cmd in cmds]
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 637, in <listcomp>
    [self.run_command(cmd) for cmd in cmds]
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 318, in run
    c.run()
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 612, in run
    builder()
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 211, in builder
    run(npm_cmd + ['install'], cwd=node_package)
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/site-packages/jupyter_packaging/setupbase.py", line 272, in run
    return subprocess.check_call(cmd, **kwargs)
  File "/home/marc/miniconda3/envs/jupytext-dev/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/marc/miniconda3/envs/jupytext-dev/bin/jlpm', 'install']' returned non-zero exit status 1.
----------------------------------------

ERROR: Command errored out with exit status 1: /home/marc/miniconda3/envs/jupytext-dev/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/marc/GitHub/jupyterlab-itables/setup.py'"'"'; file='"'"'/home/marc/GitHub/jupyterlab-itables/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
An error occurred.
subprocess.CalledProcessError: Command '['/home/marc/miniconda3/envs/jupytext-dev/bin/python', '-m', 'pip', 'install', '-e', '/home/marc/GitHub/jupyterlab-itables']' returned non-zero exit status 1.
See the log file for details: /tmp/jupyterlab-debug-68nqiy_h.log

from itables.

djangoliv avatar djangoliv commented on August 25, 2024

@mwouts See: https://github.com/mwouts/jupyterlab-itables/pull/1

from itables.

mwouts avatar mwouts commented on August 25, 2024

Hi @djangoliv , I am going to close this issue because the init_notebook_mode function changed significantly in itables==1.0.0.

In particular it now has outputs, and we need these outputs in the notebook, so I am afraid the solution that you considered here would only work for init_notebook_mode(connected=True) while the default is now init_notebook_mode(connected=False).

Anyway let me thank you for suggesting this (and use connected=False in your local extension if you want to continue using it!)

from itables.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.