Skip to content

Commit

Permalink
Add dev install script
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Nov 5, 2024
1 parent 5880397 commit 5af0af4
Show file tree
Hide file tree
Showing 7 changed files with 887 additions and 1,212 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ jobs:

- name: Install dependencies
run: |
pip install "jupyterlab>=4.0.0,<5"
pip install -e .
pip install -e projects/jupyter-collaboration-ui -e projects/jupyter-docprovider -e projects/jupyter-server-ydoc
jupyter labextension develop --overwrite projects/jupyter-collaboration-ui
jupyter labextension develop --overwrite projects/jupyter-docprovider
jlpm
jlpm build
yarn dev
- name: Run Tests
run: |
Expand Down Expand Up @@ -107,8 +101,8 @@ jobs:
- name: Install the Python dependencies
run: |
python -m pip install "jupyterlab>=4.0.0,<5"
python -m pip install -e ".[test]" codecov
python -m pip install -e projects/jupyter-collaboration-ui -e projects/jupyter-docprovider -e "projects/jupyter-server-ydoc[test]"
python -m pip install codecov
yarn dev
- name: List installed packages
run: |
Expand Down Expand Up @@ -162,8 +156,7 @@ jobs:

- name: Install the Python dependencies
run: |
pip install -e ".[test]"
pip install -e projects/jupyter-collaboration-ui -e projects/jupyter-docprovider -e "projects/jupyter-server-ydoc[test]"
yarn dev
- name: Run the unit tests
run: |
Expand All @@ -183,8 +176,7 @@ jobs:

- name: Install the Python dependencies
run: |
pip install -e ".[test]"
pip install -e projects/jupyter-collaboration-ui -e projects/jupyter-docprovider -e "projects/jupyter-server-ydoc[test]"
yarn dev
- name: List installed packages
run: |
Expand Down
1 change: 0 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
nodeLinker: node-modules
enableImmutableInstalls: false
9 changes: 2 additions & 7 deletions docs/source/developer/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,8 @@ Once you have installed the dependencies above, use the following steps:
git clone https://github.com/jupyterlab/jupyter-collaboration.git
cd jupyter-collaboration
# install monorepo
pip install -e ".[dev,test]"
# install local dependencies as editable
pip install -e projects/jupyter-collaboration-ui -e projects/jupyter-docprovider -e projects/jupyter-server-ydoc
# link lab extensions
jupyter labextension develop --overwrite projects/jupyter-collaboration-ui
jupyter labextension develop --overwrite projects/jupyter-docprovider
# install monorepo in dev mode
python scripts/dev_install.py
If you are using a system-wide Python installation and you only want to install the server for you,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"packages/*"
],
"scripts": {
"dev": "python scripts/dev_install.py",
"build": "lerna run build",
"build:prod": "lerna run build:prod",
"build:test": "lerna run build:test",
Expand Down
37 changes: 37 additions & 0 deletions scripts/dev_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import subprocess
from pathlib import Path
from typing import Optional


def execute(cmd: str, cwd: Optional[Path] = None) -> None:
subprocess.run(cmd.split(" "), check=True, cwd=cwd)


def install_dev() -> None:
install_build_deps = "python -m pip install jupyterlab>=4,<5"
install_js_deps = "jlpm install"

python_package_prefix = "projects"
python_packages = ["jupyter-collaboration-ui", "jupyter-docprovider", "jupyter-server-ydoc"]

execute(install_build_deps)
execute(install_js_deps)

for py_package in python_packages:
real_package_name = py_package.replace("-", "_")
execute(f"pip uninstall {real_package_name} -y")
execute(f"pip install -e {python_package_prefix}/{py_package}[test]")

# List of server extensions
if py_package in ["jupyter-server-ydoc"]:
execute(f"jupyter server extension enable {real_package_name}")

# List of jupyterlab extensions
if py_package in ["jupyter-collaboration-ui", "jupyter-docprovider"]:
execute(
f"jupyter labextension develop --overwrite {python_package_prefix}/{py_package} --overwrite"
)


if __name__ == "__main__":
install_dev()
Loading

0 comments on commit 5af0af4

Please sign in to comment.