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

pycozo.builder Python 3.9 import error in typing library #8

Open
athanhat opened this issue Sep 8, 2023 · 0 comments
Open

pycozo.builder Python 3.9 import error in typing library #8

athanhat opened this issue Sep 8, 2023 · 0 comments

Comments

@athanhat
Copy link

athanhat commented Sep 8, 2023

Hi, I have tried to work with pycozo.builder to construct CozoScript (0.7.2) queries programmatically.

from pycozo.builder import (Var, Const, 
                            InputParam, InputObject, InputList, InputRelation, InputProgram,
                            OpApply, Sorter, RuleHead, RuleApply, ProximityApply, 
                            StoreOp, StoredRuleApply, StoredRuleNamedApply,    
                            Conjunction, Disjunction, Negation, Bind, Cond, RawAtom,
                            FixedRule, InlineRule, ConstantRule)

ImportError                               Traceback (most recent call last)
Cell In[2], line 1
----> 1 from pycozo.builder import (Var, Const, 
      2                             InputParam, InputObject, InputList, InputRelation, InputProgram,
      3                             OpApply, Sorter, RuleHead, RuleApply, ProximityApply, 
      4                             StoreOp, StoredRuleApply, StoredRuleNamedApply,    
      5                             Conjunction, Disjunction, Negation, Bind, Cond, RawAtom,
      6                             FixedRule, InlineRule, ConstantRule)

File ~/anaconda3/envs/KGTK/lib/python3.9/site-packages/pycozo/builder.py:9
      7 from enum import Enum
      8 from dataclasses import dataclass, field
----> 9 from typing import Any, TypeAlias, Union
     12 @dataclass
     13 class Var:
     14     name: str

ImportError: cannot import name 'TypeAlias' from 'typing' (~/anaconda3/envs/KGTK/lib/python3.9/typing.py)

NOTICE: The python environment that I tried the script above is based on Python 3.9, I have also tried with Python 3.10 and the problem with typing library disappeared. Code in test_builder.py works fine with Python 3.10

zh217 added a commit that referenced this issue Sep 16, 2023
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