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

Pydantic V2 migration #16

Merged
merged 11 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
node-version: '20.x'
- run: npm install -g ajv-cli
- run: ajv validate -s schema.json -d "tests/fixtures/{docs/examples/viewconfs,test/{view-configs,view-configs-more}}/*.json"
- run: ajv validate --spec=draft2020 -s schema.json -d "tests/fixtures/{docs/examples/viewconfs,test/{view-configs,view-configs-more}}/*.json"

Test:
name: Test ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = { text = "MIT" }
readme = "README.md"
requires-python = ">=3.8"
dynamic = ["version"]
dependencies = ["pydantic>=1.10,<2.0", "rich>=13.0.0"]
dependencies = ["pydantic>=2.0", "rich>=13.0.0"]

[project.urls]
homepage = "https://github.com/higlass/higlass-schema"
Expand Down
6 changes: 4 additions & 2 deletions src/higlass_schema/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ def check(args: argparse.Namespace) -> None:
try:
if args.path == "-":
raw = "\n".join(sys.stdin.readlines())
Viewconf[View[Track]].parse_raw(raw)
Viewconf[View[Track]].model_validate_json(raw)
else:
Viewconf[View[Track]].parse_file(args.path)
with open(args.path) as file:
raw = file.read()
Viewconf[View[Track]].model_validate_json(raw)
console.print("✅ valid viewconf.", style="green")
except ValidationError:
msg = "❌ Invalid viewconf."
Expand Down
Loading