Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Unify typing between df.Definition, features, and typing.NewType #188

@johnandersen777

Description

@johnandersen777

We want to make Definition into a wrapper around https://docs.python.org/3/library/typing.html#newtype

Making sure it still supports the lock and spec keyword arguments.

Definition(
name="git_repository",
primitive="Dict[str, str]",
lock=True,
spec=GitRepoSpec,
),

Then we need to go through all the operations and correct the types of their inputs:

@op(inputs={"URL": URL}, outputs={"valid": valid_git_repository_URL})
async def check_if_valid_git_repository_URL(URL: str):
exit_code = await exec_with_logging("git", "ls-remote", URL)
return {"valid": bool(exit_code == 0)}

would become:

 @op(inputs={"url": URL}, outputs={"valid": valid_git_repository_URL}) 
 async def check_if_valid_git_repository_URL(url: URL): 
     exit_code = await exec_with_logging("git", "ls-remote", url) 
     return {"valid": bool(exit_code == 0)} p

The next issue that makes sense to do after this issue is #189

We need to be sure that static type checkers support this functionality. The TypeScript based one from Microsoft does not. Next type checkers we need to test are Google's one and mypy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestp1High PrioritytLEsitmated Time To Complete: Long

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions