Skip to content

Commit 8d3acd2

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

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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, PackageNotFoundError
17+
except ImportError:
18+
from importlib_metadata import version, PackageNotFoundError
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)