Skip to content
Myr

👷 Add `ty` to the CI `lint` check (#1477)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sofie Van Landeghem · committed by GitHub · parent 6efefca · Browse files · 6 files+43 added−20 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+43 added−20 removed

  • other:+43 added−20 removed

6 files+43 added−20 removed

modified:scripts/lint.sh+1 added
modified:typer/_completion_classes.py+4 added-4 removed
44 unmodified lines
45 "prog_name": self.prog_name,46 }4748 def get_completion_args(self) -> tuple[list[str], str]:49 cwords = click_split_arg_string(os.environ["COMP_WORDS"])49 cwords = click_split_arg_string(os.environ["COMP_WORDS"]) # ty: ignore[call-non-callable]50 cword = int(os.environ["COMP_CWORD"])51 args = cwords[1:cword]5253 try:
28 unmodified lines
82 }8384 def get_completion_args(self) -> tuple[list[str], str]:85 completion_args = os.getenv("_TYPER_COMPLETE_ARGS", "")86 cwords = click_split_arg_string(completion_args)86 cwords = click_split_arg_string(completion_args) # ty: ignore[call-non-callable]87 args = cwords[1:]88 if args and not completion_args.endswith(" "):89 incomplete = args[-1]90 args = args[:-1]
42 unmodified lines
133 }134135 def get_completion_args(self) -> tuple[list[str], str]:136 completion_args = os.getenv("_TYPER_COMPLETE_ARGS", "")137 cwords = click_split_arg_string(completion_args)137 cwords = click_split_arg_string(completion_args) # ty: ignore[call-non-callable]138 args = cwords[1:]139 if args and not completion_args.endswith(" "):140 incomplete = args[-1]141 args = args[:-1]
45 unmodified lines
187188 def get_completion_args(self) -> tuple[list[str], str]:189 completion_args = os.getenv("_TYPER_COMPLETE_ARGS", "")190 incomplete = os.getenv("_TYPER_COMPLETE_WORD_TO_COMPLETE", "")191 cwords = click_split_arg_string(completion_args)191 cwords = click_split_arg_string(completion_args) # ty: ignore[call-non-callable]192 args = cwords[1:-1] if incomplete else cwords[1:]193 return args, incomplete194195 def format_completion(self, item: click.shell_completion.CompletionItem) -> str:
11 unmodified lines
modified:typer/cli.py+2 added-2 removed
55 unmodified lines
56 def list_commands(self, ctx: click.Context) -> list[str]:57 self.maybe_add_run(ctx)58 return super().list_commands(ctx)5960 def get_command(self, ctx: click.Context, name: str) -> Optional[Command]:60 def get_command(self, ctx: click.Context, name: str) -> Optional[Command]: # ty: ignore[invalid-method-override]61 self.maybe_add_run(ctx)62 return super().get_command(ctx, name)6364 def invoke(self, ctx: click.Context) -> Any:
65 unmodified lines
130 typer.echo(f"Could not import as Python file: {state.file}", err=True)131 else:132 typer.echo(f"Could not import as Python module: {state.module}", err=True)133 sys.exit(1)134 module = importlib.util.module_from_spec(spec)134 module = importlib.util.module_from_spec(spec) # ty: ignore[invalid-argument-type]135 spec.loader.exec_module(module) # type: ignore136 obj = get_typer_from_module(module)137 return obj138
179 unmodified lines
modified:typer/main.py+6 added-14 removed
70 unmodified lines
71 ):72 _original_except_hook(exc_type, exc_value, tb)73 return74 typer_path = os.path.dirname(__file__)75 click_path = os.path.dirname(click.__file__)75 click_path = os.path.dirname(click.__file__) # ty: ignore[no-matching-overload]76 internal_dir_names = [typer_path, click_path]77 exc = exc_value78 if HAS_RICH:79 from . import rich_utils
314 unmodified lines
394 # Priority 1: Explicit value was set in app.add_typer()395 if not isinstance(typer_info.help, DefaultPlaceholder):396 return inspect.cleandoc(typer_info.help or "")397 # Priority 2: Explicit value was set in sub_app.callback()398 try:398 if typer_info.typer_instance and typer_info.typer_instance.registered_callback:399 callback_help = typer_info.typer_instance.registered_callback.help400 if not isinstance(callback_help, DefaultPlaceholder):401 return inspect.cleandoc(callback_help or "")402 except AttributeError:403 pass402 # Priority 3: Explicit value was set in sub_app = typer.Typer()405 try:403 if typer_info.typer_instance and typer_info.typer_instance.info:404 instance_help = typer_info.typer_instance.info.help405 if not isinstance(instance_help, DefaultPlaceholder):406 return inspect.cleandoc(instance_help or "")409 except AttributeError:410 pass407 # Priority 4: Implicit inference from callback docstring in app.add_typer()408 if typer_info.callback:409 doc = inspect.getdoc(typer_info.callback)410 if doc:411 return doc412 # Priority 5: Implicit inference from callback docstring in @app.callback()417 try:413 if typer_info.typer_instance and typer_info.typer_instance.registered_callback:414 callback = typer_info.typer_instance.registered_callback.callback415 if not isinstance(callback, DefaultPlaceholder):416 doc = inspect.getdoc(callback or "")417 if doc:418 return doc423 except AttributeError:424 pass419 # Priority 6: Implicit inference from callback docstring in typer.Typer()426 try:420 if typer_info.typer_instance and typer_info.typer_instance.info:421 instance_callback = typer_info.typer_instance.info.callback422 if not isinstance(instance_callback, DefaultPlaceholder):423 doc = inspect.getdoc(instance_callback)424 if doc:425 return doc432 except AttributeError:433 pass426 # Value not set, use the default427 return typer_info.help.value428429
139 unmodified lines
569 pretty_exceptions_short: bool,570 rich_markup_mode: MarkupMode,571) -> click.Command:572 assert command_info.callback, "A command must have a callback function"581 name = command_info.name or get_command_name(command_info.callback.__name__)573 name = command_info.name or get_command_name(command_info.callback.__name__) # ty: ignore[possibly-missing-attribute]574 use_help = command_info.help575 if use_help is None:576 use_help = inspect.getdoc(command_info.callback)577 else:
572 unmodified lines
modified:pyproject.toml+1 added
78 unmodified lines
79]80tests = [81 "coverage[toml]>=6.2,<8.0",82 "mypy==1.19.1",83 "ty==0.0.9",84 "pytest>=4.4.0,<9.0.0",85 "pytest-cov>=2.10.0,<8.0.0",86 "pytest-sugar>=0.9.4,<1.2.0",87 "pytest-xdist>=1.32.0,<4.0.0",
171 unmodified lines
modified:uv.lock+29 added
2221 unmodified lines
2222 { url = "https://files.pythonhosted.org/packages/77/b8/0135fadc89e73be292b473cb820b4f5a08197779206b33191e801feeae40/tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b", size = 14408, upload-time = "2025-10-08T22:01:46.04Z" },2223]22242225[[package]]2226name = "ty"2227version = "0.0.9"2228source = { registry = "https://pypi.org/simple" }2229sdist = { url = "https://files.pythonhosted.org/packages/19/7b/4f677c622d58563c593c32081f8a8572afd90e43dc15b0dedd27b4305038/ty-0.0.9.tar.gz", hash = "sha256:83f980c46df17586953ab3060542915827b43c4748a59eea04190c59162957fe", size = 4858642, upload-time = "2026-01-05T12:24:56.528Z" }2230wheels = [2231 { url = "https://files.pythonhosted.org/packages/3f/3f/c1ee119738b401a8081ff84341781122296b66982e5982e6f162d946a1ff/ty-0.0.9-py3-none-linux_armv6l.whl", hash = "sha256:dd270d4dd6ebeb0abb37aee96cbf9618610723677f500fec1ba58f35bfa8337d", size = 9763596, upload-time = "2026-01-05T12:24:37.43Z" },2232 { url = "https://files.pythonhosted.org/packages/63/41/6b0669ef4cd806d4bd5c30263e6b732a362278abac1bc3a363a316cde896/ty-0.0.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:debfb2ba418b00e86ffd5403cb666b3f04e16853f070439517dd1eaaeeff9255", size = 9591514, upload-time = "2026-01-05T12:24:26.891Z" },2233 { url = "https://files.pythonhosted.org/packages/02/a1/874aa756aee5118e690340a771fb9ded0d0c2168c0b7cc7d9561c2a750b0/ty-0.0.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:107c76ebb05a13cdb669172956421f7ffd289ad98f36d42a44a465588d434d58", size = 9097773, upload-time = "2026-01-05T12:24:14.442Z" },2234 { url = "https://files.pythonhosted.org/packages/32/62/cb9a460cf03baab77b3361d13106b93b40c98e274d07c55f333ce3c716f6/ty-0.0.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6868ca5c87ca0caa1b3cb84603c767356242b0659b88307eda69b2fb0bfa416b", size = 9581824, upload-time = "2026-01-05T12:24:35.074Z" },2235 { url = "https://files.pythonhosted.org/packages/5a/97/633ecb348c75c954f09f8913669de8c440b13b43ea7d214503f3f1c4bb60/ty-0.0.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d14a4aa0eb5c1d3591c2adbdda4e44429a6bb5d2e298a704398bb2a7ccdafdfe", size = 9591050, upload-time = "2026-01-05T12:24:08.804Z" },2236 { url = "https://files.pythonhosted.org/packages/6f/e6/4b0c6a7a8a234e2113f88c80cc7aaa9af5868de7a693859f3c49da981934/ty-0.0.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01bd4466504cefa36b465c6608e9af4504415fa67f6affc01c7d6ce36663c7f4", size = 10018262, upload-time = "2026-01-05T12:24:53.791Z" },2237 { url = "https://files.pythonhosted.org/packages/cb/97/076d72a028f6b31e0b87287aa27c5b71a2f9927ee525260ea9f2f56828b8/ty-0.0.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:76c8253d1b30bc2c3eaa1b1411a1c34423decde0f4de0277aa6a5ceacfea93d9", size = 10911642, upload-time = "2026-01-05T12:24:48.264Z" },2238 { url = "https://files.pythonhosted.org/packages/3f/5a/705d6a5ed07ea36b1f23592c3f0dbc8fc7649267bfbb3bf06464cdc9a98a/ty-0.0.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8992fa4a9c6a5434eae4159fdd4842ec8726259bfd860e143ab95d078de6f8e3", size = 10632468, upload-time = "2026-01-05T12:24:24.118Z" },2239 { url = "https://files.pythonhosted.org/packages/44/78/4339a254537488d62bf392a936b3ec047702c0cc33d6ce3a5d613f275cd0/ty-0.0.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8c79d503d151acb4a145a3d98702d07cb641c47292f63e5ffa0151e4020a5d33", size = 10273422, upload-time = "2026-01-05T12:24:45.8Z" },2240 { url = "https://files.pythonhosted.org/packages/90/40/e7f386e87c9abd3670dcee8311674d7e551baa23b2e4754e2405976e6c92/ty-0.0.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7a7ebf89ed276b564baa1f0dd9cd708e7b5aa89f19ce1b2f7d7132075abf93e", size = 10120289, upload-time = "2026-01-05T12:24:17.424Z" },2241 { url = "https://files.pythonhosted.org/packages/f7/46/1027442596e725c50d0d1ab5179e9fa78a398ab412994b3006d0ee0899c7/ty-0.0.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ae3866e50109d2400a886bb11d9ef607f23afc020b226af773615cf82ae61141", size = 9566657, upload-time = "2026-01-05T12:24:51.048Z" },2242 { url = "https://files.pythonhosted.org/packages/56/be/df921cf1967226aa01690152002b370a7135c6cced81e86c12b86552cdc4/ty-0.0.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:185244a5eacfcd8f5e2d85b95e4276316772f1e586520a6cb24aa072ec1bac26", size = 9610334, upload-time = "2026-01-05T12:24:20.334Z" },2243 { url = "https://files.pythonhosted.org/packages/ac/e8/f085268860232cc92ebe95415e5c8640f7f1797ac3a49ddd137c6222924d/ty-0.0.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:f834ff27d940edb24b2e86bbb3fb45ab9e07cf59ca8c5ac615095b2542786408", size = 9726701, upload-time = "2026-01-05T12:24:29.785Z" },2244 { url = "https://files.pythonhosted.org/packages/42/b4/9394210c66041cd221442e38f68a596945103d9446ece505889ffa9b3da9/ty-0.0.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:773f4b3ba046de952d7c1ad3a2c09b24f3ed4bc8342ae3cbff62ebc14aa6d48c", size = 10227082, upload-time = "2026-01-05T12:24:40.132Z" },2245 { url = "https://files.pythonhosted.org/packages/dc/9f/75951eb573b473d35dd9570546fc1319f7ca2d5b5c50a5825ba6ea6cb33a/ty-0.0.9-py3-none-win32.whl", hash = "sha256:1f20f67e373038ff20f36d5449e787c0430a072b92d5933c5b6e6fc79d3de4c8", size = 9176458, upload-time = "2026-01-05T12:24:32.559Z" },2246 { url = "https://files.pythonhosted.org/packages/9b/80/b1cdf71ac874e72678161e25e2326a7d30bc3489cd3699561355a168e54f/ty-0.0.9-py3-none-win_amd64.whl", hash = "sha256:2c415f3bbb730f8de2e6e0b3c42eb3a91f1b5fbbcaaead2e113056c3b361c53c", size = 10040479, upload-time = "2026-01-05T12:24:42.697Z" },2247 { url = "https://files.pythonhosted.org/packages/b5/8f/abc75c4bb774b12698629f02d0d12501b0a7dff9c31dc3bd6b6c6467e90a/ty-0.0.9-py3-none-win_arm64.whl", hash = "sha256:48e339d794542afeed710ea4f846ead865cc38cecc335a9c781804d02eaa2722", size = 9543127, upload-time = "2026-01-05T12:24:11.731Z" },2248]22492250[[package]]2251name = "typer"2252source = { editable = "." }2253dependencies = [2254 { name = "click", version = "8.1.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
25 unmodified lines
2280 { name = "pyyaml" },2281 { name = "rich" },2282 { name = "ruff" },2283 { name = "shellingham" },2284 { name = "ty" },2285]2286docs = [2287 { name = "cairosvg" },2288 { name = "griffe-typingdoc" },
25 unmodified lines
2314 { name = "pytest-xdist" },2315 { name = "rich" },2316 { name = "ruff" },2317 { name = "shellingham" },2318 { name = "ty" },2319]23202321[package.metadata]2322requires-dist = [
24 unmodified lines
2347 { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" },2348 { name = "rich", specifier = ">=10.11.0" },2349 { name = "ruff", specifier = "==0.15.0" },2350 { name = "shellingham", specifier = ">=1.3.0" },2351 { name = "ty", specifier = "==0.0.9" },2352]2353docs = [2354 { name = "cairosvg", specifier = "==2.8.2" },2355 { name = "griffe-typingdoc", specifier = "==0.3.0" },
23 unmodified lines
2379 { name = "pytest-xdist", specifier = ">=1.32.0,<4.0.0" },2380 { name = "rich", specifier = ">=10.11.0" },2381 { name = "ruff", specifier = "==0.15.0" },2382 { name = "shellingham", specifier = ">=1.3.0" },2383 { name = "ty", specifier = "==0.0.9" },2384]23852386[[package]]2387name = "typing-extensions"
82 unmodified lines