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

Python type stubs #235

Merged
merged 3 commits into from
Jan 25, 2023
Merged

Python type stubs #235

merged 3 commits into from
Jan 25, 2023

Conversation

Tasssadar
Copy link
Member

@Tasssadar Tasssadar commented Jan 18, 2023

(Requires #234)

This is my attempt to add at least some support for code completion and type checking to yaramod.

The initial .pyi file is generated by stubgen, but the generated output did not even have correct syntax, so I had to make some manual adjustments and I also added some more types while at it - the PR is split into multiple commits on purpose, so you can see the diff between generated output and what actually works.

I changed the build scripts to include the needed .pyi and py.typed file. I'm not sure I will not break anything for existing uses of yaramod, especially in projects that already use mypy, so this should definitely be at least a minor version bump.

@MatejKastak MatejKastak self-requested a review January 25, 2023 08:37
Copy link
Member

@MatejKastak MatejKastak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice improvement! 👍

Can you shortly summarize how did you create type stubs? I would like to create a wiki page for that how to generate them, how to update them, and optionally how they are tested.

src/python/yaramod_python.cpp Show resolved Hide resolved
.github/workflows/pipeline.yml Show resolved Hide resolved
@Tasssadar Tasssadar marked this pull request as ready for review January 25, 2023 09:53
Base automatically changed from tokenstream_py to master January 25, 2023 14:31
@MatejKastak MatejKastak merged commit 42bafdc into master Jan 25, 2023
@MatejKastak MatejKastak deleted the python_type_stubs branch January 25, 2023 15:19
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

Successfully merging this pull request may close these issues.

None yet

3 participants