88from itertools import cycle
99from pathlib import Path , PurePosixPath
1010from textwrap import dedent
11- from typing import Annotated , Any , Optional , Union
11+ from typing import Annotated , Any
1212
1313import fastar
1414import rignore
2828logger = logging .getLogger (__name__ )
2929
3030
31- def validate_app_directory (v : Optional [ str ] ) -> Optional [ str ] :
31+ def validate_app_directory (v : str | None ) -> str | None :
3232 if v is None :
3333 return None
3434
@@ -58,7 +58,7 @@ def validate_app_directory(v: Optional[str]) -> Optional[str]:
5858 return normalized
5959
6060
61- AppDirectory = Annotated [Optional [ str ] , AfterValidator (validate_app_directory )]
61+ AppDirectory = Annotated [str | None , AfterValidator (validate_app_directory )]
6262
6363
6464def _cancel_upload (deployment_id : str ) -> None :
@@ -147,10 +147,10 @@ def _get_teams() -> list[Team]:
147147class AppResponse (BaseModel ):
148148 id : str
149149 slug : str
150- directory : Optional [ str ]
150+ directory : str | None
151151
152152
153- def _update_app (app_id : str , directory : Optional [ str ] ) -> AppResponse :
153+ def _update_app (app_id : str , directory : str | None ) -> AppResponse :
154154 with APIClient () as client :
155155 response = client .patch (
156156 f"/apps/{ app_id } " ,
@@ -162,7 +162,7 @@ def _update_app(app_id: str, directory: Optional[str]) -> AppResponse:
162162 return AppResponse .model_validate (response .json ())
163163
164164
165- def _create_app (team_id : str , app_name : str , directory : Optional [ str ] ) -> AppResponse :
165+ def _create_app (team_id : str , app_name : str , directory : str | None ) -> AppResponse :
166166 with APIClient () as client :
167167 response = client .post (
168168 "/apps/" ,
@@ -273,7 +273,7 @@ def _upload_deployment(deployment_id: str, archive_path: Path) -> None:
273273 logger .debug ("Upload notification sent successfully" )
274274
275275
276- def _get_app (app_slug : str ) -> Optional [ AppResponse ] :
276+ def _get_app (app_slug : str ) -> AppResponse | None :
277277 with APIClient () as client :
278278 response = client .get (f"/apps/{ app_slug } " )
279279
@@ -345,7 +345,7 @@ def _configure_app(toolkit: RichToolkit, path_to_deploy: Path) -> AppConfig:
345345
346346 toolkit .print_line ()
347347
348- selected_app : Optional [ AppResponse ] = None
348+ selected_app : AppResponse | None = None
349349
350350 if not create_new_app :
351351 with toolkit .progress ("Fetching apps..." ) as progress :
@@ -389,7 +389,7 @@ def _configure_app(toolkit: RichToolkit, path_to_deploy: Path) -> AppConfig:
389389 validator = TypeAdapter (AppDirectory ),
390390 )
391391
392- directory : Optional [ str ] = directory_input if directory_input else None
392+ directory : str | None = directory_input if directory_input else None
393393
394394 toolkit .print_line ()
395395
@@ -518,13 +518,13 @@ def _wait_for_deployment(
518518
519519class SignupToWaitingList (BaseModel ):
520520 email : EmailStr
521- name : Optional [ str ] = None
522- organization : Optional [ str ] = None
523- role : Optional [ str ] = None
524- team_size : Optional [ str ] = None
525- location : Optional [ str ] = None
526- use_case : Optional [ str ] = None
527- secret_code : Optional [ str ] = None
521+ name : str | None = None
522+ organization : str | None = None
523+ role : str | None = None
524+ team_size : str | None = None
525+ location : str | None = None
526+ use_case : str | None = None
527+ secret_code : str | None = None
528528
529529
530530def _send_waitlist_form (
@@ -624,7 +624,7 @@ def _waitlist_form(toolkit: RichToolkit) -> None:
624624
625625def deploy (
626626 path : Annotated [
627- Union [ Path , None ] ,
627+ Path | None ,
628628 typer .Argument (
629629 help = "A path to the folder containing the app you want to deploy"
630630 ),
@@ -633,7 +633,7 @@ def deploy(
633633 bool , typer .Option ("--no-wait" , help = "Skip waiting for deployment status" )
634634 ] = False ,
635635 provided_app_id : Annotated [
636- Union [ str , None ] ,
636+ str | None ,
637637 typer .Option (
638638 "--app-id" ,
639639 help = "Application ID to deploy to" ,
0 commit comments