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

Setup a monorepo with a JupyterLab extension #77

Merged
merged 20 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
**/lib
**/node_modules
**/style
**/package.json
**/tsconfig.json
**/tsconfig.test.json
**/*.d.ts
**/test
**/ui-tests

docs
tests
.eslintrc.js
jupyter-config
jupyterlab_rtc

packages/collaboration/babel.config.js
packages/docprovider/babel.config.js
packages/docprovider/jest.config.js
39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true
}
}
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
}
};
36 changes: 25 additions & 11 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,40 @@ on:
pull_request:
branches: ["*"]

permissions:
contents: write

jobs:
check_release:
runs-on: ubuntu-latest
strategy:
matrix:
group: [check_release, link_check]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

- name: Install Dependencies
run: |
pip install -e .
python -m pip install -e .

- name: Check Release
if: ${{ matrix.group == 'check_release' }}
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Link Check
if: ${{ matrix.group == 'link_check' }}
uses: jupyter-server/jupyter_releaser/.github/actions/check-links@v1

# FIXME - should be done by jupyter-releaser
- name: Build Python package
run: |
set -ex
python -m pip install build

python -m build

- name: Upload Distributions
uses: actions/upload-artifact@v3
with:
name: jupyter-releaser-dist-${{ github.run_number }}
path: |
.jupyter_releaser_checkout/dist
dist
29 changes: 22 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
- name: Install dependencies
run: |
pip install jupyterlab
pip install -e .
jlpm
- name: Run pre-commit
uses: pre-commit/[email protected]
with:
Expand All @@ -35,19 +40,19 @@ jobs:

test:
runs-on: ${{ matrix.os }}
timeout-minutes: 10
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.10"]
python-version: ["3.8", "3.11"]
include:
- os: windows-latest
python-version: "3.9"
python-version: "3.10"
- os: ubuntu-latest
python-version: "pypy-3.8"
- os: macos-latest
python-version: "3.8"
python-version: "3.10"
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -63,7 +68,7 @@ jobs:
- name: Run the tests with Coverage
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(runner.os, 'Windows') }}
run: |
python -m pytest -vv --cov jupyter_server_ydoc --cov-branch --cov-report term-missing:skip-covered
python -m pytest -vv --cov jupyterlab_rtc --cov-branch --cov-report term-missing:skip-covered
- name: Run the tests on pypy and Windows
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(runner.os, 'Windows') }}
run: |
Expand All @@ -82,7 +87,7 @@ jobs:
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.7"
python_version: "3.11"
- name: Install miniumum versions
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
- name: Run the unit tests
Expand Down Expand Up @@ -127,4 +132,14 @@ jobs:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1
with:
extra_test: 'jupyter server extension list 2>&1 | grep -ie "jupyter_server_ydoc.*OK"'
extra_test: 'jupyter server extension list 2>&1 | grep -ie "jupyterlab_rtc.*OK"'

check_links:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
with:
ignore_links: "../api/*.* .*/images/[\\w-]+.png https://docs.github.com/en/.*"
160 changes: 121 additions & 39 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,41 +1,123 @@
MANIFEST
build
dist
_build
docs/man/*.gz
docs/source/api/generated
docs/source/config.rst
docs/gh-pages
node_modules
*.py[co]
__pycache__
*.egg-info
*~
*.bak
*.bundle.*
lib/
node_modules/
*.log
.eslintcache
.stylelintcache
*.egg-info/
.ipynb_checkpoints
.tox
*.tsbuildinfo
jupyterlab_rtc/labextension

# Version file is handled by hatchling
jupyterlab_rtc/_version.py

# Integration tests
ui-tests/test-results/
ui-tests/playwright-report/

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage/
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# End of https://www.gitignore.io/api/python

# OSX files
.DS_Store
\#*#
.#*
.coverage*
.pytest_cache
src

*.swp
*.map
Read the Docs
config.rst
docs/source/changelog.md

/.project
/.pydevproject

# jetbrains ide stuff
*.iml
.idea/

# vscode ide stuff
*.code-workspace
.history
.vscode/*
!.vscode/*.template
30 changes: 25 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
ci:
# skip any check that needs internet access
skip: [prettier, eslint, stylelint]

default_language_version:
node: system

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down Expand Up @@ -28,11 +35,6 @@ repos:
files: \.py$
args: [--profile=black]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: prettier

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
Expand Down Expand Up @@ -72,3 +74,21 @@ repos:
types: [yaml]
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
stages: [manual]

- repo: local
hooks:
- id: prettier
name: prettier
entry: 'npm run prettier'
language: node
types_or: [json, ts, tsx, javascript, jsx, css]
- id: eslint
name: eslint
entry: 'npm run eslint'
language: node
types_or: [ts, tsx, javascript, jsx]
- id: stylelint
name: stylelint
entry: 'npm run stylelint'
language: node
types: [css]
Loading