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

Add a section to use local dependencies #7292

Merged
merged 7 commits into from
Mar 11, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,40 @@ Then start Jupyter Notebook with:
jupyter notebook
```

### Local changes in Notebook dependencies

The development installation described above fetches javascript dependencies from [npmjs](https://www.npmjs.com/),
brichet marked this conversation as resolved.
Show resolved Hide resolved
according to the versions in the _package.json_ file.
However, some changes in Notebook depend on changes in dependencies (e.g. `@jupyterlab` packages) that have not yet
brichet marked this conversation as resolved.
Show resolved Hide resolved
been published.

[yalc](https://github.com/wclr/yalc) can be a solution for easily fetching local javascript packages in your build of
brichet marked this conversation as resolved.
Show resolved Hide resolved
Notebook, acting as a local package repository.

- Install yalc globally in you environment:
`npm install -g yalc`
- Publish you dependency package:\
`yalc publish`, from the package root directory.\
For instance, if you have are developing on _@jupyterlab/ui-components_, this command must be executed from
_path_to_jupyterlab/packages/ui-components_.
- Depend on this local repository in Notebook:
- from the Notebook root directory:\
`yalc add your_package` : this will create a _dependencies_ entry in the main _package.json_ file.\
With the previous example, it would be `yalc add @jupyterlab/ui-components`.
- Notebook is a monerepo, so we want this dependency to be 'linked' as a resolution (for all sub-packages) instead
of a dependency.\
The easiest way is probably to manually move the new entry in _package.json_ from _dependencies_ to _resolutions_.
brichet marked this conversation as resolved.
Show resolved Hide resolved
- Build Notebook with the local dependency:\
`jlpm install && jlpm build`

Changes in dependency must then be built and pushed using `jlpm build && yalc push` (from the package root directory),
brichet marked this conversation as resolved.
Show resolved Hide resolved
and fetched from Notebook using `yarn install`.

**Warning**: you need to make sure that the dependencies of Notebook and the local package match correctly,
otherwise there will be errors with webpack during build.\
In the previous example, both _@jupyterlab/ui-components_ and Notebook depend on _@jupyterlab/coreutils_. We
strongly advise you to depend on the same version.

## Running Tests

To run the tests:
Expand Down
Loading