Modernising type annotations, and Python2 is support
The contributing guide says that Python2 is supported:
https://github.com/secdev/scapy/blob/42115bf5493e6dd11630692f384a76d4475d1ba6/CONTRIBUTING.md#L140-L142
However, pyproject.toml lists Python3.7 as the minimum version:
https://github.com/secdev/scapy/blob/a5dab9efc50af956cf7eac77e47ef3d884c6eb0d/pyproject.toml#L30-L38
Is that section of the contributing guide outdated?
If so, would you be open to some pull requests to modernise typing? I've noticed that a large part of the codebase uses Python2 type comments, but for Python3+ projects they're discouraged (for examples, PEP 526 states "As variable annotations are more readable than type comments, they are preferred in stub files for all versions of Python, including Python 2.7")
Some well-tested tools can help with this:
and then some minor manual fixups can get the checks passing. I tried this out in #4650, and it wasn't too much effort, and I verified that tox -e mypy and ./test/run_tests still pass. Would you be interested in modernising type annotations across the codebase?
If there's interest, I'd be happy to do this for the rest of the codebases (for context, I'm part of an effort to improve typing in widely used packages, and there's a lot of interest in Scapy in particular)
Hi, you're right the guide is outdated. Regarding an upgrade, we're a bit careful when it comes to large commits that break history. I think we need to discuss this first with other maintainers to think about what we would prefer.
Thanks for bringing this up
Thanks for your response! Sure, happy to wait for others' thoughts before proceeding
This is fixed in https://github.com/secdev/scapy/pull/4713. Most likely, we'll upgrade the type hints as we go.