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 3.10 and Python 3.9 compatibility; disutils deprecation; asyncio method deprecation #517

Merged
merged 15 commits into from
Jan 28, 2022

Conversation

bnlrnz
Copy link
Collaborator

@bnlrnz bnlrnz commented Jan 5, 2022

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:

pip3 install tox

Run tox:

cd pyshark/src
tox

The artifacts tox creates are already mentioned in .gitignore.

bnlrnz added 8 commits January 4, 2022 09:15
"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
bnlrnz added 2 commits January 7, 2022 11:21
tox is a command line tool for python testing. It manages generic
virtualenvs and therefore allows to run test with multiple python
versions consecutively.
@bnlrnz bnlrnz requested a review from KimiNewt January 7, 2022 10:37
bnlrnz added 5 commits January 7, 2022 12:33
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 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
@bnlrnz bnlrnz merged commit 05927e8 into KimiNewt:master Jan 28, 2022
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.

2 participants