else:
from typing_extensions import LiteralString
+if sys.version_info < (3, 8):
+ import importlib_metadata as metadata
+else:
+ from importlib import metadata
+
__all__ = [
"Counter",
"Deque",
"cache",
"create_task",
"prod",
+ "metadata",
]
"""
psycopg distribution version file.
"""
+from ._compat import metadata
# Copyright (C) 2020 The Psycopg Team
# Use a versioning scheme as defined in
# https://www.python.org/dev/peps/pep-0440/
-# STOP AND READ! if you change:
-__version__ = "3.1.8.dev1"
-# also change:
-# - `docs/news.rst` to declare this as the current version or an unreleased one
-# - `psycopg_c/psycopg_c/version.py` to the same version.
+try:
+ __version__ = metadata.version("psycopg")
+except metadata.PackageNotFoundError:
+ __version__ = "0.0.0.0"
author = Daniele Varrazzo
author_email = daniele.varrazzo@gmail.com
license = GNU Lesser General Public License v3 (LGPLv3)
+version = 3.2.0.dev1
project_urls =
Homepage = https://psycopg.org/
backports.zoneinfo >= 0.2.0; python_version < "3.9"
typing-extensions >= 4.1
tzdata; sys_platform == "win32"
+ importlib-metadata >= 1.4; python_version < "3.8"
+
+[options.extras_require]
+c =
+ psycopg-c == 3.2.0.dev1
+binary =
+ psycopg-binary == 3.2.0.dev1
+pool =
+ psycopg-pool
+test =
+ mypy >= 0.990
+ pproxy >= 2.7
+ pytest >= 6.2.5
+ pytest-asyncio >= 0.17
+ pytest-cov >= 3.0
+ pytest-randomly >= 3.10
+dev =
+ black >= 22.3.0
+ dnspython >= 2.1
+ flake8 >= 4.0
+ mypy >= 0.990
+ types-setuptools >= 57.4
+ wheel >= 0.37
+docs =
+ Sphinx >= 5.0
+ furo == 2022.6.21
+ sphinx-autobuild >= 2021.3.14
+ sphinx-autodoc-typehints >= 1.12
[options.package_data]
psycopg = py.typed
# Copyright (C) 2020 The Psycopg Team
-import re
-import os
from setuptools import setup
-# Move to the directory of setup.py: executing this file from another location
-# (e.g. from the project root) will fail
-here = os.path.abspath(os.path.dirname(__file__))
-if os.path.abspath(os.getcwd()) != here:
- os.chdir(here)
-
-with open("psycopg/version.py") as f:
- data = f.read()
- m = re.search(r"""(?m)^__version__\s*=\s*['"]([^'"]+)['"]""", data)
- if not m:
- raise Exception(f"cannot find version in {f.name}")
- version = m.group(1)
-
-extras_require = {
- # Install the C extension module (requires dev tools)
- "c": [
- f"psycopg-c == {version}",
- ],
- # Install the stand-alone C extension module
- "binary": [
- f"psycopg-binary == {version}",
- ],
- # Install the connection pool
- "pool": [
- "psycopg-pool",
- ],
- # Requirements to run the test suite
- "test": [
- "mypy >= 0.990",
- "pproxy >= 2.7",
- "pytest >= 6.2.5",
- "pytest-asyncio >= 0.17",
- "pytest-cov >= 3.0",
- "pytest-randomly >= 3.10",
- ],
- # Requirements needed for development
- "dev": [
- "black >= 22.3.0",
- "dnspython >= 2.1",
- "flake8 >= 4.0",
- "mypy >= 0.990",
- "types-setuptools >= 57.4",
- "wheel >= 0.37",
- ],
- # Requirements needed to build the documentation
- "docs": [
- "Sphinx >= 5.0",
- "furo == 2022.6.21",
- "sphinx-autobuild >= 2021.3.14",
- "sphinx-autodoc-typehints >= 1.12",
- ],
-}
-
-setup(
- version=version,
- extras_require=extras_require,
-)
+setup()
version = m.group(1)
+
def get_config(what: str) -> str:
pg_config = "pg_config"
try: