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

[1.2.x] Ignore check-wheel-contents W002 duplciate files error, add pydantic_v1 module, add pytest-cov dependency #507

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
Expand All @@ -16,25 +16,25 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 22.10.0
rev: 24.4.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
files: \.py$

- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -46,7 +46,7 @@ repos:
stages: [manual]

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.19.2
rev: 0.28.2
hooks:
- id: check-jsonschema
name: "Check GitHub Workflows"
Expand Down
1 change: 1 addition & 0 deletions jupyter_scheduler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Scheduling API for JupyterLab"""

import json
from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion jupyter_scheduler/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from jupyter_server.base.handlers import APIHandler
from jupyter_server.extension.handler import ExtensionHandlerMixin
from jupyter_server.utils import ensure_async
from pydantic import ValidationError
from tornado.web import HTTPError, authenticated

from jupyter_scheduler.environments import EnvironmentRetrievalError
Expand All @@ -28,6 +27,7 @@
UpdateJob,
UpdateJobDefinition,
)
from jupyter_scheduler.pydantic_v1 import ValidationError


class JobHandlersMixin:
Expand Down
2 changes: 1 addition & 1 deletion jupyter_scheduler/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from enum import Enum
from typing import Dict, List, Optional, Union

from pydantic import BaseModel, root_validator
from jupyter_scheduler.pydantic_v1 import BaseModel, root_validator

Tags = List[str]
EnvironmentParameterValues = Union[int, float, bool, str]
Expand Down
8 changes: 8 additions & 0 deletions jupyter_scheduler/pydantic_v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from importlib import metadata

# expose Pydantic v1 API, regardless of Pydantic version in current env

try:
from pydantic.v1 import *
except ImportError:
from pydantic import *
4 changes: 4 additions & 0 deletions jupyter_scheduler/pydantic_v1/dataclasses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from pydantic.v1.dataclasses import *
except ImportError:
from pydantic.dataclasses import *
4 changes: 4 additions & 0 deletions jupyter_scheduler/pydantic_v1/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
from pydantic.v1.main import *
except ImportError:
from pydantic.main import *
2 changes: 1 addition & 1 deletion jupyter_scheduler/task_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

import traitlets
from jupyter_server.transutils import _i18n
from pydantic import BaseModel
from sqlalchemy import Boolean, Column, Integer, String, create_engine
from sqlalchemy.orm import sessionmaker
from traitlets.config import LoggingConfigurable

from jupyter_scheduler.models import CreateJob, UpdateJobDefinition
from jupyter_scheduler.orm import JobDefinition, declarative_base
from jupyter_scheduler.pydantic_v1 import BaseModel
from jupyter_scheduler.utils import (
compute_next_run_time,
get_localized_timestamp,
Expand Down
2 changes: 1 addition & 1 deletion jupyter_scheduler/tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch

import pytest
from pydantic import ValidationError
from tornado.httpclient import HTTPClientError

from jupyter_scheduler.exceptions import (
Expand All @@ -21,6 +20,7 @@
Status,
UpdateJob,
)
from jupyter_scheduler.pydantic_v1 import ValidationError
from jupyter_scheduler.tests.utils import expected_http_error


Expand Down
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = [
"jupyter_server>=1.6,<3",
"traitlets",
"nbconvert",
"pydantic",
"pydantic>=1.10,<3",
"sqlalchemy<2",
"croniter",
"pytz",
Expand All @@ -43,6 +43,7 @@ dependencies = [
[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
"jupyter_server[test]>=1.6,<3"
]
dev = [
Expand All @@ -57,6 +58,9 @@ docs = [
[project.urls]
Homepage = "https://github.com/jupyter-server/jupyter-scheduler"

[tool.check-wheel-contents]
ignore = ["W002"]

[tool.hatch.build]
artifacts = ["jupyter_scheduler/labextension"]

Expand Down
1 change: 1 addition & 0 deletions ui-tests/jupyter_server_test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
opens the server to the world and provide access to JupyterLab
JavaScript objects through the global window variable.
"""

from tempfile import mkdtemp

c.ServerApp.port = 8888
Expand Down
Loading