Skip to content

Commit 1756020

Browse files
committed
use dynamic version in gino.__version__
1 parent 14b5766 commit 1756020

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GINO
88

99
.. image:: https://img.shields.io/github/workflow/status/python-gino/gino/test?label=test&logo=github
1010
:alt: GitHub Workflow Status
11-
:target: https://github.com/python-gino/gino/actions?query=workflow%3Apytest
11+
:target: https://github.com/python-gino/gino/actions?query=workflow%3Atest
1212

1313
.. image:: https://img.shields.io/codacy/coverage/b6a59cdf5ca64eab9104928d4f9bbb97?logo=codacy
1414
:alt: Codacy coverage
@@ -28,7 +28,7 @@ GINO
2828

2929

3030
GINO - GINO Is Not ORM - is a lightweight asynchronous ORM built on top of
31-
SQLAlchemy_ core for Python asyncio_. Now (early 2018) GINO supports only one
31+
SQLAlchemy_ core for Python asyncio_. Now (early 2020) GINO supports only one
3232
dialect asyncpg_.
3333

3434
* Free software: BSD license

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ python = "^3.5"
2727
asyncpg = ">=0.18,<1.0"
2828
SQLAlchemy = "^1.2"
2929
contextvars = { version = "^2.4", python = "<3.7" }
30+
importlib_metadata = { version = "^1.3.0", python = "<3.8" }
3031

3132
[tool.poetry.dev-dependencies]
3233
psycopg2-binary = "^2.8.4"

src/gino/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,16 @@ def create_engine(*args, **kwargs):
1111
return create_engine(*args, **kwargs)
1212

1313

14-
__version__ = "1.0.0-alpha"
14+
def get_version():
15+
try:
16+
from importlib.metadata import version
17+
except ImportError:
18+
from importlib_metadata import version
19+
return version("gino")
20+
21+
22+
# noinspection PyBroadException
23+
try:
24+
__version__ = get_version()
25+
except Exception:
26+
pass

0 commit comments

Comments
 (0)