-
Notifications
You must be signed in to change notification settings - Fork 421
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 3.10 and Python 3.9 compatibility; disutils deprecation; asyncio method deprecation #517
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"distutils" will be deprecated. Switched to "packaging" to prevent warnings and ensure working version comparison in the future.
If no event loop is running in python 3.10 get_event_loop() will throw an exception caus it is identical to get_running_loop()
nested-asyncio uses deprecated methods
KimiNewt
approved these changes
Jan 6, 2022
tox is a command line tool for python testing. It manages generic virtualenvs and therefore allows to run test with multiple python versions consecutively.
The ThreadedChildWatcher (default for the UnixDefaultEventLoopPolicy) could not receive our eventloop with attach_loop. In some cases this led to (non critical) exceptions while closing a capture object (_cleanup_subprocess).
bnlrnz
changed the title
Python 3.10 compatibility; disutils deprecation; asyncio method deprecation
Python 3.10 and Python 3.9 compatibility; disutils deprecation; asyncio method deprecation
Jan 11, 2022
KimiNewt
approved these changes
Jan 25, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I replaced the distutils package with the packaging package, cause distutils is deprecated and will be removed in Python 3.12. The recommended replacement is setuptools which uses packaging. For pyshark only the ability to compare versions is needed. This functionality is provided by packaging. To keep dependencies slim, I choose packaging over setuptools.
asyncio get_event_loop method is also deprecated in Python 3.10 see. After fiddling around with nested_asyncio, I realized that nested_asyncio also uses the deprecated get_event_loop method, so I dumped nested_asyncio and fixed the deprecation warning for the get_event_loop method with "nativ" asyncio methods.
I also made some small changes to tests in order to prevent pytest and pyshark deprecation warnings.
Finally I placed a "tox.ini" file next to setup.py in src. tox is a command line tool for python testing. It manages generic virtualenvs and therefore allows to run test with multiple (installed) python versions consecutively.
Install tox:
Run tox:
The artifacts tox creates are already mentioned in .gitignore.