Pyre is a type checker for Python 3.
Questions tagged [pyre-check]
16 questions
16
votes
4 answers
how to ignore specific error in pyre-check python package for the whole project
I am using pyre-checking for static type testing, I want to ignore specific error from my project.
For example: Undefined attribute [16]: Module google.protobuf.struct_pb2 has no attribute _STRUCT.
Suppose if I want to ignore this error from my…

chethankumar MV
- 337
- 4
- 10
5
votes
2 answers
Typing function when decorator change return type
how to correctly write types for the function whose return type is modified by decorator ?
Simple example:
def example_decorator(fn):
def wrapper(data):
res = fn(data)
return ', '.join(res)
return…

Kubas
- 976
- 1
- 15
- 34
5
votes
1 answer
How do I make pyre-check library work with numpy?
a.py:
import numpy
pyre
a.py:1:0 Undefined import [21]: Could not find a module corresponding to import `numpy`.
Although definitely I have numpy installed.
Environment: Ubuntu, python 3.7.1, pyre 0.0.22, numpy 1.16.2

Antony Hatchkins
- 31,947
- 10
- 111
- 111
2
votes
0 answers
How to fix Pyre undefined import error in my python project
I'm using Pyre action from GitHub
but at the code scanning i got undefined import error
in my project I've already the requirement.txt
Error on GitHub, This is the error it shows
This is the…

FrenkyDema
- 31
- 3
1
vote
1 answer
Pyre-check cannot located Typeshed
I installed pyre-check on my Mac via pip install:
> pip3 install pyre-check ✘ 127
Collecting pyre-check
Downloading…

Derek Brown
- 4,232
- 4
- 27
- 44
1
vote
1 answer
Pyre + Conda: How to add conda packages to Pyre search path?
I am trying to configure the Pyre typechecker to work together with Anaconda. However, pyre is unable to find the packages that I have installed through conda. How can I modify the Pyre config to search in the appropriate anaconda directories?

Derek Brown
- 4,232
- 4
- 27
- 44
1
vote
0 answers
pyre-check doesn't detect naive date vs. tz aware date type error
Why can't Python type checker (I tried Pyre) find this type error?
from datetime import datetime
import pytz
utc = pytz.utc
a = utc.localize(datetime.now())
print(a)
#2021-12-11 15:55:35.187927+00:00
print( datetime.now())
#2021-12-11…

Jason O.
- 3,168
- 6
- 33
- 72
1
vote
0 answers
Pyre dictionary typing
I'm attempting to fix typing errors in my program with pyre.
I have the following snippet, that works when it is run.
my_dict = dict(my_list=[], notes='')
my_dict["notes"] = "pyre"
print(my_dict["notes"])
That makes the error:
test.py:2:19…

user69953
- 13
- 3
1
vote
2 answers
Unknown AnalysisClassHierarchy.Untracked(_) exception occurs at pyre analyze
Urgently trying to find a fix for an unidentified and undocumented error.
Running pysa analysis and getting this:
ƛ Uncaught exception:
ƛ
ƛ AnalysisClassHierarchy.Untracked(_)
ƛ
ƛ Raised at file "string.ml", line 115, characters 19-34
ƛ Called…

stax
- 11
- 3
1
vote
2 answers
Are pysa users expected to copy configuration files?
Facebook's Pysa tool looks useful, in the Pysa tutorial exercises they refer to files that are provided in the pyre-check repository using a relative path to include a path outside of the exercise…

Stephen Paulger
- 5,204
- 3
- 28
- 46
0
votes
2 answers
Can I universally quantify a type in Python?
Say that I want to encode cons as:
def cons(a, b):
return lambda f : f(a, b)
I would like to add typing to the cons above. The obvious typing would be:
T = TypeVar('T')
U = TypeVar('U')
V = TypeVar('V')
def cons(a: T, b: U) ->…

namesis
- 157
- 10
0
votes
0 answers
Does Pydantic work with Pyre? ("Uninitialized attribute" when type checking BaseModel)
Problem:
I'm using Pydantic to structure my code, and Pyre (aka pyre-check) to type check. In the following sample, the code works and mypy doesn't complain but Pyre gives error:
Uninitialized attribute [13]: Attribute first is declared in class…

FlightPlan
- 43
- 1
- 8
0
votes
0 answers
Automatically add types with Pyre
I'm new to Pyre and I've written some Python code using Django and have it installed in the project.
When I run pyre, it shows over 100 lines of type errors (missing type).
Is there a way to automatically add types to my Django code?
I don't mind…

someoneSomewhere
- 41
- 2
- 4
0
votes
1 answer
Pyre Check: verification error - `eval` is not part of the environment, no module `eval` in search path
I'm trying to set up Pyre Check Pysa just as described in the official tutorial: https://github.com/facebook/pyre-check/tree/main/documentation/pysa_tutorial/exercise2
When running pyre analyze I get the following errors:
ƛ Found 2 model…

Florian T
- 103
- 2
- 8
0
votes
1 answer
Best practice to create Python class with hardcoded dictionary
I am new to Python. I have a function like below which returns a dictionary.
def get_my_class_object(self, input):
return {
"foo": {"test": {}}, // this is hard-coded
"var": "FIRST" // real code computes var using the…

user800799
- 2,883
- 7
- 31
- 36