Missing python interface file
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- developer-experience
Research direction
Review the documented yara-python API and the proposed .pyi interface, then check how the compiled package is laid out in this repository. Compare the result with mypy stubgen output and verify the stubs support VSCode type hinting and code completion. Done means a correct .pyi file is included in the package with the public functions and classes represented.
Written by the indexing model from the issue text.
Description
The compiled yara-python is missing a python interface file (.pyi).
Without such an interface definition, support in IDEs is quite limited (no type hinting, no code completion).
I've created a small interface file based on the documentation, which is definitely not 100% correct, but enough to enable code completion and type hinting in VSCode:
from typing import IO, Callable, Dict, List, Tuple, Union
class Match:
rule: str
namespace: str
tags: List[str]
meta: Dict[str, str]
strings: List[Tuple[int, str, str]]
class Rules:
def match(
self,
filepath: str = "",
pid: int = 0,
data: Union[str, bytes] = "",
externals: dict = {},
callback: Callable = lambda x: x,
fast: bool = False,
timeout: int = -1,
modules_data: dict = {},
modules_callback: Callable = lambda x: x,
warnings_callback: Callable = lambda x: x,
which_callbacks: int = 0,
console_callback: Callable = lambda x: x,
) -> List[Match]:
pass
def save(self, filepath: str = "", file: IO = None) -> None:
pass
def compile(
filepath: str = "",
source: str = "",
file: IO = None,
filepaths: dict = {},
sources: dict = {},
externals: dict = {},
includes: bool = True,
error_on_warning: bool = False,
) -> Rules:
pass
def load(filepath: str = "", file: IO = None) -> Rules:
pass
def set_config(
stack_size: int = -1, max_strings_per_rule: int = -1, max_match_data: int = -1
) -> None:
pass
Adding a correct .pyi file to this repo, which can also be autogenerated using mypys stubgen (https://mypy.readthedocs.io/en/stable/stubgen.html), would obviously be the preferred solution.
I already tried autogeneration with stubgen, which did not work that good (function parameters and type hints were missing).
- Dominant language
- C
- Stars
- 754
- Forks
- 190
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from VirusTotal/yara-python
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
VirusTotal/yara-python#263 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 28/100
VirusTotal/yara-python#234 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
VirusTotal/yara-python#216 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
VirusTotal/yara-python#212 · 11 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
VirusTotal/yara-python#199 · 3 comments ·
All issues in VirusTotal/yara-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100