-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Port importlib_resources (module and ABC) to Python 3.7 #76429
Comments
We intend to port importlib_resources to Python 3.7 as importlib.resources, with a provisional API. There's also a ResourceReader ABC to include, along with documentation and tests. Nosying Brett and assigning to myself, but if Brett *wants* to do the work, I won't stand in his way. :) |
I have the tests and code ported, but there are still a few things to do, but here's a question: We're using type annotations in importlib_resources, which of course is the right decision. But I think we still have a moratorium on typing in the stdlib. So do we want to remove the types from importlib.resources? Doing so could make for more work as we continue to track importlib_resource, so I'm inclined not to remove them. |
PR 4911 implements the importlib.resources API, along with tests and documentation. @brett.cannon - I'm thinking we should do the native ResourceReader implementations for the built-in loaders as a separate branch. |
Yep, I assumed implementing the ReourceReader API would be a separate step. As for the type hints, I thought it was lifted such that new code could include it but we wouldn't be taking PRs to add them to pre-existing code? |
Next up - implementing the ResourceReader ABC. |
Apologies if this is obvious and already in progress, but the issue with Windows and this change appears to be that the "utf-8.file" file is being treated as text rather than binary. So the line ending is expanding to CRLF. The working copy of utf-8.file on my Windows workers is actually 21 bytes, not 20. |
I notice that my 'Installed' builder (http://buildbot.python.org/all/#/builders/103) has been broken since PR4911 landed. My suspicion is that it's just another directory missed in the Makefile install libinstall target, but haven't actually looked into it. |
I bet Barry forgot to add some test directories to the makefile. On Sat, Jan 6, 2018, 10:33 Zachary Ware, <report@bugs.python.org> wrote:
|
On Jan 6, 2018, at 13:33, Zachary Ware <report@bugs.python.org> wrote:
Dang. I’ll try to look into this as soon as possible, but it might be a day or so. |
Tests fail on Windows since the commit deae6b4. Example with AMD64 Windows8.1 Non-Debug 3.x: http://buildbot.python.org/all/#/builders/12/builds/426 ====================================================================== Traceback (most recent call last):
File "D:\buildarea\3.x.ware-win81-release\build\lib\test\test_importlib\test_open.py", line 24, in test_open_binary
self.assertEqual(result, b'Hello, UTF-8 world!\n')
AssertionError: b'Hello, UTF-8 world!\r\n' != b'Hello, UTF-8 world!\n' |
Failure on x86 Gentoo Installed with X 3.x: http://buildbot.python.org/all/#/builders/103/builds/453 4 tests failed: test test_import crashed -- Traceback (most recent call last):
File "/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/libregrtest/runtest.py", line 163, in runtest_inner
the_module = importlib.import_module(abstest)
File "/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 723, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/test_import/__init__.py", line 28, in <module>
from test.test_importlib.util import uncache
File "/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/test_importlib/util.py", line 19, in <module>
from . import data01
ImportError: cannot import name 'data01' from 'test.test_importlib' (/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.7/test/test_importlib/__init__.py) |
Now that the zipimporter support has landed, I think we're done! |
ResourceReader
andget_resource_reader()
for zipimport #5248Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: