Skip to content

Prompt toolkit uses a very slow method to get the __version__ #2028

@joouha

Description

@joouha

I've been doing some profiling of the start-up time of my prompt_toolkit application, and I noticed that prompt_toolkit spends a significant chunk of it's import time using importlib.metadata to retrieve the version number from the package distribution:

Image

This seems unnecessary when the version number could simply be hard-coded in __init__.py, which would significantly reduce the time it takes to import prompt_toolkit.

Many modern packaging tools allow the version number to be dynamically sourced from __init__.py, rather than the other way round.

What are your thoughts about changing to a hard-coded version number?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions