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

Update main README and hello-world README #277

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

allison-truhlar
Copy link

  • Minor edits/reorganization in main README and hello-world README for clarity on how to get started, specifically for a new user for the repo.
  • Suggests two command changes in the hello-world README to fix error messages

Adds a section to the hello-world example, 'Modify the extension', to indicate where this example picks up after the TL;DR leaves off. Also adds steps to the TL;DR to clarify what the
 code snippet is doing and to mention that more details are available in hello-world, including the information on the extension template.
fixes this error:--trustcopier copy/update
matches updated steps in the main README.md. Fixes yarn error message
Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @allison-truhlar I got a minor question.

Would you also monde updating the sentence:

The first command installs the dependencies that are specified in the
setup.py file and in package.json.

To mention pyproject.toml instead of setup.py?


These are the instructions on how your extension can be installed for development:

> You will need NodeJS to build the extension package.

```bash
# Required to identify the project for Yarn 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, you needed that step to install that example specifically from the examples repository?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, without it I get this warning when running pip install -e .:

(jupyterlab-extension-examples) truhlara@truhlara-lm1 my_extension % pip install -e .
Obtaining file:///Users/truhlara/dev/test-jupyterlab-extension-examples/my_extension
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Installing backend dependencies ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      INFO:hatch_jupyter_builder.utils:Running jupyter-builder
      INFO:hatch_jupyter_builder.utils:Building with hatch_jupyter_builder.npm_builder
      INFO:hatch_jupyter_builder.utils:With kwargs: {'build_cmd': 'install:extension', 'npm': ['jlpm'], 'source_dir': 'src', 'build_dir': 'myextension/labextension'}
      INFO:hatch_jupyter_builder.utils:Installing build dependencies with npm.  This may take a while...
      INFO:hatch_jupyter_builder.utils:> /private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/overlay/bin/jlpm install
      Usage Error: The nearest package directory (/Users/truhlara/dev/test-jupyterlab-extension-examples/my_extension) doesn't seem to be part of the project declared in /Users/truhlara/dev/test-jupyterlab-extension-examples.
      
      - If /Users/truhlara/dev/test-jupyterlab-extension-examples isn't intended to be a project, remove any yarn.lock and/or package.json file there.
      - If /Users/truhlara/dev/test-jupyterlab-extension-examples is intended to be a project, it might be that you forgot to list my_extension in its workspace configuration.
      - Finally, if /Users/truhlara/dev/test-jupyterlab-extension-examples is fine and you intend my_extension to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.
      
      $ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
      Traceback (most recent call last):
        File "/Users/truhlara/miniconda3/envs/jupyterlab-extension-examples/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 167, in prepare_metadata_for_build_editable
          hook = backend.prepare_metadata_for_build_editable
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/Users/truhlara/miniconda3/envs/jupyterlab-extension-examples/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
          ~~~~^^
        File "/Users/truhlara/miniconda3/envs/jupyterlab-extension-examples/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/truhlara/miniconda3/envs/jupyterlab-extension-examples/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 176, in prepare_metadata_for_build_editable
          whl_basename = build_hook(metadata_directory, config_settings)
        File "/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/overlay/lib/python3.13/site-packages/hatchling/build.py", line 83, in build_editable
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['editable'])))
                                  ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/overlay/lib/python3.13/site-packages/hatchling/builders/plugin/interface.py", line 147, in build
          build_hook.initialize(version, build_data)
          ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/normal/lib/python3.13/site-packages/hatch_jupyter_builder/plugin.py", line 94, in initialize
          raise e
        File "/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/normal/lib/python3.13/site-packages/hatch_jupyter_builder/plugin.py", line 89, in initialize
          build_func(self.target_name, version, **build_kwargs)
          ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/normal/lib/python3.13/site-packages/hatch_jupyter_builder/utils.py", line 115, in npm_builder
          run([*npm_cmd, "install"], cwd=str(abs_path))
          ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/normal/lib/python3.13/site-packages/hatch_jupyter_builder/utils.py", line 231, in run
          return subprocess.check_call(cmd, **kwargs)
                 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
        File "/Users/truhlara/miniconda3/envs/jupyterlab-extension-examples/lib/python3.13/subprocess.py", line 419, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/private/var/folders/lk/8y24cj3920l4yp9mzzjcw0z00000gq/T/pip-build-env-9ud29507/overlay/bin/jlpm', 'install']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

the first command installs dependencies specified in pyproject.toml, instead of setup.py
@allison-truhlar
Copy link
Author

Would you also monde updating the sentence:

The first command installs the dependencies that are specified in the
setup.py file and in package.json.

To mention pyproject.toml instead of setup.py?

@fcollonval Sure! I did this in the most recent commit, da86708

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.

2 participants