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

Use builtin importlib.resources. #66

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

pelme
Copy link
Contributor

@pelme pelme commented Apr 15, 2024

Supporting Python >=3.9 does not require using the backport.

Also, use joinpath() to simplify the retrival of the path+return pathlib.Path instead of str.

Supporting Python >=3.9 does not require using the backport.

Also, use joinpath() to simplify the retrival of the path+return
pathlib.Path instead of str.
@hbldh hbldh changed the base branch from master to develop April 15, 2024 11:32
@hbldh
Copy link
Owner

hbldh commented Apr 15, 2024

I had intended to keep compatibility to 3.7, but only test on >=3.9. This breaks that. But it is better to avoid that dependency, so lets go with this.

@hbldh hbldh merged commit 43f1245 into hbldh:develop Apr 15, 2024
0 of 4 checks passed
@pelme
Copy link
Contributor Author

pelme commented Apr 15, 2024

Thanks! Hopefully most people have moved past 3.7 now :)

@hbldh hbldh mentioned this pull request Apr 24, 2024
@cthart
Copy link
Contributor

cthart commented Apr 27, 2024

This doesn't just break on Python 3.7 but also breaks with AttributeError: module 'importlib.resources' has no attribute 'files' on Python 3.8.10 which we're still using extensively on Ubuntu 20.04.
Any chance you can revert this change?

@hbldh
Copy link
Owner

hbldh commented Apr 27, 2024

Yes. In that case I will look at a modification that enables use of 3.7 and forward.

@pelme
Copy link
Contributor Author

pelme commented Apr 27, 2024

Since 3.8 was not part of CI i did not think it was supported.

It is probably possible to avoid the error by using importlib.resources.path instead. That would avoid having to pull in the extra dependency while still supporting Python >=3.7.

@cthart
Copy link
Contributor

cthart commented Apr 29, 2024

It's a bit of a catch-22 situation as importlib.resources.path is deprecated as of 3.11, while the suggested replacement as_file was new in 3.9

@cthart
Copy link
Contributor

cthart commented Apr 29, 2024

See also issue #69

@hbldh
Copy link
Owner

hbldh commented Apr 29, 2024

This should now be solved and is released in newly published version 1.2.0 on PyPI.

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.

3 participants