-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from pkg_resources to importlib.metadata (#2155)
* Switch from pkg_resources to importlib.metadata importlib.metadata is a standard library replacement for pkg_resources, available starting with Python 3.8. It is faster than pkg_resources. This lets the plugin interface use it when available, i.e. on Python 3.8 and later. On earlier Python, it uses the importlib_metadata PyPI backport if available, and finally falls back on pkg_resources. setup.cfg gains an extra called plugins, which can allow a project to install "pygments[plugins]" in order to ensure that plugins support is present even if installed with older Python versions. Timings for lexing an empty file with a lexer from a random plugin: Before: real 0m0,238s user 0m0,210s sys 0m0,029s After: real 0m0,141s user 0m0,125s sys 0m0,017s Fixes #2116, #2126
- Loading branch information
Showing
3 changed files
with
65 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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