summaryrefslogtreecommitdiff
path: root/src/tox/tox_env/installer.py
blob: f329ecf5014358b6123094d2023f39614b112ac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Generic, TypeVar

if TYPE_CHECKING:
    from tox.tox_env.api import ToxEnv

T = TypeVar("T", bound="ToxEnv")


class Installer(ABC, Generic[T]):
    def __init__(self, tox_env: T) -> None:
        self._env = tox_env
        self._register_config()

    @abstractmethod
    def _register_config(self) -> None:
        """Register configurations for the installer"""
        raise NotImplementedError

    @abstractmethod
    def installed(self) -> Any:
        """:returns: a list of packages installed (JSON dump-able)"""
        raise NotImplementedError

    @abstractmethod
    def install(self, arguments: Any, section: str, of_type: str) -> None:
        raise NotImplementedError