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

Support pydantic 2 #213

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
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:
- '[email protected]'
- '@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
Loading
Loading