Skip to content
Open
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
43 changes: 7 additions & 36 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,19 @@ repos:
- id: name-tests-test
args: ["--django"]

- repo: https://github.com/pycqa/isort
rev: 8.0.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.1
hooks:
- id: isort
name: isort

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.3.1
hooks:
- id: black
language_version: python3
- id: ruff-format
- id: ruff-check
args: [--fix]

- repo: https://github.com/asottile/blacken-docs
rev: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
exclude: docs/source/conf.py, __pycache__
additional_dependencies:
[
flake8-bugbear,
flake8-builtins,
flake8-quotes>=3.3.2,
flake8-comprehensions,
pandas-vet,
flake8-print,
pep8-naming,
doc8,
]

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0
hooks:
Expand All @@ -62,15 +40,8 @@ repos:
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.1
hooks:
- id: nbqa-isort
args: [--nbqa-mutate, --nbqa-dont-skip-bad-cells]
additional_dependencies: [isort==5.6.4]
- id: nbqa-black
args: [--nbqa-mutate, --nbqa-dont-skip-bad-cells]
additional_dependencies: [black>=22.3.0]
- id: nbqa-flake8
args: [--nbqa-dont-skip-bad-cells, "--extend-ignore=E402,E203"]
additional_dependencies: [flake8==3.8.3]
- id: nbqa-ruff
args: [--nbqa-mutate]

- repo: https://github.com/PyCQA/bandit
rev: 1.9.4
Expand Down
3 changes: 1 addition & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# copyright: skbase developers, BSD-3-Clause License (see LICENSE file)
"""Configure skbase Sphinx documentation."""

Expand Down Expand Up @@ -298,7 +297,7 @@ def find_source():

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://docs.python.org/{.major}".format(sys.version_info), None),
"python": (f"https://docs.python.org/{sys.version_info.major}", None),
"scikit-learn": ("https://scikit-learn.org/stable/", None),
"sktime": ("https://www.sktime.net/en/stable/", None),
}
94 changes: 74 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,9 @@ dev = [

linters = [
"mypy",
"isort",
"flake8",
"black",
"ruff",
"pydocstyle",
"nbqa",
"flake8-bugbear",
"flake8-builtins",
"flake8-quotes",
"flake8-comprehensions",
"pandas-vet",
"flake8-print",
"pep8-naming",
"doc8",
]

Expand Down Expand Up @@ -112,16 +103,6 @@ addopts = [
"--cov-report=html",
]

[tool.isort]
profile = "black"
src_paths = ["skbase/*"]
multi_line_output = 3
known_first_party = ["skbase"]

[tool.black]
line-length = 88
extend-exclude = "^/setup.py docs/conf.py"

[tool.pydocstyle]
convention = "numpy"

Expand All @@ -137,6 +118,79 @@ max-line-length = 88
ignore = ["D004"]
ignore_path = ["docs/_build", "docs/source/api_reference/auto_generated"]

[tool.ruff]
line-length = 88
extend-exclude = ["setup.py", "docs/source/conf.py"]
target-version = "py310"
extend-include = ["*.ipynb"]

[tool.ruff.lint]
select = [
"D", # pydocstyle
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"PIE", # flake8-pie
"T20", # flake8-print
"RET", # flake8-return
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"RUF", # Ruff-specific rules
]
ignore = [
"E203", # Whitespace before punctuation
"E402", # Module import not at top of file
"E501", # Line too long
"E731", # Do not assign a lambda expression, use a def
"RET504", # Unnecessary variable assignment before `return` statement
"S101", # Use of `assert` detected
"C408", # Unnecessary dict call - rewrite as a literal
"UP031", # Use format specifier instead of %
"UP009", # UTF-8 encoding declaration is unnecessary
"S102", # Use of exec
"C414", # Unnecessary `list` call within `sorted()`
"S301", # pickle and modules that wrap it can be unsafe
"C416", # Unnecessary list comprehension - rewrite as a generator
"S310", # Audit URL open for permitted schemes
"S202", # Uses of `tarfile.extractall()`
"S307", # Use of possibly insecure function
"C417", # Unnecessary `map` usage (rewrite using a generator expression)
"S605", # Starting a process with a shell, possible injection detected
"E741", # Ambiguous variable name
"S107", # Possible hardcoded password
"S105", # Possible hardcoded password
"PT018", # Checks for assertions that combine multiple independent condition
"S602", # sub process call with shell=True unsafe
"C419", # Unnecessary list comprehension, some are flagged yet are not
"C409", # Unnecessary `list` literal passed to `tuple()` (rewrite as a `tuple` literal)
"S113", # Probable use of httpx call without timeout
]
allowed-confusables = ["σ"]

[tool.ruff.lint.per-file-ignores]
"setup.py" = ["S101"]
"**/__init__.py" = [
"F401", # unused import
]
"**/tests/**" = [
"D", # docstring
"S605", # Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
"S607", # Starting a process with a partial executable path
"RET504", # Unnecessary variable assignment before `return` statement
"PT004", # Fixture `tmpdir_unittest_fixture` does not return anything, add leading underscore
"PT011", # `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
"PT012", # `pytest.raises()` block should contain a single simple statement
"PT019", # Fixture `_` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.bandit]
exclude_dirs = ["*/tests/*", "*/testing/*"]

Expand Down
10 changes: 4 additions & 6 deletions skbase/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@
# conditions see https://github.com/scikit-learn/scikit-learn/blob/main/COPYING
"""Custom exceptions used in ``skbase``."""

from typing import List

__author__: List[str] = ["fkiraly", "mloning", "rnkuhns"]
__all__: List[str] = ["FixtureGenerationError", "NotFittedError"]
__author__: list[str] = ["fkiraly", "mloning", "rnkuhns"]
__all__: list[str] = ["FixtureGenerationError", "NotFittedError"]


class FixtureGenerationError(Exception):
"""Raised when a fixture fails to generate."""

def __init__(self, fixture_name="", err=None): # noqa: B042
def __init__(self, fixture_name="", err=None):
self.fixture_name = fixture_name
self.err = err
msg = f"fixture {fixture_name} failed to generate. {err}"
super().__init__(msg) # noqa: B042
super().__init__(msg)


class NotFittedError(ValueError, AttributeError):
Expand Down
10 changes: 4 additions & 6 deletions skbase/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
sktime design principles in your project.
"""

from typing import List

from skbase.base._base import BaseEstimator, BaseObject
from skbase.base._meta import (
BaseMetaEstimator,
Expand All @@ -17,12 +15,12 @@
BaseMetaObjectMixin,
)

__author__: List[str] = ["mloning", "RNKuhns", "fkiraly"]
__all__: List[str] = [
"BaseObject",
__author__: list[str] = ["mloning", "RNKuhns", "fkiraly"]
__all__: list[str] = [
"BaseEstimator",
"BaseMetaEstimator",
"BaseMetaObject",
"BaseMetaEstimatorMixin",
"BaseMetaObject",
"BaseMetaObjectMixin",
"BaseObject",
]
Loading
Loading