From: Daniele Varrazzo Date: Mon, 8 Nov 2021 21:28:02 +0000 (+0100) Subject: Expose the C package version in the _cmodule module X-Git-Tag: 3.0.3~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c196a33de4bd5dda1623804cef08984ab1f8d34e;p=thirdparty%2Fpsycopg.git Expose the C package version in the _cmodule module "Expose" just to say: this interface remains internal. But it's handy for development and testing nonetheless. --- diff --git a/psycopg/psycopg/_cmodule.py b/psycopg/psycopg/_cmodule.py index 0ab4813d2..a553fcc41 100644 --- a/psycopg/psycopg/_cmodule.py +++ b/psycopg/psycopg/_cmodule.py @@ -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: