Skip to content

Commit 9ab3687

Browse files
andrii-ipre-commit-ci[bot]JasonWeilldlqqq
authored
[1.2.x] Ignore check-wheel-contents W002 duplciate files error, add pydantic_v1 module, add pytest-cov dependency (#507)
* ignore check-wheel-contents "W002" error during release as is done in main (#488) * update pre-commit * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Pydantic v1 and v2 compatibility, add `pydantic_v1` module (#463) * Custom module to allow Pydantic v1 and v2 compatibility * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update jupyter_scheduler/pydantic_v1/__init__.py Co-authored-by: david qiu <[email protected]> * Removes unneeded logic * Adds dataclasses.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: david qiu <[email protected]> * add pytest-cov optional dependency --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jason Weill <[email protected]> Co-authored-by: david qiu <[email protected]>
1 parent d428ac8 commit 9ab3687

File tree

11 files changed

+33
-11
lines changed

11 files changed

+33
-11
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v4.6.0
44
hooks:
55
- id: end-of-file-fixer
66
- id: check-case-conflict
@@ -16,25 +16,25 @@ repos:
1616
- id: trailing-whitespace
1717

1818
- repo: https://github.com/psf/black
19-
rev: 22.10.0
19+
rev: 24.4.0
2020
hooks:
2121
- id: black
2222

2323
- repo: https://github.com/PyCQA/isort
24-
rev: 5.10.1
24+
rev: 5.13.2
2525
hooks:
2626
- id: isort
2727
args: ["--profile", "black"]
2828
files: \.py$
2929

3030
- repo: https://github.com/asottile/pyupgrade
31-
rev: v3.2.2
31+
rev: v3.15.2
3232
hooks:
3333
- id: pyupgrade
3434
args: [--py37-plus]
3535

3636
- repo: https://github.com/pycqa/flake8
37-
rev: 6.0.0
37+
rev: 7.0.0
3838
hooks:
3939
- id: flake8
4040
additional_dependencies:
@@ -46,7 +46,7 @@ repos:
4646
stages: [manual]
4747

4848
- repo: https://github.com/sirosen/check-jsonschema
49-
rev: 0.19.2
49+
rev: 0.28.2
5050
hooks:
5151
- id: check-jsonschema
5252
name: "Check GitHub Workflows"

jupyter_scheduler/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Scheduling API for JupyterLab"""
2+
23
import json
34
from pathlib import Path
45

jupyter_scheduler/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from jupyter_server.base.handlers import APIHandler
55
from jupyter_server.extension.handler import ExtensionHandlerMixin
66
from jupyter_server.utils import ensure_async
7-
from pydantic import ValidationError
87
from tornado.web import HTTPError, authenticated
98

109
from jupyter_scheduler.environments import EnvironmentRetrievalError
@@ -28,6 +27,7 @@
2827
UpdateJob,
2928
UpdateJobDefinition,
3029
)
30+
from jupyter_scheduler.pydantic_v1 import ValidationError
3131

3232

3333
class JobHandlersMixin:

jupyter_scheduler/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from enum import Enum
33
from typing import Dict, List, Optional, Union
44

5-
from pydantic import BaseModel, root_validator
5+
from jupyter_scheduler.pydantic_v1 import BaseModel, root_validator
66

77
Tags = List[str]
88
EnvironmentParameterValues = Union[int, float, bool, str]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from importlib import metadata
2+
3+
# expose Pydantic v1 API, regardless of Pydantic version in current env
4+
5+
try:
6+
from pydantic.v1 import *
7+
except ImportError:
8+
from pydantic import *
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
try:
2+
from pydantic.v1.dataclasses import *
3+
except ImportError:
4+
from pydantic.dataclasses import *
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
try:
2+
from pydantic.v1.main import *
3+
except ImportError:
4+
from pydantic.main import *

jupyter_scheduler/task_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
import traitlets
88
from jupyter_server.transutils import _i18n
9-
from pydantic import BaseModel
109
from sqlalchemy import Boolean, Column, Integer, String, create_engine
1110
from sqlalchemy.orm import sessionmaker
1211
from traitlets.config import LoggingConfigurable
1312

1413
from jupyter_scheduler.models import CreateJob, UpdateJobDefinition
1514
from jupyter_scheduler.orm import JobDefinition, declarative_base
15+
from jupyter_scheduler.pydantic_v1 import BaseModel
1616
from jupyter_scheduler.utils import (
1717
compute_next_run_time,
1818
get_localized_timestamp,

jupyter_scheduler/tests/test_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from unittest.mock import patch
33

44
import pytest
5-
from pydantic import ValidationError
65
from tornado.httpclient import HTTPClientError
76

87
from jupyter_scheduler.exceptions import (
@@ -21,6 +20,7 @@
2120
Status,
2221
UpdateJob,
2322
)
23+
from jupyter_scheduler.pydantic_v1 import ValidationError
2424
from jupyter_scheduler.tests.utils import expected_http_error
2525

2626

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies = [
3131
"jupyter_server>=1.6,<3",
3232
"traitlets",
3333
"nbconvert",
34-
"pydantic",
34+
"pydantic>=1.10,<3",
3535
"sqlalchemy<2",
3636
"croniter",
3737
"pytz",
@@ -43,6 +43,7 @@ dependencies = [
4343
[project.optional-dependencies]
4444
test = [
4545
"pytest",
46+
"pytest-cov",
4647
"jupyter_server[test]>=1.6,<3"
4748
]
4849
dev = [
@@ -57,6 +58,9 @@ docs = [
5758
[project.urls]
5859
Homepage = "https://github.com/jupyter-server/jupyter-scheduler"
5960

61+
[tool.check-wheel-contents]
62+
ignore = ["W002"]
63+
6064
[tool.hatch.build]
6165
artifacts = ["jupyter_scheduler/labextension"]
6266

0 commit comments

Comments
 (0)