inputs: remove type info for info param

The `info` parameter for Input constructor is of type `PModuleInfo`,
which is located in `meta`. This in turn imports jsonschema. Ergo,
importing importing `inputs` will create a dependency on jsonschema.
At the same time the `osbuild` package globally imports `Pipeline`,
via `__init__.py`, and `osbuild.api` is used in the runners and
stages, which are run inside the buildroot. If one now wanted to
use `inputs` from `Pipeline`, it would lead to jsonschema being
imported (via `meta`) which might not be available on the build-
root and it is a rather random dependency to have.
On obvious solution would be to use a construct with `TYPE_CHECKING`,
a la:
  if TYPE_CHECKING:
    from .meta import ModuleInfo
Sadly, pylint will now complain about it. This could be fixed with:
  if TYPE_CHECKING:
    from .meta import ModuleInfo
  else:
    ModuleInfo = "osbuild.meta.ModuleInfo"
But this is just gross. So we will have to accept that Python is,
well, Python und omit the type information for the `info` param.
This commit is contained in:
Christian Kellner 2021-01-29 12:45:17 +00:00
parent ba7f6fe7c7
commit ad8baab819

View file

@ -25,7 +25,6 @@ import subprocess
from typing import Dict, Optional, Tuple
from .meta import ModuleInfo
from .objectstore import StoreServer
@ -34,7 +33,7 @@ class Input:
A single input with its corresponding options.
"""
def __init__(self, info: ModuleInfo, origin: str, options: Dict):
def __init__(self, info, origin: str, options: Dict):
self.info = info
self.origin = origin
self.refs = {}