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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

query blacksheep version at runtime #362

Closed
remdragon opened this issue May 17, 2023 · 2 comments
Closed

query blacksheep version at runtime #362

remdragon opened this issue May 17, 2023 · 2 comments

Comments

@remdragon
Copy link

馃殌 Feature Request

I was having a lot of trouble with 1.2.12 which was resolved by upgrading to 1.2.14.

I scoured the blacksheep source code but could not find a way to query for this information at runtime.

It would be nice if I could add some startup logic to my app to check for known issues, something like:

assert blacksheep.__version__ != ( 1, 2, 12 ), 'unsupported version of blacksheep, please run "pip install --upgrade blacksheep"'
@RobertoPrevato
Copy link
Member

For version 1 of the web framework, I recommend using built-in features to obtain the version at runtime.

Python 3.11.0 (main, Oct 30 2022, 14:13:55) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.get_distribution("blacksheep").version
'1.2.16'
>>> from importlib.metadata import version
>>> version("blacksheep")
'1.2.16'
import pkg_resources
pkg_resources.get_distribution("blacksheep").version
'1.2.16'

from importlib.metadata import version
version("blacksheep")
'1.2.16'

For version 2, I am considering to use the features from pyproject.toml and use a dynamic version.

@RobertoPrevato
Copy link
Member

Marked as completed, as the version for v1 can be obtained using the option described above, and v2 (currently still alpha) now uses a dynamic version.

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

No branches or pull requests

2 participants