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

Import shared model #86

Merged
merged 13 commits into from
Nov 7, 2022
30 changes: 25 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests

on:
push:
branches: [main]
branches: [0.2.x]
pull_request:
branches: [main]
branches: [0.2.x]

jobs:
pre-commit:
Expand Down Expand Up @@ -46,11 +46,31 @@ jobs:
mamba-version: "*"
channels: conda-forge
python-version: "3.7"

- name: Install dependencies
run: |
mamba install python=${{ matrix.python-version }} pip nodejs
mamba install python=${{ matrix.python-version }} pip nodejs=16 yarn
pip install .[test]
cd tests; npm install
- name: Run tests

- name: Build JavaScript assets
working-directory: javascript
run: |
yarn
yarn build
cd ../tests; npm install

- name: Linter check
if: ${{ !contains(matrix.os, 'windows') }}
working-directory: javascript
run: |
yarn lint:check

- name: Run Python tests
run: |
pytest -v

- name: Run JS tests
working-directory: javascript
run: |
yarn build:test
yarn test:cov
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ dmypy.json

# Pyre type checker
.pyre/

node_modules/
tests/package-lock.json
javascript/tsconfig.tsbuildinfo
javascript/.eslintcache
34 changes: 17 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,59 +231,59 @@ Back-port of #56, #57 and #59.

## 0.1.4

([Full Changelog](https://github.com/davidbrochart/jupyter_ydoc/compare/v0.1.3...d6e754a8c957582029d923cadc4e6547a324718c))
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/v0.1.3...d6e754a8c957582029d923cadc4e6547a324718c))

### Merged PRs

- Update ypy>=0.5.0 [#9](https://github.com/davidbrochart/jupyter_ydoc/pull/9) ([@davidbrochart](https://github.com/davidbrochart))
- Update ypy>=0.5.0 [#9](https://github.com/jupyter-server/jupyter_ydoc/pull/9) ([@davidbrochart](https://github.com/davidbrochart))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/davidbrochart/jupyter_ydoc/graphs/contributors?from=2022-05-05&to=2022-05-09&type=c))
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2022-05-05&to=2022-05-09&type=c))

[@davidbrochart](https://github.com/search?q=repo%3Adavidbrochart%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-05..2022-05-09&type=Issues)
[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-05..2022-05-09&type=Issues)

## 0.1.3

([Full Changelog](https://github.com/davidbrochart/jupyter_ydoc/compare/v0.1.2...c68ebe54e500edde4eb34aa598dfb7bbb4d22b63))
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/v0.1.2...c68ebe54e500edde4eb34aa598dfb7bbb4d22b63))

### Merged PRs

- Add setuptools to install_requires [#7](https://github.com/davidbrochart/jupyter_ydoc/pull/7) ([@davidbrochart](https://github.com/davidbrochart))
- Add setuptools to install_requires [#7](https://github.com/jupyter-server/jupyter_ydoc/pull/7) ([@davidbrochart](https://github.com/davidbrochart))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/davidbrochart/jupyter_ydoc/graphs/contributors?from=2022-05-05&to=2022-05-05&type=c))
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2022-05-05&to=2022-05-05&type=c))

[@davidbrochart](https://github.com/search?q=repo%3Adavidbrochart%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-05..2022-05-05&type=Issues)
[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-05..2022-05-05&type=Issues)

## 0.1.2

([Full Changelog](https://github.com/davidbrochart/jupyter_ydoc/compare/v0.1.1...6a1fc44531344e1f930a7fd52b62cbd289873be0))
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/v0.1.1...6a1fc44531344e1f930a7fd52b62cbd289873be0))

### Merged PRs

- Improve jupyter_ydoc.ydocs [#5](https://github.com/davidbrochart/jupyter_ydoc/pull/5) ([@davidbrochart](https://github.com/davidbrochart))
- Improve jupyter_ydoc.ydocs [#5](https://github.com/jupyter-server/jupyter_ydoc/pull/5) ([@davidbrochart](https://github.com/davidbrochart))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/davidbrochart/jupyter_ydoc/graphs/contributors?from=2022-05-04&to=2022-05-05&type=c))
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2022-05-04&to=2022-05-05&type=c))

[@davidbrochart](https://github.com/search?q=repo%3Adavidbrochart%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-04..2022-05-05&type=Issues)
[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-04..2022-05-05&type=Issues)

## 0.1.1

([Full Changelog](https://github.com/davidbrochart/jupyter_ydoc/compare/0.1.0...9db91b826c38116ab1e00b26140dd49950e1a793))
([Full Changelog](https://github.com/jupyter-server/jupyter_ydoc/compare/0.1.0...9db91b826c38116ab1e00b26140dd49950e1a793))

### Merged PRs

- Add test [#3](https://github.com/davidbrochart/jupyter_ydoc/pull/3) ([@davidbrochart](https://github.com/davidbrochart))
- Update README [#1](https://github.com/davidbrochart/jupyter_ydoc/pull/1) ([@davidbrochart](https://github.com/davidbrochart))
- Add test [#3](https://github.com/jupyter-server/jupyter_ydoc/pull/3) ([@davidbrochart](https://github.com/davidbrochart))
- Update README [#1](https://github.com/jupyter-server/jupyter_ydoc/pull/1) ([@davidbrochart](https://github.com/davidbrochart))

### Contributors to this release

([GitHub contributors page for this release](https://github.com/davidbrochart/jupyter_ydoc/graphs/contributors?from=2022-05-02&to=2022-05-04&type=c))
([GitHub contributors page for this release](https://github.com/jupyter-server/jupyter_ydoc/graphs/contributors?from=2022-05-02&to=2022-05-04&type=c))

[@davidbrochart](https://github.com/search?q=repo%3Adavidbrochart%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-02..2022-05-04&type=Issues)
[@davidbrochart](https://github.com/search?q=repo%3Ajupyter-server%2Fjupyter_ydoc+involves%3Adavidbrochart+updated%3A2022-05-02..2022-05-04&type=Issues)

## 0.1.0
2 changes: 2 additions & 0 deletions javascript/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
lib
101 changes: 101 additions & 0 deletions javascript/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
module.exports = {
env: {
browser: true,
es6: true,
commonjs: true,
node: true,
'jest/globals': true
},
globals: {
BigInt: 'readonly',
HTMLCollectionOf: 'readonly',
NodeJS: 'readonly',
RequestInit: 'readonly',
RequestInfo: 'readonly',
ScrollLogicalPosition: 'readonly'
},
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
overrides: [
{
files: ['test/**/*.spec.ts'],
plugins: ['jest'],
extends: ['plugin:jest/recommended'],
rules: {
'jest/no-conditional-expect': 'warn',
'jest/valid-title': 'warn',
'jest/no-standalone-expect': [
'error',
{
additionalTestBlockFunctions: ['it']
}
]
}
}
],
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-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/triple-slash-reference': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
camelcase: [
'error',
{
allow: [
'cell_type',
'display_name',
'execution_count',
'orig_nbformat',
'outputs_hidden',
'nbformat_minor'
]
}
],
'id-match': ['error', '^[a-zA-Z_]+[a-zA-Z0-9_]*$'], // https://certitude.consulting/blog/en/invisible-backdoor/
'no-inner-declarations': 'off',
'no-prototype-builtins': 'off',
'no-control-regex': 'warn',
'no-undef': 'warn',
'no-case-declarations': 'warn',
'no-useless-escape': 'off',
'prefer-const': 'off',
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: false
}
]
}
};
3 changes: 3 additions & 0 deletions javascript/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
lib
package.json
5 changes: 5 additions & 0 deletions javascript/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
15 changes: 15 additions & 0 deletions javascript/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to jest",
// Usage:
// Open the parent directory in VSCode
// Run `jlpm test:debug:watch` in a terminal
// Run this debugging task
"port": 9229
}
]
}
17 changes: 17 additions & 0 deletions javascript/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current'
}
}
]
]
};
33 changes: 33 additions & 0 deletions javascript/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) Jupyter Development Team.
* Distributed under the terms of the Modified BSD License.
*/

const path = require('path');
const esModules = ['lib0', 'y-protocols', 'y-websocket', 'yjs'].join('|');

module.exports = {
preset: 'ts-jest/presets/js-with-babel',
testTimeout: 10000,
testPathIgnorePatterns: ['/lib/', '/node_modules/'],
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'node',
'mjs',
'cjs'
],
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`],
reporters: ['default'],
coverageReporters: ['json', 'lcov', 'text', 'html'],
coverageDirectory: path.join(__dirname, 'coverage'),
testRegex: '/test/.*.spec.ts[x]?$',
globals: {
'ts-jest': {
tsconfig: `./tsconfig.test.json`
}
}
};
69 changes: 69 additions & 0 deletions javascript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "@jupyter-notebook/ydoc",
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to use the @jupyter-server scope instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

This package will most likely end up in Jupyter GitHub organization as it is a formal description of documents (similar to nbformat but applied on CRDT). This is the reason I went for jupyter-notebook organization (as we don't own jupyter on npm) rather than jupyter-server.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm actually I just got ownership on jupyter from NPM admin.

Copy link
Member

@jtpio jtpio Nov 14, 2022

Choose a reason for hiding this comment

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

Hmm actually I just got ownership on jupyter from NPM admin.

ah that's good news.

This package will most likely end up in Jupyter GitHub organization as it is a formal description of documents (similar to nbformat but applied on CRDT). This is the reason I went for jupyter-notebook organization (as we don't own jupyter on npm) rather than jupyter-server.

ok thanks for the context, in that case it makes sense. The reason I was suggesting jupyter-server is for consistency since the repo is under the jupyter-server org on GitHub.

@fcollonval I just sent you an invite to join the jupyter-server org on npm.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the invitation

"version": "0.2.0",
"type": "module",
"description": "Jupyter document structures for collaborative editing using YJS",
"homepage": "https://github.com/jupyter-server/jupyter_ydoc",
"bugs": {
"url": "https://github.com/jupyter-server/jupyter_ydoc/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/jupyter-server/jupyter_ydoc.git"
},
"license": "BSD-3-Clause",
"author": "Project Jupyter",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib/"
},
"files": [
"lib/**/*.{d.ts,js,js.map,json}"
],
"scripts": {
"build": "tsc -b",
"build:test": "tsc --build tsconfig.test.json",
"clean": "rimraf lib && rimraf tsconfig.tsbuildinfo",
"docs": "typedoc src",
"eslint": "eslint --ext .js,.jsx,.ts,.tsx --cache --fix .",
"eslint:check": "eslint --ext .js,.jsx,.ts,.tsx --cache .",
"lint": "yarn prettier && yarn eslint",
"lint:check": "yarn prettier:check && yarn eslint:check",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json}\"",
"prettier:check": "prettier --check \"**/*{.ts,.tsx,.js,.jsx,.css,.json}\"",
"test": "jest",
"test:cov": "jest --collect-coverage",
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
"test:debug:watch": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",
"watch": "tsc -b --watch"
},
"dependencies": {
"@jupyterlab/nbformat": "^3.0.0 || ^4.0.0-alpha.15",
"@lumino/coreutils": "^1.11.0 || ^2.0.0-alpha.6",
"@lumino/disposable": "^1.10.0 || ^2.0.0-alpha.6",
"@lumino/signaling": "^1.10.0 || ^2.0.0-alpha.6",
"y-protocols": "^1.0.5",
"yjs": "^13.5.40"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@types/jest": "^26.0.10",
"@typescript-eslint/eslint-plugin": "~5.28.0",
"@typescript-eslint/parser": "~5.28.0",
"eslint": "~8.17.0",
"eslint-config-prettier": "~8.5.0",
"eslint-plugin-jest": "~26.5.3",
"eslint-plugin-prettier": "~4.0.0",
"eslint-plugin-react": "~7.29.4",
"jest": "^26.4.2",
"prettier": "~2.6.0",
"rimraf": "~3.0.0",
"ts-jest": "^26.3.0",
"typescript": "~4.7.3"
},
"publishConfig": {
"access": "public"
}
}
Loading