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

Open

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.

Activity

  1. changed the title [-]df: types: Definition should inherit from typing.NewType[/-] [+]Unify typing between df.Definition, features, and typing.NewType[/+] on Sep 17, 2019
  2. added
    p1High Priority
    tLEsitmated Time To Complete: Long
    on Jan 5, 2020
  3. johnandersen777 commented on Oct 25, 2022

    @johnandersen777
    Author
    • This is active in the alice branch now.
      • Definition.spec classes are still not unified in alice branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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