]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Expose the C package version in the _cmodule module
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 8 Nov 2021 21:28:02 +0000 (22:28 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 8 Nov 2021 21:28:02 +0000 (22:28 +0100)
"Expose" just to say: this interface remains internal. But it's handy
for development and testing nonetheless.

psycopg/psycopg/_cmodule.py

index 0ab4813d2c1e3034e7a96d840383bfdbf8488f52..a553fcc4176bb5e7165724c166aa0ad5c0b751b1 100644 (file)
@@ -4,14 +4,20 @@ Simplify access to the _psycopg module
 
 # Copyright (C) 2021 The Psycopg Team
 
+from typing import Optional
+
 from . import pq
 
+__version__: Optional[str] = None
+
 # Note: "c" must the first attempt so that mypy associates the variable the
 # right module interface. It will not result Optional, but hey.
 if pq.__impl__ == "c":
     from psycopg_c import _psycopg
+    from psycopg_c import __version__  # noqa: F401
 elif pq.__impl__ == "binary":
     from psycopg_binary import _psycopg  # type: ignore
+    from psycopg_binary import __version__  # type: ignore  # noqa: F401
 elif pq.__impl__ == "python":
     _psycopg = None  # type: ignore
 else: