Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using the shorthand union type operator | in entrypoint type signatures causes universal failures on parsing. #64

Open
skothenhill-nv opened this issue Sep 24, 2024 · 0 comments

Comments

@skothenhill-nv
Copy link

Using the union type operator in entrypoint type signatures causes universal failures on parsing.

@run.cli.entrypoint
def simple_example(
    this_or_that: str | int 
):
   print(this_or_that) 
$> python main.py this_or_that='asdf'
$> UnknownTypeError: Failed to parse 'Error parsing argument: Failed to parse 'asdf' as str | int: Unsupported type: str | int (Argument: asdf, Context: {'expected_type': str | 
int})' as this_or_that=asdf: {'key': 'this_or_that', 'value': 'asdf', 'expected_type': str | int} (Argument: Error parsing argument: Failed to parse 'asdf' as str | int: 
Unsupported type: str | int (Argument: asdf, Context: {'expected_type': str | int}), Context: {'expected_type': 'this_or_that=asdf'})

On the contrary, using Union to achieve the same signature does not fail:

@run.cli.entrypoint
def simple_example(
    this_or_that: Union[str, int]
):
   print(this_or_that) 

(omitted outputs, works as expected)

@skothenhill-nv skothenhill-nv changed the title [BUG] | [BUG] Using the shorthand union type operator | in entrypoint type signatures causes universal failures on parsing. Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant