Skip to content

Commit

Permalink
Convert to monorepo (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc authored Nov 20, 2024
1 parent b09e477 commit eaff78e
Show file tree
Hide file tree
Showing 39 changed files with 5,283 additions and 919 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ author_name: QuantStack
has_binder: false
has_settings: false
kind: frontend
labextension_name: jupyterlab-suggestions
labextension_name: jupyter-suggestions
project_short_description: A JupyterLab extension for suggesting changes.
python_name: jupyterlab_suggestions
repository: https://github.com/QuantStack/jupyterlab-suggestions
Expand Down
161 changes: 109 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,72 +15,72 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
- name: Install dependencies
run: python -m pip install -U "jupyterlab>=4.0.0,<5"

- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Build the extension
run: |
set -eux
python -m pip install .[test]
- name: Build the extension
run: |
set -eux
jlpm dev
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyterlab-suggestions.*OK"
python -m jupyterlab.browser_check
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter-suggestions.*OK"
python -m jupyterlab.browser_check
- name: Package the extension
run: |
set -eux
- name: Package the extension
run: |
set -eux
pip install build
python -m build
pip uninstall -y "jupyterlab_suggestions" jupyterlab
pip install hatch
yarn build:packages
- name: Upload extension packages
uses: actions/upload-artifact@v4
with:
name: extension-artifacts
path: dist/jupyterlab_suggestions*
if-no-files-found: error
- name: Upload extension packages
uses: actions/upload-artifact@v4
with:
name: extension-artifacts
path: |
python/*/dist/jupyter_suggestions*
if-no-files-found: error

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
architecture: 'x64'
- uses: actions/download-artifact@v4
with:
name: extension-artifacts
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install "jupyterlab>=4.0.0,<5" jupyterlab_suggestions*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyterlab-suggestions.*OK"
python -m jupyterlab.browser_check --no-browser-test
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'x64'
- uses: actions/download-artifact@v4
with:
name: extension-artifacts
- name: Install and Test
run: |
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
cp ./jupyter_suggestions_core/dist/jupyter_suggestions*.whl .
pip install "jupyterlab>=4.0.0,<5" jupyter_suggestions*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyter-suggestions.*OK"
python -m jupyterlab.browser_check --no-browser-test
check_links:
name: Check Links
Expand All @@ -90,3 +90,60 @@ jobs:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

build-lite:
name: Build JupyterLite
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install the dependencies
run: |
python -m pip install jupyterlite-core jupyterlite-pyodide-kernel
- name: Download extension package
uses: actions/download-artifact@v4
with:
name: extension-artifacts

- name: Install the extension
run: |
set -eux
cp ./jupyter_suggestions_core/dist/jupyter_suggestions*.whl .
python -m pip install jupyter_suggestions*.whl
- name: Build the lite site
run: |
set -eux
jupyter lite build --output-dir dist
- name: Upload github-pages artifact
id: upload-jupyterlite-artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
retention-days: 30

deploy:
needs: [build-lite]
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:

version_spec: next
token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Distributions
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/deploy.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules
**/package.json
!/package.json
jupyterlab_suggestions
**/*.js
**/*.d.ts
**/labextension/*
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodeLinker: node-modules
enableImmutableInstalls: false
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Contributing

### Development install

**Note:** You will need [Node.js](https://nodejs.org/) to build the extension package.

The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.

```bash
# Clone the repo to your local environment
git clone https://github.com/QuantStack/jupyterlab-suggestions.git
# Change directory to the jupytercad directory
cd jupyter-suggestions
# Install JupyterLab for jlpm
pip install jupyterlab
# Install dependencies
jlpm install
# Install package inde dev mode
jlpm dev
# Rebuild extension Typescript source after making changes
jlpm run build
```

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
```

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

#### See also

Custom build doc: https://ocjs.org/docs/app-dev-workflow/custom-builds

Custom build example: https://github.com/donalffons/opencascade.js/blob/master/website/ocjs-editor-theme/src/customBuild/customBuild.yml

Where to find symbols: https://dev.opencascade.org/doc/refman/html/annotated.html

### Development uninstall

```bash
pip uninstall jupyter-suggestions
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `jupyter-suggestions` within that folder.

### Packaging the extension

See [RELEASE](RELEASE.md)
50 changes: 4 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,10 @@ A JupyterLab extension for suggesting changes.

## Contributing

### Development install
`jupyter-suggestions` is an open-source project, and contributions are always welcome. If you would like to contribute to `jupyter-suggestions`, please fork the repository and submit a pull request.

Note: You will need NodeJS to build the extension package.
See [CONTRIBUTING](CONTRIBUTING.md) for dev installation instructions.

The `jlpm` command is JupyterLab's pinned version of
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
`yarn` or `npm` in lieu of `jlpm` below.
## License

```bash
# Clone the repo to your local environment
# Change directory to the jupyterlab_suggestions directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm build
```

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

```bash
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm watch
# Run JupyterLab in another terminal
jupyter lab
```

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

By default, the `jlpm build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:

```bash
jupyter lab build --minimize=False
```

### Development uninstall

```bash
pip uninstall jupyterlab_suggestions
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `jupyterlab-suggestions` within that folder.

### Packaging the extension

See [RELEASE](RELEASE.md)
`jupyter-suggestions` is licensed under the BSD 3-Clause License. See the LICENSE file for more information.
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Making a new release of jupyterlab_suggestions
# Making a new release of jupyter_suggestions

The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).

Expand Down
5 changes: 0 additions & 5 deletions install.json

This file was deleted.

6 changes: 6 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"npmClient": "yarn",
"version": "independent",
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"packages": ["packages/*", "python/jupyter_suggestions_core"]
}
Loading

0 comments on commit eaff78e

Please sign in to comment.