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

[BUG] Fix importlib resources/metadata on older Python versions #154

Merged
merged 6 commits into from
Nov 19, 2022

Conversation

melroy89
Copy link
Collaborator

@melroy89 melroy89 commented Nov 19, 2022

Trying to fix #153...

  • Add importlib-metadata & importlib-resources as dependencies
  • Check on specific Python version regarding the importlib resources (python v3.10 or higher) in order to have files() working
  • importlib_metadata should now also work on Python version before 3.8
  • Remove obsolete MANIFEST.in file

@jayvdb
Copy link

jayvdb commented Nov 19, 2022

If you do this, you need to specify a minimum version of PyPI package importlib_resources as a dependency

@melroy89
Copy link
Collaborator Author

melroy89 commented Nov 19, 2022

I changed it a bit more. I added an explicit check for Python 3.10 and higher: https://github.com/fake-useragent/fake-useragent/pull/154/files#diff-eaceb65d44c0eb2ed1b5108e3e0863edd4c31e7d16d3f7ac5e041ae70b87ce8bR13

Also I added the dependency only for Python lower than 3.10:

https://github.com/fake-useragent/fake-useragent/pull/154/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R13

I also noticed that the unit tests are running much faster now. Most likely because it's actually using the local data as it should be across all Python versions 👍🏽 .

@melroy89 melroy89 changed the title [BUG] Fix importlib resources on older Python versions [BUG] Fix importlib resources/metadata on older Python versions Nov 19, 2022
@melroy89 melroy89 merged commit 99fdc0b into master Nov 19, 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.

browsers.json not loading on Python 3.7, 3.8 & 3.9
2 participants