Skip to content

Commit

Permalink
build: Drop support for Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Oct 17, 2024
1 parent 329b3ff commit 4f5d6ec
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 1.5.1
_commit: 1.5.2
_src_path: gh:pawamoy/copier-uv
author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![ci](https://github.com/pawamoy/duty/workflows/ci/badge.svg)](https://github.com/pawamoy/duty/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/duty/)
[![pypi version](https://img.shields.io/pypi/v/duty.svg)](https://pypi.org/project/duty/)
[![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/duty)
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#duty:gitter.im)

A simple task runner.
Expand Down
8 changes: 2 additions & 6 deletions duties.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,8 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000


@duty
def docs_deploy(ctx: Context, *, force: bool = False) -> None:
"""Deploy the documentation to GitHub pages.
Parameters:
force: Whether to force deployment, even from non-Insiders version.
"""
def docs_deploy(ctx: Context) -> None:
"""Deploy the documentation to GitHub pages."""
os.environ["DEPLOY"] = "true"
with material_insiders() as insiders:
if not insiders:
Expand Down
6 changes: 5 additions & 1 deletion src/duty/callables/blacken_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

import re
from pathlib import Path
from typing import Pattern, Sequence
from re import Pattern
from typing import TYPE_CHECKING

from failprint.lazy import lazy

if TYPE_CHECKING:
from collections.abc import Sequence


@lazy(name="blacken_docs")
def run(
Expand Down
4 changes: 2 additions & 2 deletions src/duty/callables/ruff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import os
import subprocess
import sys
from functools import lru_cache
from functools import cache

from failprint.lazy import lazy


@lru_cache(maxsize=None)
@cache
def _find_ruff() -> str:
from ruff.__main__ import find_ruff_bin

Expand Down
5 changes: 4 additions & 1 deletion src/duty/callables/safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import importlib
import sys
from io import StringIO
from typing import Literal, Sequence, cast
from typing import TYPE_CHECKING, Literal, cast

from failprint.lazy import lazy

if TYPE_CHECKING:
from collections.abc import Sequence


@lazy(name="safety.check")
def check(
Expand Down
4 changes: 2 additions & 2 deletions src/duty/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import sys
from copy import deepcopy
from importlib import util as importlib_util
from typing import Any, Callable, ClassVar, List, Union
from typing import Any, Callable, ClassVar, Union

from duty.context import Context

DutyListType = List[Union[str, Callable, "Duty"]]
DutyListType = list[Union[str, Callable, "Duty"]]
default_duties_file = "duties.py"


Expand Down
7 changes: 5 additions & 2 deletions src/duty/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

import os
from contextlib import contextmanager, suppress
from typing import Any, Callable, Iterator, List, Union
from typing import TYPE_CHECKING, Any, Callable, Union

from failprint.runners import run as failprint_run

from duty.exceptions import DutyFailure
from duty.tools import Tool

CmdType = Union[str, List[str], Callable]
if TYPE_CHECKING:
from collections.abc import Iterator

CmdType = Union[str, list[str], Callable]


class Context:
Expand Down
4 changes: 3 additions & 1 deletion src/duty/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

import inspect
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, Iterable, overload
from typing import TYPE_CHECKING, Any, Callable, overload

from duty.collection import Duty, DutyListType

if TYPE_CHECKING:
from collections.abc import Iterable

from duty.context import Context


Expand Down
6 changes: 5 additions & 1 deletion src/duty/tools/_blacken_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

import re
from pathlib import Path
from typing import Pattern, Sequence
from re import Pattern
from typing import TYPE_CHECKING

from duty.tools._base import Tool

if TYPE_CHECKING:
from collections.abc import Sequence


class blacken_docs(Tool): # noqa: N801
"""Call [blacken-docs](https://github.com/adamchainz/blacken-docs)."""
Expand Down
4 changes: 2 additions & 2 deletions src/duty/tools/_ruff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import os
import subprocess
import sys
from functools import lru_cache
from functools import cache

from duty.tools._base import Tool


@lru_cache(maxsize=None)
@cache
def _find_ruff() -> str:
from ruff.__main__ import find_ruff_bin

Expand Down
5 changes: 4 additions & 1 deletion src/duty/tools/_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import importlib
import sys
from io import StringIO
from typing import Literal, Sequence, cast
from typing import TYPE_CHECKING, Literal, cast

from duty.tools._base import Tool

if TYPE_CHECKING:
from collections.abc import Sequence


class safety(Tool): # noqa: N801
"""Call [Safety](https://github.com/pyupio/safety)."""
Expand Down
7 changes: 5 additions & 2 deletions src/duty/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from contextlib import suppress
from functools import cached_property, partial
from inspect import Parameter, Signature, signature
from typing import Any, Callable, ForwardRef, Sequence, Union, get_args, get_origin
from typing import TYPE_CHECKING, Any, Callable, ForwardRef, Union, get_args, get_origin

# TODO: Update once support for Python 3.9 is dropped.
if TYPE_CHECKING:
from collections.abc import Sequence

# YORE: EOL 3.9: Replace block with lines 6-13.
if sys.version_info < (3, 10):
from eval_type_backport import eval_type_backport as eval_type

Expand Down

0 comments on commit 4f5d6ec

Please sign in to comment.