Skip to content
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
10 changes: 5 additions & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ jobs:
fail-fast: false # need to see which ones fail
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.7", "3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10"]
# this is to make the CI run on different sklearn versions
include:
- python: "3.7"
sklearn_version: "0.24.0"
- python: "3.8"
sklearn_version: "1.0.0"
sklearn_version: "1.0"
# TODO: add sklearn 1.1 when we add 3.11 support
- python: "3.9"
sklearn_version: "1.1.0"
sklearn_version: "1.2"
- python: "3.10"
sklearn_version: "nightly"


# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 15

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 88
target_version = ['py37', 'py38', 'py39', 'py310']
target_version = ['py38', 'py39', 'py310', 'py311']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_version = ['py38', 'py39', 'py310', 'py311']
target_version = ['py38', 'py39', 'py310']

Not sure if it hurts to have it there. If not, just ignore.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do code in py311, so I think this is better to stay.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear to me what this option really does. Is it only relevant when a new Python version changes syntax? Anyway, I'm fine with keeping it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in, the output should be valid in all these python versions, I think.

preview = true

[tool.isort]
Expand All @@ -17,6 +17,8 @@ filterwarnings = [
"ignore:The \\'sym_pos\\' keyword is deprecated and should be replaced:DeprecationWarning",
# https://github.com/scikit-learn/scikit-learn/pull/23633
"ignore:Unlike other reduction functions:FutureWarning",
# https://github.com/scikit-learn/scikit-learn/pull/25157
"ignore:\\w+ is deprecated. Use files\\(\\) instead:DeprecationWarning"
]
markers = [
"network: marks tests as requiring internet (deselect with '-m \"not network\"')",
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# This is a bit (!) hackish: we are setting a global variable so that the
# main modelcard __init__ can detect if it is being loaded by the setup
# routine, to avoid attempting to load components.
builtins.__SKOPS_SETUP__ = True
builtins.__SKOPS_SETUP__ = True # type: ignore


import skops # noqa
Expand Down Expand Up @@ -58,13 +58,12 @@ def setup_package():
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
],
python_requires=">=3.7",
python_requires=">=3.8",
install_requires=min_deps.tag_to_packages["install"],
extras_require={
"docs": min_deps.tag_to_packages["docs"],
Expand Down
1 change: 0 additions & 1 deletion skops/_min_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"sphinx-issues": ("1.2.0", "docs", None),
"matplotlib": ("3.3", "docs, tests", None),
"pandas": ("1", "docs, tests", None),
"typing_extensions": ("3.7", "install", "python_full_version < '3.8'"),
# required for persistence tests of external libraries
"lightgbm": ("3", "tests", None),
"xgboost": ("1.6", "tests", None),
Expand Down
4 changes: 1 addition & 3 deletions skops/hub_utils/_hf_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import os
import shutil
from pathlib import Path
from typing import Any, List, MutableMapping, Optional, Union
from typing import Any, List, Literal, MutableMapping, Optional, Union

import numpy as np
from huggingface_hub import HfApi, InferenceApi, snapshot_download

from ..utils.fixes import Literal

SUPPORTED_TASKS = [
"tabular-classification",
"tabular-regression",
Expand Down
12 changes: 6 additions & 6 deletions skops/hub_utils/tests/test_hf_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shutil
import tempfile
import warnings
from importlib import metadata
from pathlib import Path
from uuid import uuid4

Expand Down Expand Up @@ -37,7 +38,6 @@
)
from skops.hub_utils.tests.common import HF_HUB_TOKEN
from skops.io import dump
from skops.utils.fixes import metadata, path_unlink

iris = load_iris(as_frame=True, return_X_y=False)
diabetes = load_diabetes(as_frame=True, return_X_y=False)
Expand Down Expand Up @@ -91,7 +91,7 @@ def classifier(repo_path, config_json):
dump(clf, path)
yield path
finally:
path_unlink(path, missing_ok=True)
path.unlink(missing_ok=True)


CONFIG = {
Expand All @@ -118,7 +118,7 @@ def config_json(repo_path, request):
json.dump(CONFIG[request.param], f)
yield path, request.param
finally:
path_unlink(path, missing_ok=True)
path.unlink(missing_ok=True)


def test_validate_format(classifier):
Expand Down Expand Up @@ -337,7 +337,7 @@ def test_model_file_does_not_exist_raises(repo_path, config_json):
task="tabular-classification",
data=iris.data,
)
path_unlink(model_path, missing_ok=True)
model_path.unlink(missing_ok=True)


def test_init_empty_model_file_errors(repo_path, config_json):
Expand All @@ -360,7 +360,7 @@ def test_init_empty_model_file_errors(repo_path, config_json):
task="tabular-classification",
data=iris.data,
)
path_unlink(model_path, missing_ok=True)
model_path.unlink(missing_ok=True)


@pytest.mark.network
Expand Down Expand Up @@ -501,7 +501,7 @@ def test_inference(

# cleanup
client.delete_repo(repo_id=repo_id, token=HF_HUB_TOKEN)
path_unlink(model_path, missing_ok=True)
model_path.unlink(missing_ok=True)

assert np.allclose(output, y_pred)

Expand Down
3 changes: 1 addition & 2 deletions skops/io/_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

import io
from contextlib import contextmanager
from typing import Any, Generator, Sequence, Type, Union
from typing import Any, Generator, Literal, Sequence, Type, Union

from ..utils.fixes import Literal
from ._trusted_types import PRIMITIVE_TYPE_NAMES
from ._utils import LoadContext, get_module, get_type_paths
from .exceptions import UntrustedTypesFoundException
Expand Down
57 changes: 0 additions & 57 deletions skops/utils/fixes.py

This file was deleted.

40 changes: 0 additions & 40 deletions skops/utils/tests/test_fixes.py

This file was deleted.