Questions tagged [pyi]

Tags for questions about Python Information (pyi). The python package for scraping pypi endpoints to retrieve python package information.

PYthon Information is a CLI that scrapes pypi json endpoints to retrieve python package data.

It can be used to easily get basic stats on a package without the need to go to pypi to look it up.

Read more about pyi package here

12 questions
6
votes
1 answer

Partial stub in PyCharm

I would like to introduce partial type annotation to my project. For example for overloading. I found that pep561 introduce partial stub file support. I develop my project with PyCharm and I add corresponding *.pyi file. And got expected…
Grzegorz Bokota
  • 1,341
  • 7
  • 14
4
votes
0 answers

How can I add type hints to my monkey-patched function to an existing module's class?

I want to know how I can add type hints (for PyCharm IDE code completion support) to a method def links(self) -> List[str] that I monkey-patched to an existing module's class: My function def issue_links(self) -> List[str]: links = [] # ... …
Chris Graf
  • 1,207
  • 11
  • 24
4
votes
1 answer

Merging .py file and .txt files into .exe file using pyinstaller

I have a python program that takes in as input two text files. I have converted this python program(a .py file) to a .exe file using pyinstaller. The .exe file when run gives FileNotFoundError. But when the .txt file is copied to the path where…
Varsha
  • 57
  • 8
4
votes
1 answer

What the code '_T = TypeVar('_T')' means in a *.pyi file?

I'm new to Python annotation (type hints). I noticed that many of the class definitions in pyi files inherit to Generic[_T], and _T = TypeVar('_T'). I am confused, what does the _T mean here? from typing import Generic, TypeVar _T =…
EvinK
  • 41
  • 5
4
votes
0 answers

Import a pyi (type stub file) into a normal python module

I have a program (like a macro) that runs within a parent program and imports an API module from that program (lets call it foo). The problem is that that module only exists within that program, so I can't do things like run pydocmd outside the…
Ian
  • 4,490
  • 5
  • 32
  • 62
1
vote
0 answers

Exclude *.pyd files from go to definition (with ctrl+click)

I have a small problem with my Eclipse IDE PyDev plugin - when I'm developing a program using Python with libraries in *.pyd format, I can't go to definition, because It's binary format. But there are corresponding *.pyi files with source code. How…
KhazAkar
  • 11
  • 2
1
vote
1 answer

What's the underlying implementation for most_common method of Counter?

I found a pyi file which has the following def def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ... How could this happen? List is not defined, and no implementation? Just highlight some valuable suggestions here for…
Pythoner
  • 4,355
  • 3
  • 24
  • 45
1
vote
1 answer

python stub property "Unresolved Attribute Reference" in Class Implementation

I made a Class Interface in my pyi module (scheme.pyi): class Catalog: @property def elements(self) -> List[Element]: ... and in my scheme.py I implemented the class like this: class Catalog: def __init__(self, element_collection): …
0
votes
0 answers

How to create Python Stub Files and where to put?

I have a compiled a Python extension. The resulting binary mylib.so file can be imported in the Python script and works fine. Now I am wondering how to write the interface stub file mylib.pyi such, that pylint and the Python language server used in…
Matthias
  • 795
  • 1
  • 8
  • 19
0
votes
0 answers

what is causing this pyi_rth_multiprocessing fail?

i havent used pyqt in my script as everyone else who got this error. I am using a web UI for my app using eel But when running the exe file it says pyi_rth_multiprocessing fail it is build using pyinstaller. python version is 3.8.2
user13494862
0
votes
1 answer

xmlsec is broken in new version due to __init__.pyi file

I was using xmlsec in my project, which was using latest release, with new release today, it's failing. # .tox/unittest/bin/pip install xmlsec Collecting xmlsec Using cached xmlsec-1.3.7.tar.gz (59 kB) …
Nilesh
  • 17,950
  • 11
  • 74
  • 119
0
votes
1 answer

flake8 conditional with python version in stub file

I need to support both python 3.8 and versions lower that 3.8, but the package I need to import into my stub (*.pyi) file had different name in <3.8 import sys if sys.version_info.minor < 8: import xyz else: import zyx In general this…
z0idb3rg
  • 201
  • 1
  • 3
  • 12