-
-
Notifications
You must be signed in to change notification settings - Fork 84
Update to Python 3.9 #498
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
Open
mweinelt
wants to merge
18
commits into
ArchiveTeam:develop
Choose a base branch
from
mweinelt:unfuck
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update to Python 3.9 #498
Conversation
This file contains hidden or 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
Renames wpull.testing.async to wpull.testing._async, because async has become a reserved term in 3.7. The @asyncio.coroutine decorator was deprecated in 3.8 and removed in 3.10. Coroutines now use `async def fn` syntax. The `yield from` expression in a coroutine was replaced by `await` in 3.5. The `asyncio.async` was an alias to `ensure_future`, deprecated in 3.4.4 and removed whenever. And instead of `with (yield from lock)` locks now use the `async with lock` construction.
These imports were deprecated from Python 3.3, but only removed in 3.10.
This is going to be removed in newer Tornado versions.
and target Python 3.9 for now.
This is the last version from 2020 in some earlier version Tokenizer was made into a private module.
Otherwise it cannot be added to a set.
This unbreaks import Template from the stdlib string library.
It gets put into a set for a test, but a named tuple is not hashable when it contains a stdlib dict. We therefore install the frozendict dependency to satisfy that need.
Not a random private address that might be routable or blackholed, because it is used in a project like DN42 or Freifunk.
Locking is super important if you want to reproduce a certain state of the package, as has been the case for wpull these last few years. And provide a direnv integration to attach to the virtualenv.
The nosetests framework is effectively dead and earlier work has made the tests run with pytest, which is today's de facto test runner in Python.
iakat
approved these changes
Oct 9, 2025
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.
Work to bring wpull to Python 3.9 and adopt the PEP517 build process.
Updated some dependencies, as they were broken due to breaking changes in Python or just wouldn't lock otherwise.
Note
For 3.10 support an update to tornado>=6.0 would be required.
I opted to introduce uv as a modern development environment and packaging tool.
Tests
Currently, we are running 575 tests and a low number of them are failing and might need investigation.
Test summary
FAILED wpull/document/html_test.py::TestHTML5LibHTML::test_html_encoding - IndexError: tuple index out of range FAILED wpull/document/sitemap_test.py::TestHTML5LibSitemap::test_sitemap_encoding - IndexError: tuple index out of range FAILED wpull/driver/phantomjs_test.py::TestPhantomJS::test_driver - FileNotFoundError: [Errno 2] No such file or directory: 'phantomjs' FAILED wpull/proxy/proxy_test.py::TestProxySSL::test_basic_requests - wpull.errors.NetworkError: Proxy does not support CONNECT: 501 CONNECT is intentionally not supported FAILED wpull/scraper/html_test.py::TestLxmlHTMLScraper::test_html_wrong_charset - AssertionError: {'http://example.com/utm/__utm.js', 'http[269 chars]gif'} != frozenset() FAILED wpull/scraper/html_test.py::TestHTML5LibHTMLScraper::test_html_mojibake - AssertionError: {'http://example.com/文字化け'} != frozenset({'http://example.com/•¶Žš‰»‚¯'}) FAILED wpull/scraper/util_test.py::TestUtil::test_identifiy_link_type - AssertionError: != None FAILED wpull/testing/integration/http_app_test.py::TestHTTPGoodApp::test_app_input_file_arg_stdin - AttributeError: '_io.StringIO' object has no attribute 'buffer' FAILED wpull/testing/integration/http_app_test.py::TestHTTPGoodApp::test_app_args - AssertionError: False is not true FAILED wpull/testing/integration/http_app_test.py::TestHTTPGoodApp::test_sitemaps - AssertionError: False is not true FAILED wpull/testing/integration/http_app_test.py::TestHTTPBadApp::test_bad_cookie - AssertionError: 4 != 3 FAILED wpull/testing/integration/phantomjs_test.py::TestPhantomJS::test_app_phantomjs - AssertionError: False is not true FAILED wpull/testing/integration/phantomjs_test.py::TestPhantomJS::test_app_phantomjs_scroll - FileNotFoundError: [Errno 2] No such file or directory: 'DEUUEAUGH.html.snapshot.html' FAILED wpull/url_test.py::TestURL::test_ip_address_normalization - AssertionError: 'http://[::ffff:c000:280]/' != 'http://[::ffff:192.0.2.128]/' FAILED wpull/testing/integration/http_app_test.py::TestHTTPGoodApp::test_session_cookie - AssertionError: 0 != 8 FAILED wpull/testing/integration/phantomjs_test.py::TestPhantomJSHTTPS::test_app_phantomjs - AssertionError: False is not true FAILED wpull/testing/integration/phantomjs_test.py::TestPhantomJSHTTPS::test_app_phantomjs_scroll - FileNotFoundError: [Errno 2] No such file or directory: 'DEUUEAUGH.html.snapshot.html' FAILED wpull/testing/integration/script_test.py::TestScriptGoodApp::test_app_python_plugin_script - AssertionError: 42 != 1This pull request fixes (at least) #332, #404 and obsoletes #325, #402, #413, #426
I remembered to:
developand set to merge intodevelopChanges: A bunch, really. I'd say 80% deprecation fixes, 15% test fixes and 5% modern packaging.
Important
This pull request is best reviewed by looking at the individual commits