Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[Hinty] Add type hints to Scapy #2158
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
gpotter2
mentioned this issue
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
akshaycbor
mentioned this issue
gpotter2
mentioned this issue
|
I'd like to help but am running into a couple issues.
If I move it to the project root it runs fine now, but Can you offer guidance? |
|
Thanks for the note. I've updated the guide. There is a bug with |
|
Thanks. There is no |
|
OSX is based on BSD |


On hold
please wait before starting anything. There will be a major update to Hinty to tackle type hinting of the core (at least fields & packet). This will allow contributors to tackle smaller parts (the layers). In the meantime, have a look at the other contributions wanted page: #399 - thanks
Project "Hinty" aims at adding Type hints to Scapy. It will help discover bugs, improve the API, and make Scapy up-to-date with the high standards of Python libraries.
Implementation
We use
mypyto ensure automatic testing of the work that has already been completed. PRs that fall under project Hinty will process one (or a few) files and register them into the checks. The file.config/mypy/mypy_enabled.txtlists the files in which mypy checks are enabled. This process has been added by #2162Because we support Python 2.7, the format of the Type hints should be the following:
https://mypy.readthedocs.io/en/latest/cheat_sheet.html
Guide on how to contribute
Pick a file you want to work on.
Add that file to
.config/mypy/mypy_enabled.txtpip install pyannotate cryptography toxRun the tests for your file:
./test/run_tests -x -c test/configs/[X].utsc -K tcpdump -K manufdb -K wireshark -K tshark. Where[X]matches your OS:linux,windowsorosxThis will create
test/pyannotate_resultspyannotate --type-info test/pyannotate_results -w [the file.py you are working on]The file has been automatically processed. Now, edit it to fix the mistakes, and check your work with
tox -e mypy.cast(type, obj)fromtypingto help mypy without affecting the code.scapy.compatinstead oftyping. It provides a fallback iftypingisn't installed (python < 3.5)If you get
error: No library stub file for module ..., add an exception for it in.config/mypy/mypy.ini(follow the existing format)Check that the files still pass PEP8:
tox -e flake8When everything passes, submit a PR.😄
Status
The numbers correspond to the ammount of files processed
MyPy Support: 1.51%
[main]: 9.09%asn1: 0.00%layers: 0.00%libs: 0.00%contrib: 0.87%arch: 0.00%tools: 0.00%modules: 0.00%