codon icon indicating copy to clipboard operation
codon copied to clipboard

Can't use `typing` module

Open akleemans opened this issue 3 years ago • 1 comments

I have a Python script which runs fine when using Python 3.8.5:

from typing import Tuple

def combine(a: int, b: int) -> Tuple[int, int]:
    return (a, b)

print('Tuple from 1 and 2:', combine(1, 2))

When running codon run test.py (0.15.1), I get an error: test.py:1:6-12: error: no module named 'typing'. If I remove the first line it works just fine.

Is it not possible to import and use the typing module? I want my script to be both executable by codon and Python itself.

akleemans avatar Dec 09 '22 21:12 akleemans

Hi @akleemans

We'll add a mock for this module shortly. In general, all typing information is already imported within the Codon's toplevel namespace (e.g., Tuple is accessible without any imports).

inumanag avatar Dec 11 '22 19:12 inumanag

@inumanag @arshajii Thank you! 🎉

akleemans avatar Dec 13 '22 07:12 akleemans