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

Wrong type hints for optional parameters #4609

Open
AdrianB-sovo opened this issue Apr 23, 2024 · 0 comments
Open

Wrong type hints for optional parameters #4609

AdrianB-sovo opened this issue Apr 23, 2024 · 0 comments
Labels
bug component: pipelines Relates to the SageMaker Pipeline Platform

Comments

@AdrianB-sovo
Copy link

Describe the bug
Some optional parameters don't use Union[<type>, None] = None, which is problematic for those that use a type checker.

To reproduce

from typing import List
from sagemaker.workflow.steps import ProcessingStep

def get_job_args() -> List[str] | None
    # In my use-case, the arguments depend on some config, which can be empty.
    return None

process_step = ProcessingStep(
    name="some name",
    job_arguments=get_job_args(), # <- Type checker complains that `List[str] | None` is incompatible with `List[str]`.
)

Expected behavior
The type checker shouldn't give me errors when I use Sagemaker in a valid way.

System information
A description of your system. Please provide:

  • SageMaker Python SDK version: 2.215.0
  • Python version: 3.11.7

Additional context
I'm using VScode with Pylance configured in strict mode.

@bmouryakr bmouryakr added the component: pipelines Relates to the SageMaker Pipeline Platform label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: pipelines Relates to the SageMaker Pipeline Platform
Projects
None yet
Development

No branches or pull requests

2 participants