Skip to content

Commit

Permalink
Support pydantic 2 (#213)
Browse files Browse the repository at this point in the history
* Support pydantic 2

* Pin eslint in precommit

* Lint

* Bump galata
  • Loading branch information
trungleduc authored Nov 9, 2023
1 parent 0df40ae commit 12e6433
Show file tree
Hide file tree
Showing 11 changed files with 3,468 additions and 3,065 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
types: [file]
additional_dependencies:
- 'eslint@8.36.0'
- '@typescript-eslint/eslint-plugin'
- '@typescript-eslint/parser'
- 'eslint-plugin-prettier'
- 'eslint-config-prettier'
- '@typescript-eslint/eslint-plugin@5.55.0'
- '@typescript-eslint/parser@5.55.0'
- 'eslint-plugin-prettier@5.0.1'
- 'eslint-config-prettier@8.7.0'
1 change: 0 additions & 1 deletion jupytercad/notebook/cad_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ def _new_name(self, obj_type: str) -> str:
class PythonJcadObject(BaseModel):
class Config:
arbitrary_types_allowed = True
underscore_attrs_are_private = True
extra = Extra.allow

name: str
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"copy-webpack-plugin": "^10.0.0",
"eslint": "~8.36.0",
"eslint-config-prettier": "~8.7.0",
"eslint-plugin-prettier": "~4.2.1",
"eslint-plugin-prettier": "^5.0.0",
"lerna": "^6.6.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"prettier": "^3.0.0",
"rimraf": "^3.0.2",
"typescript": "^5",
"webpack": "^5.76.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/jupytercad-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"build": "jlpm build:schema && jlpm run build:lib && jlpm run build:worker && jlpm run build:labextension:dev",
"build:schema": "jlpm build:schema:js && jlpm build:schema:py",
"build:schema:js": "json2ts -i src/schema -o src/_interface --no-unknownAny --unreachableDefinitions --cwd ./src/schema && cd src/schema && node ../../schema.js",
"build:schema:py": "datamodel-codegen --input ./src/schema --output ../../jupytercad/notebook/objects/_schema",
"build:schema:py": "datamodel-codegen --input ./src/schema --output ../../jupytercad/notebook/objects/_schema --output-model-type pydantic_v2.BaseModel",
"build:prod": "jlpm run clean && jlpm build:schema && jlpm run build:worker:prod && jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
Expand Down
6 changes: 5 additions & 1 deletion packages/jupytercad-extension/src/sketcher/elements/point.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { IPoint, IPosition } from '../types';

export class Point implements IPoint {
constructor(x: number, y: number, public option?: { color: string }) {
constructor(
x: number,
y: number,
public option?: { color: string }
) {
this._x = x;
this._y = y;
}
Expand Down
5 changes: 4 additions & 1 deletion packages/jupytercad-extension/src/sketcher/panzoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { nearest } from '../tools';
import { IPosition } from './types';

export class PanZoom {
constructor(private ctx: CanvasRenderingContext2D, private gridSize: number) {
constructor(
private ctx: CanvasRenderingContext2D,
private gridSize: number
) {
this.x = 0;
this.y = 0;
this.scale = 1;
Expand Down
4 changes: 3 additions & 1 deletion packages/jupytercad-extension/style/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
height: 6em;
border-radius: 50%;
position: relative;
animation: load3 1s infinite linear, fadeIn 1s;
animation:
load3 1s infinite linear,
fadeIn 1s;
}

.jpcad-SpinnerContent:before {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies = [
"ypywidgets>=0.4.1,<0.5.0",
"yjs-widgets>=0.3.4,<0.4",
"comm>=0.1.2,<0.2.0",
"pydantic",
"pydantic>=2,<3",
]
classifiers = [
"License :: OSI Approved :: BSD License",
Expand Down
2 changes: 1 addition & 1 deletion ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"test:debug": "PWDEBUG=1 npx playwright test"
},
"devDependencies": {
"@jupyterlab/galata": "^5.0.1",
"@jupyterlab/galata": "^5.0.8",
"@playwright/test": "^1.32.0",
"@types/klaw-sync": "^6.0.1"
},
Expand Down
Loading

0 comments on commit 12e6433

Please sign in to comment.