Skip to content

Commit dcddc2f

Browse files
committed
Produce py.typed and reexports for mypy
1 parent 3f80df2 commit dcddc2f

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

src/styx/backend/python/languageprovider.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ def _not_is_instance(pytype: str):
10151015
*_assert_dict(get_param_or_die),
10161016
*_assert_tagged(get_param_or_die),
10171017
*_check_error(
1018-
f"{get_param_or_die}[\"@type\"] not in {self.expr_literal(valid_tags)}",
1018+
f'{get_param_or_die}["@type"] not in {self.expr_literal(valid_tags)}',
10191019
f"Parameter `{p.base.name}`s `@type` must be one of {self.expr_literal(valid_tags)}",
10201020
),
10211021
expr_validate,
@@ -1154,11 +1154,19 @@ def _get_checked(store: dict[str, typing.Any], key: str, type_: type[_T]) -> _T
11541154
path=python_package_path_src / f"{project.name}_{package.name}" / package_symbol / "__init__.py",
11551155
content=collapse(self.generate_module(package_module)),
11561156
)
1157+
yield TextFile(
1158+
path=python_package_path_src / f"{project.name}_{package.name}" / "py.typed",
1159+
content="",
1160+
)
11571161

11581162
yield TextFile(
11591163
path=pathlib.Path(project.name) / f"src/{project.name}/__init__.py",
11601164
content=template_root_init_py(project, package_names),
11611165
)
1166+
yield TextFile(
1167+
path=pathlib.Path(project.name) / f"src/{project.name}/py.typed",
1168+
content="",
1169+
)
11621170

11631171
yield TextFile(
11641172
path=pathlib.Path(project.name) / f"pyproject.toml",

src/styx/backend/python/templates.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,22 @@ def template_root_init_py(project: ir.Project, package_names: list[str]) -> str:
7878
])
7979

8080
return f'''{reexports}
81-
from styxdefs import * # Reexport styxdefs
82-
from styxdocker import DockerRunner
83-
from styxsingularity import SingularityRunner
84-
from styxgraph import GraphRunner
81+
from styxdefs import (
82+
Execution as Execution,
83+
InputPathType as InputPathType,
84+
Metadata as Metadata,
85+
OutputPathType as OutputPathType,
86+
Runner as Runner,
87+
LocalRunner as LocalRunner,
88+
DryRunner as DryRunner,
89+
get_global_runner as get_global_runner,
90+
set_global_runner as set_global_runner,
91+
StyxRuntimeError as StyxRuntimeError,
92+
StyxValidationError as StyxValidationError,
93+
)
94+
from styxdocker import DockerRunner as DockerRunner
95+
from styxsingularity import SingularityRunner as SingularityRunner
96+
from styxgraph import GraphRunner as GraphRunner
8597
8698
8799
def use_local(*args, **kwargs):

0 commit comments

Comments
 (0)