diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 448326fb..3e4a58ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,6 +37,8 @@ ci: - vulture - vulture-docs - yamlfix + - pyrefly + - pyrefly-docs # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks @@ -374,3 +376,21 @@ repos: types_or: [rst] additional_dependencies: [uv==0.9.5] stages: [pre-commit] + + - id: pyrefly + name: pyrefly + stages: [pre-push] + entry: uv run --extra=dev pyrefly check + language: python + types_or: [python, toml] + pass_filenames: false + additional_dependencies: [uv==0.9.5] + + - id: pyrefly-docs + name: pyrefly-docs + stages: [pre-push] + entry: uv run --extra=dev doccmd --no-write-to-file --example-workers 0 --language=python + --command="pyrefly check" + language: python + types_or: [markdown, rst] + additional_dependencies: [uv==0.9.5] diff --git a/pyproject.toml b/pyproject.toml index 2c4fce2e..03d257ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,7 @@ optional-dependencies.dev = [ "pre-commit==4.5.1", "pylint[spelling]==4.0.4", "pyproject-fmt==2.11.1", + "pyrefly==0.46.1", "pyright==1.1.407", "pyroma==5.0.1", "pytest==9.0.2", diff --git a/src/vws_cli/options/credentials.py b/src/vws_cli/options/credentials.py index 0d97a024..a9d8a60a 100644 --- a/src/vws_cli/options/credentials.py +++ b/src/vws_cli/options/credentials.py @@ -3,6 +3,7 @@ """ from collections.abc import Callable +from typing import Any import click from beartype import beartype @@ -10,12 +11,12 @@ @beartype def server_access_key_option( - command: Callable[..., None] | None = None, -) -> Callable[..., None]: + command: Callable[..., Any], +) -> Callable[..., Any]: """ An option decorator for the Vuforia server access key. """ - click_option_function = click.option( + return click.option( "--server-access-key", type=str, help=( @@ -25,19 +26,17 @@ def server_access_key_option( required=True, envvar="VUFORIA_SERVER_ACCESS_KEY", show_envvar=True, - ) - assert command is not None - return click_option_function(command) + )(command) @beartype def server_secret_key_option( - command: Callable[..., None] | None = None, -) -> Callable[..., None]: + command: Callable[..., Any], +) -> Callable[..., Any]: """ An option decorator for the Vuforia server secret key. """ - click_option_function = click.option( + return click.option( "--server-secret-key", type=str, help=( @@ -47,19 +46,17 @@ def server_secret_key_option( required=True, envvar="VUFORIA_SERVER_SECRET_KEY", show_envvar=True, - ) - assert command is not None - return click_option_function(command) + )(command) @beartype def client_access_key_option( - command: Callable[..., None] | None = None, -) -> Callable[..., None]: + command: Callable[..., Any], +) -> Callable[..., Any]: """ An option decorator for the Vuforia client access key. """ - click_option_function = click.option( + return click.option( "--client-access-key", type=str, help=( @@ -69,19 +66,17 @@ def client_access_key_option( required=True, envvar="VUFORIA_CLIENT_ACCESS_KEY", show_envvar=True, - ) - assert command is not None - return click_option_function(command) + )(command) @beartype def client_secret_key_option( - command: Callable[..., None] | None = None, -) -> Callable[..., None]: + command: Callable[..., Any], +) -> Callable[..., Any]: """ An option decorator for the Vuforia client secret key. """ - click_option_function = click.option( + return click.option( "--client-secret-key", type=str, help=( @@ -91,6 +86,4 @@ def client_secret_key_option( required=True, envvar="VUFORIA_CLIENT_SECRET_KEY", show_envvar=True, - ) - assert command is not None - return click_option_function(command) + )(command) diff --git a/src/vws_cli/options/targets.py b/src/vws_cli/options/targets.py index a2be1896..e2c80622 100644 --- a/src/vws_cli/options/targets.py +++ b/src/vws_cli/options/targets.py @@ -10,7 +10,7 @@ import click from beartype import beartype -target_id_option: Callable[..., None] = click.option( +target_id_option: Callable[..., Any] = click.option( "--target-id", type=str, help="The ID of a target in the Vuforia database.", @@ -19,7 +19,7 @@ @beartype -def target_name_option(*, required: bool) -> Callable[..., None]: +def target_name_option(*, required: bool) -> Callable[..., Any]: """ An option decorator for choosing a target name. """ @@ -77,7 +77,7 @@ class ActiveFlagChoice(Enum): def active_flag_option( *, allow_none: bool, -) -> Callable[..., None]: +) -> Callable[..., Any]: """ An option decorator for setting a target's active flag. """ @@ -98,7 +98,7 @@ def active_flag_option( ) -application_metadata_option: Callable[..., None] = click.option( +application_metadata_option: Callable[..., Any] = click.option( "--application-metadata", type=str, required=False,