jupyterlab / extension-cookiecutter-ts

A cookiecutter recipe for JupyterLab extensions in Typescript
BSD 3-Clause "New" or "Revised" License
179 stars 88 forks source link

Check installing from an sdist with jupyter-packaging 0.9 #146

Closed jtpio closed 3 years ago

jtpio commented 3 years ago

https://github.com/jupyterlab/extension-cookiecutter-ts/pull/143 upgraded to Jupyter Packaging 0.9, and removed the skip_if_exists check that was used to not rebuild assets if they already exist.

This is useful when packaging for conda and was added in #121, for example to not require jupyterlab as a host dependency.

Trying with the latest cookiecutter, the following now seems to be triggering a build:

python -m pip install build
python -m build

# assets are in the tarball under `myextension/labextension`

# create a new env
mamba create -n tmp python -y

# install from source should just "copy files"
python -m pip install ./dist/myextension-0.1.0.tar.gz

Giving:


  Traceback (most recent call last):
    File "/tmp/pip-build-env-t8o7cw22/overlay/bin/jlpm", line 8, in <module>
      sys.exit(main())
    File "/tmp/pip-build-env-t8o7cw22/overlay/lib/python3.9/site-packages/jupyterlab/jlpmapp.py", line 43, in main
      execvp('node', ['node', YARN_PATH] + argv)
    File "/tmp/pip-build-env-t8o7cw22/overlay/lib/python3.9/site-packages/jupyterlab/jlpmapp.py", line 24, in execvp
      cmd = which(cmd)
    File "/tmp/pip-build-env-t8o7cw22/overlay/lib/python3.9/site-packages/jupyterlab_server/process.py", line 59, in which
      raise ValueError(msg)
  ValueError: Please install Node.js and npm before continuing installation. You may be able to install Node.js from your package manager, from conda, or directly from the Node.js website (https://nodejs.org).
  Traceback (most recent call last):

  ...

  subprocess.CalledProcessError: Command '['/tmp/pip-build-env-t8o7cw22/overlay/bin/jlpm', 'install']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for myextension
Failed to build myextension
ERROR: Could not build wheels for myextension which use PEP 517 and cannot be installed directly
bollwyvl commented 3 years ago

Sooo... i think we need need to get jupyter_packaging out of install_requires. this is going to create a lot of builds that have hard-to-understand errors, and it will only take one old/over-specified version break somebody's build in weird ways.

bollwyvl commented 3 years ago

Also, in this specific case, for this specific error, deleting pyproject.toml does the trick.

https://github.com/conda-forge/staged-recipes/pull/14797

jtpio commented 3 years ago

We should also add a CI workflow to the cookiecutter that would upload the sdist and wheel as artifacts, and install them in a clean environment without the build dependencies already installed.