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

Improve the find_profile_data function for Python3.9+ #9

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Conversation

rchaput
Copy link
Contributor

@rchaput rchaput commented Jul 15, 2024

We try to import the newest functions from importlib.resources but still resort to the old functions if they are not available in order to:

  • avoid deprecation warnings on recent Python versions (3.11+);
  • yet allow older versions (3.7, 3.8) to work.

The `importlib.resources` lib that we use in this function has changed its API. Our function would still work but raise a deprecation warning. There is a risk that the functions we require would be deleted at some point; this commit makes our function future-proof (at least for the next versions).
We try to import the most recent functions; if it does not work, we assume we are on an older version and resort to the previous API (for which there will be no deprecation warning at this point).

Python 3.7 is no longer supported by the Python community; Python 3.8 will reach end-of-life on 2024-10. At some point, our function could drop this "backup" import for older versions; but for now, they may still be used.
@rchaput rchaput merged commit dcfe856 into master Jul 15, 2024
7 checks passed
@rchaput rchaput deleted the importlib branch July 15, 2024 12:32
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.

1 participant