pyproject.toml: Enforce import annotations style

Add new ruff rules and fix their fallout:

  future-annotations = true

   select = [
    "TC",  # type-checking import placement rules
    "FA",  # future annotations rules
   ]

This comprises:

  - Streamline imports and exports in cmds.xxx.Cmd

    - Import base class as "Base"

    - Export types Cmd and Parent via __all__

  - Move all types imported only for annotation below TYPE_CHECKING

  - Use "from __future__ import annotations" all over the place

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-06-01 10:04:38 +02:00
commit 5d1ba6e15a
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
77 changed files with 382 additions and 196 deletions

View file

@ -1,19 +1,19 @@
from __future__ import annotations
from argparse import ArgumentParser
from functools import cached_property
from typing import TYPE_CHECKING
from ...CmdBase import CmdBase
from ...CmdBase import CmdBase as Base
from ..CmdSecrets import CmdSecrets as Parent
if TYPE_CHECKING:
from typing import Iterable
from .lib.base import Attrs
from .lib.DistroContext import DistroContext
class Cmd(CmdBase): # export
if TYPE_CHECKING:
from argparse import ArgumentParser
from typing import Iterable
from .lib.base import Attrs
class Cmd(Base): # export
@cached_property
def ctx(self) -> DistroContext:
@ -49,3 +49,5 @@ class Cmd(CmdBase): # export
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
parser.add_argument('packages', nargs = '*', help = 'Package names')
__all__ = ['Parent', 'Cmd']