]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Package renamed to psycopg
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 26 Jun 2021 03:37:53 +0000 (04:37 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 26 Jun 2021 22:44:14 +0000 (23:44 +0100)
Calling the package psycopg3 doesn't allow to apply semver.

188 files changed:
.github/workflows/tests.yml
.mypy.ini
README.rst
docs/Makefile
docs/advanced/adapt.rst
docs/advanced/async.rst
docs/advanced/copy.rst
docs/advanced/cursors.rst
docs/advanced/pool.rst
docs/advanced/prepare.rst
docs/advanced/rows.rst
docs/api/connections.rst
docs/api/cursors.rst
docs/api/errors.rst
docs/api/index.rst
docs/api/pool.rst
docs/api/pq.rst
docs/api/sql.rst
docs/api/types.rst
docs/basic/adapt.rst
docs/basic/index.rst
docs/basic/install.rst
docs/basic/params.rst
docs/basic/transactions.rst
docs/basic/usage.rst
docs/conf.py
docs/from_pg2.rst
docs/index.rst
docs/lib/pg3_docs.py
psycopg/.flake8 [moved from psycopg3/.flake8 with 60% similarity]
psycopg/.gitignore [moved from psycopg3/.gitignore with 100% similarity]
psycopg/LICENSE.txt [moved from psycopg3/LICENSE.txt with 100% similarity]
psycopg/README.rst [new file with mode: 0644]
psycopg/psycopg/__init__.py [moved from psycopg3/psycopg3/__init__.py with 96% similarity]
psycopg/psycopg/_column.py [moved from psycopg3/psycopg3/_column.py with 99% similarity]
psycopg/psycopg/_context.py [moved from psycopg3/psycopg3/_context.py with 100% similarity]
psycopg/psycopg/_enums.py [moved from psycopg3/psycopg3/_enums.py with 86% similarity]
psycopg/psycopg/_preparing.py [moved from psycopg3/psycopg3/_preparing.py with 100% similarity]
psycopg/psycopg/_queries.py [moved from psycopg3/psycopg3/_queries.py with 100% similarity]
psycopg/psycopg/_struct.py [moved from psycopg3/psycopg3/_struct.py with 100% similarity]
psycopg/psycopg/_transform.py [moved from psycopg3/psycopg3/_transform.py with 99% similarity]
psycopg/psycopg/_typeinfo.py [moved from psycopg3/psycopg3/_typeinfo.py with 98% similarity]
psycopg/psycopg/_tz.py [moved from psycopg3/psycopg3/_tz.py with 95% similarity]
psycopg/psycopg/adapt.py [moved from psycopg3/psycopg3/adapt.py with 96% similarity]
psycopg/psycopg/compat.py [moved from psycopg3/psycopg3/compat.py with 100% similarity]
psycopg/psycopg/connection.py [moved from psycopg3/psycopg3/connection.py with 99% similarity]
psycopg/psycopg/conninfo.py [moved from psycopg3/psycopg3/conninfo.py with 99% similarity]
psycopg/psycopg/copy.py [moved from psycopg3/psycopg3/copy.py with 98% similarity]
psycopg/psycopg/cursor.py [moved from psycopg3/psycopg3/cursor.py with 99% similarity]
psycopg/psycopg/dbapi20.py [moved from psycopg3/psycopg3/dbapi20.py with 98% similarity]
psycopg/psycopg/encodings.py [moved from psycopg3/psycopg3/encodings.py with 100% similarity]
psycopg/psycopg/errors.py [moved from psycopg3/psycopg3/errors.py with 98% similarity]
psycopg/psycopg/generators.py [moved from psycopg3/psycopg3/generators.py with 100% similarity]
psycopg/psycopg/oids.py [moved from psycopg3/psycopg3/oids.py with 100% similarity]
psycopg/psycopg/pool/__init__.py [moved from psycopg3/psycopg3/pool/__init__.py with 90% similarity]
psycopg/psycopg/pool/async_pool.py [moved from psycopg3/psycopg3/pool/async_pool.py with 99% similarity]
psycopg/psycopg/pool/base.py [moved from psycopg3/psycopg3/pool/base.py with 99% similarity]
psycopg/psycopg/pool/errors.py [moved from psycopg3/psycopg3/pool/errors.py with 81% similarity]
psycopg/psycopg/pool/pool.py [moved from psycopg3/psycopg3/pool/pool.py with 99% similarity]
psycopg/psycopg/pool/sched.py [moved from psycopg3/psycopg3/pool/sched.py with 100% similarity]
psycopg/psycopg/pq/__init__.py [moved from psycopg3/psycopg3/pq/__init__.py with 91% similarity]
psycopg/psycopg/pq/_enums.py [moved from psycopg3/psycopg3/pq/_enums.py with 92% similarity]
psycopg/psycopg/pq/_pq_ctypes.py [moved from psycopg3/psycopg3/pq/_pq_ctypes.py with 99% similarity]
psycopg/psycopg/pq/_pq_ctypes.pyi [moved from psycopg3/psycopg3/pq/_pq_ctypes.pyi with 99% similarity]
psycopg/psycopg/pq/misc.py [moved from psycopg3/psycopg3/pq/misc.py with 98% similarity]
psycopg/psycopg/pq/pq_ctypes.py [moved from psycopg3/psycopg3/pq/pq_ctypes.py with 98% similarity]
psycopg/psycopg/pq/proto.py [moved from psycopg3/psycopg3/pq/proto.py with 100% similarity]
psycopg/psycopg/proto.py [moved from psycopg3/psycopg3/proto.py with 100% similarity]
psycopg/psycopg/py.typed [moved from psycopg3/psycopg3/py.typed with 100% similarity]
psycopg/psycopg/rows.py [moved from psycopg3/psycopg3/rows.py with 95% similarity]
psycopg/psycopg/server_cursor.py [moved from psycopg3/psycopg3/server_cursor.py with 99% similarity]
psycopg/psycopg/sql.py [moved from psycopg3/psycopg3/sql.py with 98% similarity]
psycopg/psycopg/transaction.py [moved from psycopg3/psycopg3/transaction.py with 98% similarity]
psycopg/psycopg/types/__init__.py [moved from psycopg3/psycopg3/types/__init__.py with 97% similarity]
psycopg/psycopg/types/array.py [moved from psycopg3/psycopg3/types/array.py with 100% similarity]
psycopg/psycopg/types/bool.py [moved from psycopg3/psycopg3/types/bool.py with 100% similarity]
psycopg/psycopg/types/composite.py [moved from psycopg3/psycopg3/types/composite.py with 100% similarity]
psycopg/psycopg/types/datetime.py [moved from psycopg3/psycopg3/types/datetime.py with 100% similarity]
psycopg/psycopg/types/json.py [moved from psycopg3/psycopg3/types/json.py with 100% similarity]
psycopg/psycopg/types/net.py [moved from psycopg3/psycopg3/types/net.py with 100% similarity]
psycopg/psycopg/types/none.py [moved from psycopg3/psycopg3/types/none.py with 100% similarity]
psycopg/psycopg/types/numeric.py [moved from psycopg3/psycopg3/types/numeric.py with 100% similarity]
psycopg/psycopg/types/range.py [moved from psycopg3/psycopg3/types/range.py with 100% similarity]
psycopg/psycopg/types/string.py [moved from psycopg3/psycopg3/types/string.py with 100% similarity]
psycopg/psycopg/types/uuid.py [moved from psycopg3/psycopg3/types/uuid.py with 100% similarity]
psycopg/psycopg/version.py [moved from psycopg3/psycopg3/version.py with 67% similarity]
psycopg/psycopg/waiting.py [moved from psycopg3/psycopg3/waiting.py with 100% similarity]
psycopg/pyproject.toml [moved from psycopg3/pyproject.toml with 100% similarity]
psycopg/setup.cfg [moved from psycopg3/setup.cfg with 82% similarity]
psycopg/setup.py [moved from psycopg3/setup.py with 90% similarity]
psycopg/tox.ini [moved from psycopg3/tox.ini with 72% similarity]
psycopg3/README.rst [deleted file]
psycopg3_c/psycopg3_c/__init__.py [deleted file]
psycopg_c/.gitignore [moved from psycopg3_c/.gitignore with 100% similarity]
psycopg_c/LICENSE.txt [moved from psycopg3_c/LICENSE.txt with 100% similarity]
psycopg_c/README.rst [moved from psycopg3_c/README.rst with 71% similarity]
psycopg_c/psycopg_c/.gitignore [moved from psycopg3_c/psycopg3_c/.gitignore with 60% similarity]
psycopg_c/psycopg_c/__init__.py [new file with mode: 0644]
psycopg_c/psycopg_c/_psycopg.pyi [moved from psycopg3_c/psycopg3_c/_psycopg3.pyi with 88% similarity]
psycopg_c/psycopg_c/_psycopg.pyx [moved from psycopg3_c/psycopg3_c/_psycopg3.pyx with 52% similarity]
psycopg_c/psycopg_c/_psycopg/__init__.pxd [moved from psycopg3_c/psycopg3_c/_psycopg3/__init__.pxd with 64% similarity]
psycopg_c/psycopg_c/_psycopg/adapt.pyx [moved from psycopg3_c/psycopg3_c/_psycopg3/adapt.pyx with 94% similarity]
psycopg_c/psycopg_c/_psycopg/copy.pyx [moved from psycopg3_c/psycopg3_c/_psycopg3/copy.pyx with 99% similarity]
psycopg_c/psycopg_c/_psycopg/endian.pxd [moved from psycopg3_c/psycopg3_c/_psycopg3/endian.pxd with 100% similarity]
psycopg_c/psycopg_c/_psycopg/generators.pyx [moved from psycopg3_c/psycopg3_c/_psycopg3/generators.pyx with 96% similarity]
psycopg_c/psycopg_c/_psycopg/oids.pxd [moved from psycopg3_c/psycopg3_c/_psycopg3/oids.pxd with 100% similarity]
psycopg_c/psycopg_c/_psycopg/transform.pyx [moved from psycopg3_c/psycopg3_c/_psycopg3/transform.pyx with 97% similarity]
psycopg_c/psycopg_c/pq.pxd [moved from psycopg3_c/psycopg3_c/pq.pxd with 97% similarity]
psycopg_c/psycopg_c/pq.pyx [moved from psycopg3_c/psycopg3_c/pq.pyx with 69% similarity]
psycopg_c/psycopg_c/pq/__init__.pxd [moved from psycopg3_c/psycopg3_c/pq/__init__.pxd with 67% similarity]
psycopg_c/psycopg_c/pq/conninfo.pyx [moved from psycopg3_c/psycopg3_c/pq/conninfo.pyx with 95% similarity]
psycopg_c/psycopg_c/pq/escaping.pyx [moved from psycopg3_c/psycopg3_c/pq/escaping.pyx with 98% similarity]
psycopg_c/psycopg_c/pq/libpq.pxd [moved from psycopg3_c/psycopg3_c/pq/libpq.pxd with 99% similarity]
psycopg_c/psycopg_c/pq/pgcancel.pyx [moved from psycopg3_c/psycopg3_c/pq/pgcancel.pyx with 94% similarity]
psycopg_c/psycopg_c/pq/pgconn.pyx [moved from psycopg3_c/psycopg3_c/pq/pgconn.pyx with 98% similarity]
psycopg_c/psycopg_c/pq/pgresult.pyx [moved from psycopg3_c/psycopg3_c/pq/pgresult.pyx with 97% similarity]
psycopg_c/psycopg_c/pq/pqbuffer.pyx [moved from psycopg3_c/psycopg3_c/pq/pqbuffer.pyx with 100% similarity]
psycopg_c/psycopg_c/py.typed [moved from psycopg3_c/psycopg3_c/py.typed with 100% similarity]
psycopg_c/psycopg_c/types/bool.pyx [moved from psycopg3_c/psycopg3_c/types/bool.pyx with 100% similarity]
psycopg_c/psycopg_c/types/datetime.pyx [moved from psycopg3_c/psycopg3_c/types/datetime.pyx with 99% similarity]
psycopg_c/psycopg_c/types/numeric.pyx [moved from psycopg3_c/psycopg3_c/types/numeric.pyx with 99% similarity]
psycopg_c/psycopg_c/types/numutils.c [moved from psycopg3_c/psycopg3_c/types/numutils.c with 100% similarity]
psycopg_c/psycopg_c/types/string.pyx [moved from psycopg3_c/psycopg3_c/types/string.pyx with 97% similarity]
psycopg_c/psycopg_c/version.py [moved from psycopg3_c/psycopg3_c/version.py with 66% similarity]
psycopg_c/pyproject.toml [moved from psycopg3_c/pyproject.toml with 100% similarity]
psycopg_c/setup.cfg [moved from psycopg3_c/setup.cfg with 83% similarity]
psycopg_c/setup.py [moved from psycopg3_c/setup.py with 85% similarity]
psycopg_c/tox.ini [moved from psycopg3_c/tox.ini with 53% similarity]
tests/README.rst
tests/conftest.py
tests/fix_db.py
tests/fix_faker.py
tests/fix_pq.py
tests/fix_proxy.py
tests/pool/test_pool.py
tests/pool/test_pool_async.py
tests/pool/test_sched.py
tests/pool/test_sched_async.py
tests/pq/test_async.py
tests/pq/test_conninfo.py
tests/pq/test_copy.py
tests/pq/test_escaping.py
tests/pq/test_exec.py
tests/pq/test_misc.py
tests/pq/test_pgconn.py
tests/pq/test_pgresult.py
tests/pq/test_pq.py
tests/scripts/dectest.py
tests/scripts/spiketest.py
tests/test_adapt.py
tests/test_concurrency.py
tests/test_concurrency_async.py
tests/test_connection.py
tests/test_connection_async.py
tests/test_conninfo.py
tests/test_copy.py
tests/test_copy_async.py
tests/test_cursor.py
tests/test_cursor_async.py
tests/test_encodings.py
tests/test_errors.py
tests/test_module.py
tests/test_psycopg3_dbapi20.py
tests/test_query.py
tests/test_rows.py
tests/test_server_cursor.py
tests/test_server_cursor_async.py
tests/test_sql.py
tests/test_transaction.py
tests/test_transaction_async.py
tests/test_typing.py
tests/test_waiting.py
tests/types/test_array.py
tests/types/test_bool.py
tests/types/test_composite.py
tests/types/test_datetime.py
tests/types/test_json.py
tests/types/test_net.py
tests/types/test_none.py
tests/types/test_numeric.py
tests/types/test_range.py
tests/types/test_string.py
tests/types/test_uuid.py
tests/typing_example.py
tools/build_wheels.sh
tools/update_errors.py
tools/update_oids.py
tox.ini

index 0b4e43612229965730c725680f85b79dbd53a7aa..7a2a749d403b448afc2427ec31568a08132f8699 100644 (file)
@@ -23,11 +23,11 @@ jobs:
             postgres: 13
 
     env:
-      PSYCOPG3_IMPL: python
+      PSYCOPG_IMPL: python
       PGHOST: 127.0.0.1
       PGUSER: postgres
       PGPASSWORD: password
-      PSYCOPG3_TEST_DSN: "dbname=postgres"
+      PSYCOPG_TEST_DSN: "dbname=postgres"
 
     services:
       postgresql:
@@ -51,7 +51,7 @@ jobs:
       - name: Install tox
         run: pip install tox
       - name: Run tests
-        run: tox -c psycopg3 -e ${{ matrix.python }} -- --color yes
+        run: tox -c psycopg -e ${{ matrix.python }} -- --color yes
 
   c:
     name: C implementation
@@ -71,12 +71,12 @@ jobs:
             postgres: 10
 
     env:
-      PSYCOPG3_IMPL: c
+      PSYCOPG_IMPL: c
       PGHOST: 127.0.0.1
       PGUSER: postgres
       PGPASSWORD: password
-      PSYCOPG3_TEST_DSN: "dbname=postgres"
-      # skip tests failing on importing psycopg3_c.pq on subprocess
+      PSYCOPG_TEST_DSN: "dbname=postgres"
+      # skip tests failing on importing psycopg_c.pq on subprocess
       # they only fail on Travis, work ok locally under tox too.
       PYTEST_ADDOPTS: "-m 'not subprocess'"
 
@@ -102,4 +102,4 @@ jobs:
       - name: Install tox
         run: pip install tox
       - name: Run tests
-        run: tox -c psycopg3_c -e ${{ matrix.python }} -- --color yes
+        run: tox -c psycopg_c -e ${{ matrix.python }} -- --color yes
index 9314460ba8c8785151fec232ca7e5f7e196ed549..0e8978fb309a7f12cc7c94d5294b4f6f50fba63d 100644 (file)
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -1,9 +1,9 @@
 [mypy]
-files = psycopg3/psycopg3
+files = psycopg/psycopg
 warn_unused_ignores = True
 show_error_codes = True
 strict = True
-mypy_path = psycopg3_c
+mypy_path = psycopg_c
 
 [mypy-pytest]
 ignore_missing_imports = True
index e64d72403b3a4b918562e8e08cd9ddd85ee001bf..94e9ca618a5f742bca9bba63a731689c5436f4fc 100644 (file)
@@ -1,7 +1,7 @@
-psycopg3 -- PostgreSQL database adapter for Python
+Psycopg 3 -- PostgreSQL database adapter for Python
 ==================================================
 
-psycopg3 is a modern implementation of a PostgreSQL adapter for Python.
+Psycopg 3 is a modern implementation of a PostgreSQL adapter for Python.
 
 
 Installation
@@ -11,14 +11,14 @@ The library is still in a development stage and is not available on PyPI in
 the form of packages yet. You can install it directly `from the GitHub
 project`__::
 
-    $ pip install git+https://github.com/psycopg/psycopg3.git#subdirectory=psycopg3
+    $ pip install git+https://github.com/psycopg/psycopg.git#subdirectory=psycopg
     $ python3
-    >>> import psycopg3
+    >>> import psycopg
 
-.. __: https://github.com/psycopg/psycopg3
+.. __: https://github.com/psycopg/psycopg
 
 You are required to have the ``libpq``, the PostgreSQL client library, already
-installed in the system before using ``psycopg3``. On Debian system you can
+installed in the system before using ``psycopg``. On Debian system you can
 obtain it by running::
 
     sudo apt-get install libpq5
@@ -30,26 +30,25 @@ Please check your system's documentation for information about installing the
 Hacking
 -------
 
-In order to work on the ``psycopg3`` source code you should clone this
-repository::
+In order to work on the Psycopg source code you should clone this repository::
 
-    git clone https://github.com/psycopg/psycopg3.git
-    cd psycopg3
+    git clone https://github.com/psycopg/psycopg.git
+    cd psycopg
 
 Please note that the repository contains the source code of several Python
 packages: that's why you don't see a ``setup.py`` here. The packages may have
 different requirements:
 
-- The ``psycopg3`` directory contains the pure python implementation of
-  ``psycopg3``. The package has only a runtime dependency on the ``libpq``,
+- The ``psycopg`` directory contains the pure python implementation of
+  ``psycopg``. The package has only a runtime dependency on the ``libpq``,
   the PostgreSQL client library, which should have been already installed in
   your system.
 
-- The ``psycopg3_c`` directory contains an optimization module written in
+- The ``psycopg_c`` directory contains an optimization module written in
   C/Cython. In order to build it you will need a few development tools: please
   look at `Local installation`__ in the docs for the details.
 
-  .. __: https://www.psycopg.org/psycopg3/docs/install.html#local-installation
+  .. __: https://www.psycopg.org/psycopg/docs/install.html#local-installation
 
 You can create a local virtualenv and install there the packages `in
 development mode`__, together with their development and testing
@@ -57,8 +56,8 @@ requirements::
 
     python -m venv .venv
     source .venv/bin/activate
-    pip install -e ./psycopg3[dev,test]     # for the base Python package
-    pip install -e ./psycopg3_c             # for the C extension module
+    pip install -e ./psycopg[dev,test]     # for the base Python package
+    pip install -e ./psycopg_c             # for the C extension module
 
 .. __: https://pip.pypa.io/en/stable/reference/pip_install/#install-editable
 
@@ -69,10 +68,10 @@ Now hack away! You can use tox to validate the code::
 
 and to run the tests::
 
-    psql -c 'create database psycopg3_test'
-    export PSYCOPG3_TEST_DSN="dbname=psycopg3_test"
-    tox -c psycopg3 -s
-    tox -c psycopg3_c -s
+    psql -c 'create database psycopg_test'
+    export PSYCOPG_TEST_DSN="dbname=psycopg_test"
+    tox -c psycopg -s
+    tox -c psycopg_c -s
 
 Please look at the commands definitions in the ``tox.ini`` files if you want
 to run some of them interactively: the dependency should be already in your
index b409eea7bb7a9b54a9dc37b55a680145ede8d2af..7a9bfaaa64ce3061fbce32689056a3ab0c3e7e90 100644 (file)
@@ -14,7 +14,7 @@ help:
        @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) || true
 
 serve:
-       PSYCOPG3_IMPL=python sphinx-autobuild . _build/html/
+       PSYCOPG_IMPL=python sphinx-autobuild . _build/html/
 
 .PHONY: help serve env Makefile
 
@@ -22,7 +22,7 @@ env: .venv
 
 .venv: requirements.txt
        $(PYTHON) -m venv .venv
-       ./.venv/bin/pip install -e ../psycopg3
+       ./.venv/bin/pip install -e ../psycopg
        ./.venv/bin/pip install -r requirements.txt
 
 # Catch-all target: route all unknown targets to Sphinx using the new
index 3284824312bded12ece79c485744613fcf69ae58..6958132f7ed40b57e934c03b88d631442ecb9739 100644 (file)
@@ -1,11 +1,11 @@
-.. currentmodule:: psycopg3.adapt
+.. currentmodule:: psycopg.adapt
 
 .. _adaptation:
 
 Data adaptation configuration
 =============================
 
-The adaptation system is at the core of psycopg3 and allows to customise the
+The adaptation system is at the core of Psycopg and allows to customise the
 way Python objects are converted to PostgreSQL when a query is performed and
 how PostgreSQL values are converted to Python objects when query results are
 returned.
@@ -16,7 +16,7 @@ returned.
     described in this page is useful if you intend to *customise* the
     adaptation rules.
 
-- The `~psycopg3.types.TypeInfo` object allows to query type information from
+- The `~psycopg.types.TypeInfo` object allows to query type information from
   a database, which can be used by the adapters: for instance to make them
   able to decode arrays of base types or composite types.
 
@@ -30,11 +30,11 @@ returned.
   `!bytes` string from PostgreSQL and create a Python object.
 
 `!Dumper` and `!Loader` are abstract classes: concrete classes must implement
-the `~Dumper.dump()` and `~Loader.load()` methods. `!psycopg3` provides
+the `~Dumper.dump()` and `~Loader.load()` methods. Psycopg provides
 implementation for several builtin Python and PostgreSQL types.
 
 Psycopg provides adapters for several builtin types, which can be used as the
-base to build more complex ones: they all live in the `psycopg3.types`
+base to build more complex ones: they all live in the `psycopg.types`
 package.
 
 
@@ -42,7 +42,7 @@ Dumpers and loaders configuration
 ---------------------------------
 
 Dumpers and loaders can be registered on different scopes: globally, per
-`~psycopg3.Connection`, per `~psycopg3.Cursor`, so that adaptation rules can
+`~psycopg.Connection`, per `~psycopg.Cursor`, so that adaptation rules can
 be customised for specific needs within the same application: in order to do
 so you can use the *context* parameter of `Dumper.register()` and
 `Loader.register()`.
@@ -69,7 +69,7 @@ PostgreSQL but not handled by Python:
     >>> conn.execute("'infinity'::date").fetchone()
     Traceback (most recent call last):
        ...
-    psycopg3.DataError: Python date doesn't support years after 9999: got infinity
+    psycopg.DataError: Python date doesn't support years after 9999: got infinity
 
 One possibility would be to store Python's `datetime.date.max` to PostgreSQL
 infinity. For this, let's create a subclass for the dumper and the loader and
@@ -80,8 +80,8 @@ cursor):
 
     from datetime import date
 
-    from psycopg3.oids import postgres_types as builtins
-    from psycopg3.types.datetime import DateLoader, DateDumper
+    from psycopg.oids import postgres_types as builtins
+    from psycopg.types.datetime import DateLoader, DateDumper
 
     class InfDateDumper(DateDumper):
         def dump(self, obj):
@@ -113,7 +113,7 @@ cursor):
 Dumpers and loaders life cycle
 ------------------------------
 
-Registering dumpers and loaders will instruct `!psycopg3` to use them
+Registering dumpers and loaders will instruct `!psycopg` to use them
 in the queries to follow, in the context where they have been registered.
 
 When a query is performed on a `!Cursor`, a `Transformer` object is created
@@ -132,7 +132,7 @@ right instance.
   (for instance, a Python `int` might be better dumped as a PostgreSQL
   :sql:`integer`, :sql:`bigint`, :sql:`smallint` according to its value).
 
-- According to the placeholder used (``%s``, ``%b``, ``%t``), psycopg3 may
+- According to the placeholder used (``%s``, ``%b``, ``%t``), Psycopg may
   pick a binary or a text dumper. When using the ``%s`` "`~Format.AUTO`"
   format, if the same type has both a text and a binary dumper registered, the
   last one registered (using `Dumper.register()`) will be selected.
@@ -149,7 +149,7 @@ As a consequence it is possible to perform certain choices only once per query
 for each value to convert.
 
 Querying will fail if a Python object for which there isn't a `!Dumper`
-registered (for the right `~psycopg3.pq.Format`) is used as query parameter.
+registered (for the right `~psycopg.pq.Format`) is used as query parameter.
 If the query returns a data type whose OID doesn't have a `!Loader`, the
 value will be returned as a string (or bytes string for binary types).
 
@@ -180,7 +180,7 @@ Objects involved in types adaptation
     :param context: The context where the transformation is performed. If not
         specified the conversion might be inaccurate, for instance it will not
         be possible to know the connection encoding or the server date format.
-    :type context: `~psycopg3.Connection`, `~psycopg3.Cursor`, or `Transformer`
+    :type context: `~psycopg.Connection`, `~psycopg.Cursor`, or `Transformer`
 
     .. attribute:: format
         :type: pq.Format
@@ -203,7 +203,7 @@ Objects involved in types adaptation
 
         .. tip::
 
-            This method will be used by `~psycopg3.sql.Literal` to convert a
+            This method will be used by `~psycopg.sql.Literal` to convert a
             value client-side.
 
         This method only makes sense for text dumpers; the result of calling
@@ -230,7 +230,7 @@ Objects involved in types adaptation
         :type cls: `!type` or `!str`
         :param context: Where the dumper should be used. If `!None` the dumper
             will be used globally.
-        :type context: `~psycopg3.Connection`, `~psycopg3.Cursor`, or `Transformer`
+        :type context: `~psycopg.Connection`, `~psycopg.Cursor`, or `Transformer`
 
         If *cls* is specified as string it will be lazy-loaded, so that it
         will be possible to register it without importing it before. In this
@@ -248,7 +248,7 @@ Objects involved in types adaptation
     :param context: The context where the transformation is performed. If not
         specified the conversion might be inaccurate, for instance it will not
         be possible to know the connection encoding or the server date format.
-    :type context: `~psycopg3.Connection`, `~psycopg3.Cursor`, or `Transformer`
+    :type context: `~psycopg.Connection`, `~psycopg.Cursor`, or `Transformer`
 
     .. attribute:: format
         :type: Format
@@ -267,12 +267,12 @@ Objects involved in types adaptation
         :type oid: `!int`
         :param context: Where the loader should be used. If `!None` the loader
             will be used globally.
-        :type context: `~psycopg3.Connection`, `~psycopg3.Cursor`, or `Transformer`
+        :type context: `~psycopg.Connection`, `~psycopg.Cursor`, or `Transformer`
 
 
 .. autoclass:: Transformer(context=None)
 
     :param context: The context where the transformer should operate.
-    :type context: `~psycopg3.Connection`, `~psycopg3.Cursor`, or `Transformer`
+    :type context: `~psycopg.Connection`, `~psycopg.Cursor`, or `Transformer`
 
     TODO: finalise the interface of this object
index 86f21e12def9d683f11bb7511f0419839457cd87..c2ce6a84fafd36e6efba512ed95a37beef45483f 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index:: asyncio
 
@@ -7,7 +7,7 @@
 Async operations
 ================
 
-psycopg3 `~Connection` and `~Cursor` have counterparts `~AsyncConnection` and
+Psycopg `~Connection` and `~Cursor` have counterparts `~AsyncConnection` and
 `~AsyncCursor` supporting an `asyncio` interface.
 
 The design of the asynchronous objects is pretty much the same of the sync
@@ -16,7 +16,7 @@ here and there.
 
 .. code:: python
 
-    async with await psycopg3.AsyncConnection.connect(
+    async with await psycopg.AsyncConnection.connect(
             "dbname=test user=postgres") as aconn:
         async with aconn.cursor() as acur:
             await acur.execute(
@@ -41,7 +41,7 @@ context managers, so you can run:
 
 .. code:: python
 
-    with psycopg3.connect("dbname=test user=postgres") as conn:
+    with psycopg.connect("dbname=test user=postgres") as conn:
         with conn.cursor() as cur:
             cur.execute(...)
         # the cursor is closed upon leaving the context
@@ -59,7 +59,7 @@ two steps instead, as in
 
 .. code:: python
 
-    aconn = await psycopg3.AsyncConnection.connect():
+    aconn = await psycopg.AsyncConnection.connect():
     async with aconn:
         async with aconn.cursor() as cur:
             await cur.execute(...)
@@ -68,7 +68,7 @@ which can be condensed as:
 
 .. code:: python
 
-    async with await psycopg3.AsyncConnection.connect() as aconn:
+    async with await psycopg.AsyncConnection.connect() as aconn:
         async with aconn.cursor() as cur:
             await cur.execute(...)
 
@@ -119,8 +119,8 @@ the ``stop`` message is received.
 
 .. code:: python
 
-    import psycopg3
-    conn = psycopg3.connect("", autocommit=True)
+    import psycopg
+    conn = psycopg.connect("", autocommit=True)
     conn.cursor().execute("LISTEN mychan")
     gen = conn.notifies()
     for notify in gen:
@@ -205,7 +205,7 @@ something else to do too.
         # Activity detected. Is the connection still ok?
         try:
             conn.execute("select 1")
-        except psycopg3.OperationalError:
+        except psycopg.OperationalError:
             # You were disconnected: do something useful such as panicking
             logger.error("we lost our database!")
             sys.exit(1)
@@ -230,6 +230,6 @@ something similar using `~asyncio.loop.add_reader`:
         # Activity detected. Is the connection still ok?
         try:
             await conn.execute("select 1")
-        except psycopg3.OperationalError:
+        except psycopg.OperationalError:
             # Guess what happened
             ...
index c813298f9e4e1b3542884c951599aab09513f94c..7f0c52ed2f5d8ee2eec69b3df4d99f8f43640116 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index::
     pair: COPY; SQL command
@@ -8,7 +8,7 @@
 Using COPY TO and COPY FROM
 ===========================
 
-`psycopg3` allows to operate with `PostgreSQL COPY protocol`__. :sql:`COPY` is
+Psycopg allows to operate with `PostgreSQL COPY protocol`__. :sql:`COPY` is
 one of the most efficient ways to load data into the database (and to modify
 it, with some SQL creativity).
 
@@ -24,7 +24,7 @@ resulting `Copy` object in a ``with`` block:
         # pass data to the 'copy' object using write()/write_row()
 
 You can compose a COPY statement dynamically by using objects from the
-`psycopg3.sql` module:
+`psycopg.sql` module:
 
 .. code:: python
 
index def1dd4f6173e3db886f64391130ffbe6e6a179c..80b914a9b72786e2288c957864558a2094811837 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index::
     single: Cursor
@@ -8,7 +8,7 @@
 Cursor types
 ============
 
-`!psycopg3` can manage kinds of "cursors" which differ in where the state of a
+Psycopg can manage kinds of "cursors" which differ in where the state of a
 query being processed is stored: :ref:`client-side-cursors` and
 :ref:`server-side-cursors`.
 
@@ -20,7 +20,7 @@ query being processed is stored: :ref:`client-side-cursors` and
 Client-side cursors
 -------------------
 
-Client-side cursors are what `!psycopg3` uses in its normal querying process.
+Client-side cursors are what Psycopg uses in its normal querying process.
 They are implemented by the `Cursor` and `AsyncCursor` classes. In such
 querying pattern, after a cursor sends a query to the server (usually calling
 `~Cursor.execute()`), the server replies transferring to the client the whole
@@ -58,7 +58,7 @@ is possible to transmit only them.
 The downside is that the server needs to keep track of the partially
 processed results, so it uses more memory and resources on the server.
 
-`!psycopg3` allows the use of server-side cursors using the classes
+Psycopg allows the use of server-side cursors using the classes
 `ServerCursor` and `AsyncServerCursor`. They are usually created by passing
 the *name* parameter to the `~Connection.cursor()` method (in `!psycopg2` they
 are also called *named cursors*). The use of these classes is similar to their
@@ -88,7 +88,7 @@ result is needed.
 "Stealing" an existing cursor
 -----------------------------
 
-A `!psycopg3` `ServerCursor` can be also used to consume a cursor that the
+A Psycopg `ServerCursor` can be also used to consume a cursor that the
 :sql:`DECLARE` generated by its `~ServerCursor.execute()` method can produce.
 
 For instance if you have a PL/pgSQL function creating a cursor:
index 85f2529855d047fbb269d6ffa870a8536cce5ba0..dcdf046a754ffe9351682cd9ce2cf545dd26848e 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3.pool
+.. currentmodule:: psycopg.pool
 
 .. _connection-pools:
 
@@ -12,7 +12,7 @@ latency of a program operations.
 
 .. __: https://en.wikipedia.org/wiki/Connection_pool
 
-This page explains a few basic concepts of `!psycopg3` connection pool's
+This page explains a few basic concepts of Psycopg connection pool's
 behaviour. Please refer to the `ConnectionPool` object API for details about
 the pool operations.
 
@@ -76,7 +76,7 @@ has finished using it or because the pool is allowed to grow and a new
 connection is ready.
 
 The main way to use the pool is to obtain a connection using the
-`~ConnectionPool.connection()` context, which returns a `~psycopg3.Connection`
+`~ConnectionPool.connection()` context, which returns a `~psycopg.Connection`
 or subclass::
 
     with my_pool.connection() as conn:
index 3ef0c8f1b468f466d50f2501b485b235afe3cc66..9e4400c0551251f74669a4fb910d838a37c60f46 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index::
     single: Prepared statements
@@ -8,13 +8,13 @@
 Prepared statements
 ===================
 
-`!psycopg3` uses an automatic system to manage *prepared statements*. When a
+Psycopg uses an automatic system to manage *prepared statements*. When a
 query is prepared, its parsing and planning is stored in the server session,
 so that further executions of the same query on the same connection (even with
 different parameters) are optimised.
 
 A query is prepared automatically after it is executed more than
-`~Connection.prepare_threshold` times on a connection. `!psycopg3` will make
+`~Connection.prepare_threshold` times on a connection. `!psycopg` will make
 sure that no more than `~Connection.prepared_max` statements are planned: if
 further queries are executed, the least recently used ones are deallocated and
 the associated resources freed.
@@ -38,7 +38,7 @@ Statement preparation can be controlled in several ways:
     The `PREPARE`__ PostgreSQL documentation contains plenty of details about
     prepared statements in PostgreSQL.
 
-    Note however that `!psycopg3` doesn't use SQL statements such as
+    Note however that Psycopg doesn't use SQL statements such as
     :sql:`PREPARE` and :sql:`EXECUTE`, but protocol level commands such as the
     ones exposed by :pq:`PQsendPrepare`, :pq:`PQsendQueryPrepared`.
 
index f130b60974a24d7cfb5962b4deaf41afbc303d6e..6790f6d1a6d6c86253fc0cb65a66dbfee6996bc5 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index:: row factories
 
@@ -11,26 +11,26 @@ Cursor's `fetch*` methods return tuples of column values by default. This can
 be changed to adapt the needs of the programmer by using custom *row
 factories*.
 
-A row factory (formally implemented by the `~psycopg3.rows.RowFactory`
+A row factory (formally implemented by the `~psycopg.rows.RowFactory`
 protocol) is a callable that accepts a `Cursor` object and returns another
-callable (formally the `~psycopg3.rows.RowMaker` protocol) accepting a
+callable (formally the `~psycopg.rows.RowMaker` protocol) accepting a
 `values` tuple and returning a row in the desired form.
 
-.. autoclass:: psycopg3.rows.RowMaker()
+.. autoclass:: psycopg.rows.RowMaker()
 
    .. method:: __call__(values: Sequence[Any]) -> Row
 
         Convert a sequence of values from the database to a finished object.
 
 
-.. autoclass:: psycopg3.rows.RowFactory()
+.. autoclass:: psycopg.rows.RowFactory()
 
    .. method:: __call__(cursor: AnyCursor[Row]) -> RowMaker[Row]
 
         Inspect the result on a cursor and return a `RowMaker` to convert rows.
 
-        `!AnyCursor` may be either a `~psycopg3.Cursor` or an
-        `~psycopg3.AsyncCursor`.
+        `!AnyCursor` may be either a `~psycopg.Cursor` or an
+        `~psycopg.AsyncCursor`.
 
 
 `~RowFactory` objects can be implemented as a class, for instance:
@@ -38,7 +38,7 @@ callable (formally the `~psycopg3.rows.RowMaker` protocol) accepting a
 .. code:: python
 
    from typing import Any, Sequence
-   from psycopg3 import AnyCursor
+   from psycopg import AnyCursor
 
    class DictRowFactory:
        def __init__(self, cursor: AnyCursor[dict[str, Any]]):
@@ -67,7 +67,7 @@ These can then be used by specifying a `row_factory` argument in
 
 .. code:: python
 
-    conn = psycopg3.connect(row_factory=DictRowFactory)
+    conn = psycopg.connect(row_factory=DictRowFactory)
     cur = conn.execute("SELECT first_name, last_name, age FROM persons")
     person = cur.fetchone()
     print(f"{person['first_name']} {person['last_name']}")
@@ -80,9 +80,9 @@ passing another value at `Connection.cursor()`.
 Available row factories
 -----------------------
 
-The module `psycopg3.rows` provides the implementation for a few row factories:
+The module `psycopg.rows` provides the implementation for a few row factories:
 
-.. currentmodule:: psycopg3.rows
+.. currentmodule:: psycopg.rows
 
 .. autofunction:: tuple_row(cursor: AnyCursor[TupleRow])
 .. autodata:: TupleRow
@@ -96,7 +96,7 @@ The module `psycopg3.rows` provides the implementation for a few row factories:
 Use with a static analyzer
 --------------------------
 
-The `~psycopg3.Connection` and `~psycopg3.Cursor` classes are `generic
+The `~psycopg.Connection` and `~psycopg.Cursor` classes are `generic
 types`__: the parameter `!Row` is passed by the ``row_factory`` argument (of
 the `~Connection.connect()` and the `~Connection.cursor()` method) and it
 controls what type of record is returned by the fetch methods of the cursors.
@@ -109,18 +109,18 @@ such as Mypy_.
 
 .. code:: python
 
-   conn = psycopg3.connect()
-   # conn type is psycopg3.Connection[Tuple[Any, ...]]
+   conn = psycopg.connect()
+   # conn type is psycopg.Connection[Tuple[Any, ...]]
 
-   dconn = psycopg3.connect(row_factory=dict_row)
-   # dconn type is psycopg3.Connection[Dict[str, Any]]
+   dconn = psycopg.connect(row_factory=dict_row)
+   # dconn type is psycopg.Connection[Dict[str, Any]]
 
    cur = conn.cursor()
-   # cur type is psycopg3.Cursor[Tuple[Any, ...]]
+   # cur type is psycopg.Cursor[Tuple[Any, ...]]
 
    dcur = conn.cursor(row_factory=dict_row)
    dcur = dconn.cursor()
-   # dcur type is psycopg3.Cursor[Dict[str, Any]] in both cases
+   # dcur type is psycopg.Cursor[Dict[str, Any]] in both cases
 
    rec = cur.fetchone()
    # rec type is Optional[Tuple[Any, ...]]
@@ -148,7 +148,7 @@ any issue. Pydantic will also raise a runtime error in case the
     from datetime import date
     from typing import Any, Optional, Sequence
 
-    import psycopg3
+    import psycopg
     from pydantic import BaseModel
 
     class Person(BaseModel):
@@ -158,7 +158,7 @@ any issue. Pydantic will also raise a runtime error in case the
         dob: Optional[date]
 
     class PersonFactory:
-        def __init__(self, cur: psycopg3.AnyCursor[Person]):
+        def __init__(self, cur: psycopg.AnyCursor[Person]):
             assert cur.description
             self.fields = [c.name for c in cur.description]
 
@@ -166,7 +166,7 @@ any issue. Pydantic will also raise a runtime error in case the
             return Person(**dict(zip(self.fields, values)))
 
     def fetch_person(id: int) -> Person:
-        conn = psycopg3.connect()
+        conn = psycopg.connect()
         cur = conn.cursor(row_factory=PersonFactory)
         cur.execute(
             """
index d22fb5a9fa774f64eb4fd1669e62085dfc580a03..6f5abdf5337aab7282df627e6e2775684182d5bb 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 Connection classes
 ==================
@@ -40,13 +40,13 @@ The `!Connection` class
                            See `transactions` for details.
         :param row_factory: The row factory specifying what type of records
                             to create fetching data (default:
-                            `~psycopg3.rows.tuple_row()`). See
+                            `~psycopg.rows.tuple_row()`). See
                             :ref:`row-factories` for details.
 
         .. __: https://www.postgresql.org/docs/current/libpq-connect.html
             #LIBPQ-CONNSTRING
 
-        This method is also aliased as `psycopg3.connect()`.
+        This method is also aliased as `psycopg.connect()`.
 
         .. seealso::
 
@@ -193,7 +193,7 @@ The `!Connection` class
 
     .. automethod:: add_notice_handler
 
-        :param callback: a callable taking a `~psycopg3.errors.Diagnostic`
+        :param callback: a callable taking a `~psycopg.errors.Diagnostic`
             object containing all the details about the notice.
 
     .. automethod:: remove_notice_handler
@@ -285,7 +285,7 @@ Connection support objects
     .. autoattribute:: hostaddr
 
         Only available if the libpq used is at least from PostgreSQL 12.
-        Raise `~psycopg3.NotSupportedError` otherwise.
+        Raise `~psycopg.NotSupportedError` otherwise.
 
     .. autoattribute:: port
     .. autoattribute:: dbname
index 8fd26c8e039c28d2794c6d3c6de755b968136490..990c62e3eecf7c72f270b4a50bf3f24ac06dabfe 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 Cursor classes
 ==============
@@ -130,7 +130,7 @@ The `!Cursor` class
 
         The property affects the objects returned by the `fetchone()`,
         `fetchmany()`, `fetchall()` methods. The default
-        (`~psycopg3.rows.tuple_row`) returns a tuple for each record fetched.
+        (`~psycopg.rows.tuple_row`) returns a tuple for each record fetched.
 
         See :ref:`row-factories` for details.
 
@@ -140,7 +140,7 @@ The `!Cursor` class
     .. automethod:: nextset
     .. automethod:: scroll
     .. attribute:: pgresult
-        :type: Optional[psycopg3.pq.PGresult]
+        :type: Optional[psycopg.pq.PGresult]
 
         The result returned by the last query and currently exposed by the
         cursor, if available, else `!None`.
index e2aac74489bf2bf2900b4734b71ffabed455e832..815c7b20a114c98a99a6d9cc831b235e2e72746b 100644 (file)
@@ -4,7 +4,7 @@
 .. index::
     single: Error; Class
 
-.. module:: psycopg3
+.. module:: psycopg
 
 This module exposes objects to represent and examine database errors.
 
@@ -13,13 +13,13 @@ This module exposes objects to represent and examine database errors.
     .. autoattribute:: diag
 
 
-.. module:: psycopg3.errors
+.. module:: psycopg.errors
 
 .. autoclass:: Diagnostic()
 
     The object is returned by the `Error.diag` attribute and is passed to the
     callback functions registered with
-    `~psycopg3.Connection.add_notice_handler()`.
+    `~psycopg.Connection.add_notice_handler()`.
 
     All the information available from the :pq:`PQresultErrorField()` function
     are exposed as attributes by the object. For instance the `!severity`
@@ -54,7 +54,7 @@ This module exposes objects to represent and examine database errors.
         server versions.
 
 
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index::
     single: Exceptions; DB-API
@@ -64,7 +64,7 @@ This module exposes objects to represent and examine database errors.
 DB-API exceptions
 -----------------
 
-In compliance with the DB-API, all the exceptions raised by ``psycopg3``
+In compliance with the DB-API, all the exceptions raised by Psycopg
 derive from the following classes:
 
 .. parsed-literal::
@@ -81,8 +81,8 @@ derive from the following classes:
             \|__ `ProgrammingError`
             \|__ `NotSupportedError`
 
-These classes are also exposed both by the `!psycopg3` and the
-`!psycopg3.errors` module.
+These classes are also exposed both by the Psycopg and the
+`!psycopg.errors` module.
 
 .. autoexception:: Warning()
 .. autoexception:: InterfaceError()
@@ -95,7 +95,7 @@ These classes are also exposed both by the `!psycopg3` and the
 .. autoexception:: NotSupportedError()
 
 
-.. currentmodule:: psycopg3.errors
+.. currentmodule:: psycopg.errors
 
 .. index::
     single: Exceptions; PostgreSQL
@@ -110,7 +110,7 @@ client-side, such as connection failed) usually have a 5-letters error code
 called SQLSTATE (available in the `~Diagnostic.sqlstate` attribute of
 `Error.diag`).
 
-``psycopg3`` exposes a different class for each SQLSTATE value, allowing to
+Psycopg exposes a different class for each SQLSTATE value, allowing to
 write idiomatic error handling code according to specific conditions happening
 in the database:
 
@@ -118,7 +118,7 @@ in the database:
 
     try:
         cur.execute("LOCK TABLE mytable IN ACCESS EXCLUSIVE MODE NOWAIT")
-    except psycopg3.errors.LockNotAvailable:
+    except psycopg.errors.LockNotAvailable:
         locked = True
 
 The exception names are generated from the PostgreSQL source code and includes
@@ -143,7 +143,7 @@ exception <dbapi-exceptions>` and expose the `Error` interface.
 
         try:
             cur.execute("LOCK TABLE mytable IN ACCESS EXCLUSIVE MODE NOWAIT")
-        except psycopg3.errors.lookup("55P03"):
+        except psycopg.errors.lookup("55P03"):
             locked = True
 
 These are all the classes defined and the DBAPI exception they derive from:
index bff99ec29280237ff17f7fb2b8bd37771fc0aab0..8136c059faf5efe003496c0ad449f8cae2677c08 100644 (file)
@@ -1,5 +1,5 @@
-``psycopg3`` API
-================
+Psycopg 3 API
+=============
 
 .. toctree::
     :maxdepth: 1
index b4724f1563ac0426ce38ca9c27e869833df03db3..bf6451166d48ef19fab28285c8122901bb83c339 100644 (file)
@@ -4,7 +4,7 @@
 .. index::
     double: Connection; Pool
 
-.. module:: psycopg3.pool
+.. module:: psycopg.pool
 
 The package contains two connection pool implementations. A connection pool
 creates and maintains a limited amount of PostgreSQL connections and allows a
@@ -12,10 +12,10 @@ larger number of users to use them. See :ref:`connection-pools` for more
 details and usage pattern.
 
 There package implement two connection pools: `ConnectionPool` is a
-synchronous connection pool yielding `~psycopg3.Connection` objects and can be
+synchronous connection pool yielding `~psycopg.Connection` objects and can be
 used by multithread applications. `AsyncConnectionPool` has a similar
 interface, but with `asyncio` functions replacing blocking functions, and
-yields `~psycopg3.AsyncConnection` instances.
+yields `~psycopg.AsyncConnection` instances.
 
 The intended use (but not mandatory) is to create a single connection pool, as
 a global object exposed by a module in your application, and use the same
@@ -35,7 +35,7 @@ The `!ConnectionPool` class
    required.
 
    :param conninfo: The connection string. See
-                    `~psycopg3.Connection.connect()` for details.
+                    `~psycopg.Connection.connect()` for details.
    :type conninfo: `!str`
 
    :param min_size: The minimum number of connection the pool will hold. The
@@ -60,7 +60,7 @@ The `!ConnectionPool` class
 
    :param connection_class: The class of the connections to serve. It should
                             be a `!Connection` subclass.
-   :type connection_class: `!type`, default: `~psycopg3.Connection`
+   :type connection_class: `!type`, default: `~psycopg.Connection`
 
    :param configure: A callback to configure a connection after creation.
                      Useful, for instance, to configure its adapters. If the
@@ -179,15 +179,15 @@ The `!ConnectionPool` class
 
 .. autoclass:: PoolTimeout()
 
-   Subclass of `~psycopg3.OperationalError`
+   Subclass of `~psycopg.OperationalError`
 
 .. autoclass:: PoolClosed()
 
-   Subclass of `~psycopg3.OperationalError`
+   Subclass of `~psycopg.OperationalError`
 
 .. autoclass:: TooManyRequests()
 
-   Subclass of `~psycopg3.OperationalError`
+   Subclass of `~psycopg.OperationalError`
 
 
 The `!AsyncConnectionPool` class
@@ -207,7 +207,7 @@ listed here.
 
    :param connection_class: The class of the connections to serve. It should
                             be an `!AsyncConnection` subclass.
-   :type connection_class: `!type`, default: `~psycopg3.AsyncConnection`
+   :type connection_class: `!type`, default: `~psycopg.AsyncConnection`
 
    :param configure: A callback to configure a connection after creation.
    :type configure: `async Callable[[AsyncConnection], None]`
index f4b5942c06f919be9780b28a4e5cbef53adb3c1f..2d93f98948ce66453364b052d39f37413ce17594 100644 (file)
@@ -1,4 +1,4 @@
-.. _psycopg3.pq:
+.. _psycopg.pq:
 
 `pq` -- libpq wrapper module
 ============================
@@ -6,16 +6,16 @@
 .. index::
     single: libpq
 
-.. module:: psycopg3.pq
+.. module:: psycopg.pq
 
-``psycopg3`` is built around the libpq_, the PostgreSQL client library, which
+Psycopg is built around the libpq_, the PostgreSQL client library, which
 performs most of the network communications and returns query results in C
 structures.
 
 .. _libpq: https://www.postgresql.org/docs/current/libpq.html
 
 The low-level functions of the library are exposed by the objects in the
-`!psycopg3.pq` module.
+`!psycopg.pq` module.
 
 
 .. _pq-impl:
@@ -34,22 +34,22 @@ same interface. Current implementations are:
   in Cython_). It is much better performing than the ``python``
   implementation, however it requires development packages installed on the
   client machine. It can be installed using the ``c`` extra, i.e. running
-  ``pip install psycopg3[c]``.
+  ``pip install psycopg[c]``.
 
 - ``binary``: a pre-compiled C implementation, bundled with all the required
   libraries. It is the easiest option to deal with, fast to install and it
   should require no development tool or client library, however it may be not
   available for every platform. You can install it using the ``binary`` extra,
-  i.e. running ``pip install psycopg3[binary]``.
+  i.e. running ``pip install psycopg[binary]``.
 
 .. _Cython: https://cython.org/
 
-The implementation currently used is available in the `~psycopg3.pq.__impl__`
+The implementation currently used is available in the `~psycopg.pq.__impl__`
 module constant.
 
-At import, ``psycopg3`` will try to use the best implementation available and
+At import, Psycopg 3 will try to use the best implementation available and
 will fail if none is usable. You can force the use of a specific
-implementation by exporting the env var :envvar:`PSYCOPG3_IMPL`: importing the
+implementation by exporting the env var :envvar:`PSYCOPG_IMPL`: importing the
 library will fail if the requested implementation is not available.
 
 
@@ -59,7 +59,7 @@ Module content
 .. autodata:: __impl__
 
     The choice of implementation is automatic but can be forced setting the
-    :envvar:`PSYCOPG3_IMPL` env var.
+    :envvar:`PSYCOPG_IMPL` env var.
 
 
 .. autofunction:: version
index e9ade305fcda73688b9a51795d863b6717b1f9df..122c2c1ff081783f59adb2508b3021b0731b4369 100644 (file)
@@ -4,11 +4,11 @@
 .. index::
     double: Binding; Client-Side
 
-.. module:: psycopg3.sql
+.. module:: psycopg.sql
 
 The module contains objects and functions useful to generate SQL dynamically,
 in a convenient and safe way. SQL identifiers (e.g. names of tables and
-fields) cannot be passed to the `~psycopg3.Cursor.execute()` method like query
+fields) cannot be passed to the `~psycopg.Cursor.execute()` method like query
 arguments::
 
     # This will not work
@@ -27,9 +27,9 @@ instance::
 This sort of works, but it is an accident waiting to happen: the table name
 may be an invalid SQL literal and need quoting; even more serious is the
 security problem in case the table name comes from an untrusted source. The
-name should be escaped using `~psycopg3.pq.Escaping.escape_identifier()`::
+name should be escaped using `~psycopg.pq.Escaping.escape_identifier()`::
 
-    from psycopg3.pq import Escaping
+    from psycopg.pq import Escaping
 
     # This works, but it is not optimal
     table_name = 'my_table'
@@ -45,11 +45,11 @@ but will eventually crash in the presence of a table or field name with
 containing characters to escape, or will present a potentially exploitable
 weakness.
 
-The objects exposed by the `!psycopg3.sql` module allow generating SQL
+The objects exposed by the `!psycopg.sql` module allow generating SQL
 statements on the fly, separating clearly the variable parts of the statement
 from the query parameters::
 
-    from psycopg3 import sql
+    from psycopg import sql
 
     cur.execute(
         sql.SQL("insert into {} values (%s, %s)")
@@ -64,7 +64,7 @@ Usually you should express the template of your query as an `SQL` instance
 with ``{}``\-style placeholders and use `~SQL.format()` to merge the variable
 parts into them, all of which must be `Composable` subclasses. You can still
 have ``%s``\-style placeholders in your query and pass values to
-`~psycopg3.Cursor.execute()`: such value placeholders will be untouched by
+`~psycopg.Cursor.execute()`: such value placeholders will be untouched by
 `!format()`::
 
     query = sql.SQL("select {field} from {table} where {pkey} = %s").format(
@@ -73,8 +73,8 @@ have ``%s``\-style placeholders in your query and pass values to
         pkey=sql.Identifier('id'))
 
 The resulting object is meant to be passed directly to cursor methods such as
-`~psycopg3.Cursor.execute()`, `~psycopg3.Cursor.executemany()`,
-`~psycopg3.Cursor.copy()`, but can also be used to compose a query as a Python
+`~psycopg.Cursor.execute()`, `~psycopg.Cursor.executemany()`,
+`~psycopg.Cursor.copy()`, but can also be used to compose a query as a Python
 string, using the `~Composable.as_string()` method::
 
     cur.execute(query, (42,))
@@ -102,7 +102,7 @@ The `!sql` objects are in the following inheritance hierarchy:
 |   ``|__`` `SQL`: a literal snippet of an SQL query
 |   ``|__`` `Identifier`: a PostgreSQL identifier or dot-separated sequence of identifiers
 |   ``|__`` `Literal`: a value hardcoded into a query
-|   ``|__`` `Placeholder`: a `%s`\ -style placeholder whose value will be added later e.g. by `~psycopg3.Cursor.execute()`
+|   ``|__`` `Placeholder`: a `%s`\ -style placeholder whose value will be added later e.g. by `~psycopg.Cursor.execute()`
 |   ``|__`` `Composed`: a sequence of `!Composable` instances.
 
 
index c85ad4ee3b0582fb4704d7840554b0b37033f150..fca2e85e5857f1b567118743b0461741870a278a 100644 (file)
@@ -1,13 +1,13 @@
-.. currentmodule:: psycopg3.types
+.. currentmodule:: psycopg.types
 
-.. _psycopg3.types:
+.. _psycopg.types:
 
 `!types` -- types mapping and adaptation
 ========================================
 
-.. module:: psycopg3.types
+.. module:: psycopg.types
 
-The `!psycopg3.types` package exposes the concrete implementation of `Loader`
+The `!psycopg.types` package exposes the concrete implementation of `Loader`
 and `Dumper` to manage builtin objects, together with objects to describe
 PostgreSQL types and wrappers to help or customise the types conversion.
 
@@ -20,7 +20,7 @@ type, such as its name, oid and array oid. The class can be used to query a
 database for custom data types: this allows for instance to load automatically
 arrays of a custom type, once a loader for the base type has been registered.
 
-The `!TypeInfo` object doesn't instruct `!psycopg3` to convert a PostgreSQL
+The `!TypeInfo` object doesn't instruct Psycopg to convert a PostgreSQL
 type into a Python type: this is the role of a `Loader`. However it can extend
 the behaviour of the adapters: if you create a loader for `!MyType`, using
 `TypeInfo` you will be able to manage seamlessly arrays of `!MyType` or ranges
@@ -31,8 +31,8 @@ and composite types using it as a subtypes.
 
 .. code:: python
 
-    from psycopg3.adapt import Loader
-    from psycopg3.types import TypeInfo
+    from psycopg.adapt import Loader
+    from psycopg.types import TypeInfo
 
     t = TypeInfo.fetch(conn, "mytype")
     t.register(conn)
@@ -56,7 +56,7 @@ and composite types using it as a subtypes.
     .. automethod:: fetch_async
     .. automethod:: register
 
-        The *context* can be a `~psycopg3.Connection` or `~psycopg3.Cursor`.
+        The *context* can be a `~psycopg.Connection` or `~psycopg.Cursor`.
         Specifying no context will register the `!TypeInfo` globally.
 
         Registering the `TypeInfo` in a context allows the adapters of that
@@ -71,7 +71,7 @@ information from certain class of PostgreSQL types and to create more
 specialised adapters configurations.
 
 
-.. autoclass:: psycopg3.types.composite.CompositeInfo
+.. autoclass:: psycopg.types.composite.CompositeInfo
 
     .. automethod:: register
 
@@ -80,7 +80,7 @@ specialised adapters configurations.
         custom object if *factory* is specified.
 
 
-.. autoclass:: psycopg3.types.range.RangeInfo
+.. autoclass:: psycopg.types.range.RangeInfo
 
     .. automethod:: register
 
@@ -112,7 +112,7 @@ Objects wrappers
 JSON adapters
 -------------
 
-.. currentmodule:: psycopg3.types.json
+.. currentmodule:: psycopg.types.json
 
 .. autoclass:: Json
 .. autoclass:: Jsonb
@@ -133,13 +133,13 @@ Any object supported by the underlying `!dumps()` function can be wrapped.
 .. autoclass:: JsonbDumper
 .. autoclass:: JsonbBinaryDumper
 
-`~psycopg3.adapt.Dumper` subclasses using the function provided by
+`~psycopg.adapt.Dumper` subclasses using the function provided by
 `set_json_dumps()` function to serialize the Python object wrapped by
 `Json`/`Jsonb`.
 
 If you need to specify different `!dumps()` functions in different contexts
 you can subclass one/some of these functions to override the
-`~JsonDumper.get_dumps()` method and `~psycopg3.adapt.Dumper.register()` them
+`~JsonDumper.get_dumps()` method and `~psycopg.adapt.Dumper.register()` them
 on the right connection or cursor.
 
 .. autoclass:: JsonLoader
@@ -150,11 +150,11 @@ on the right connection or cursor.
 .. autoclass:: JsonbLoader
 .. autoclass:: JsonbBinaryLoader
 
-`~psycopg3.adapt.Loader` subclasses using the function provided by
+`~psycopg.adapt.Loader` subclasses using the function provided by
 `set_json_loads()` function to de-serialize :sql:`json`/:sql:`jsonb`
 PostgreSQL values to Python objects.
 
 If you need to specify different `!loads()` functions in different contexts
 you can subclass one/some of these functions to override the
-`~JsonLoader.get_loads()` method and `~psycopg3.adapt.Loader.register()` them
+`~JsonLoader.get_loads()` method and `~psycopg.adapt.Loader.register()` them
 on the right connection or cursor.
index ad4d6fc60eafba786ad967bb9e6a50f5d7e44ffc..e033e4d847316dfd161e0f722b3a5f23824838d2 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index::
     single: Adaptation
@@ -117,7 +117,7 @@ Python `int` values are converted to PostgreSQL :sql:`bigint` (a.k.a.
       # UndefinedFunction: operator does not exist: date + bigint
 
   In this case you should add an :sql:`::int` cast to your query or use the
-  `~psycopg3.types.Int4` wrapper::
+  `~psycopg.types.numeric.Int4` wrapper::
 
       cur.execute("select current_date + %s::int", [1])
 
@@ -164,7 +164,7 @@ such as :sql:`text` and :sql:`varchar` are converted back to Python `!str`:
 
 .. code:: python
 
-    conn = psycopg3.connect()
+    conn = psycopg.connect()
     conn.execute(
         "insert into strtest (id, data) values (%s, %s)",
         (1, "Crème Brûlée at 4.99€"))
@@ -254,30 +254,30 @@ time and more bandwidth. See :ref:`binary-data` for details.
 JSON adaptation
 ---------------
 
-`!psycopg3` can map between Python objects and PostgreSQL `json/jsonb
+Psycopg can map between Python objects and PostgreSQL `json/jsonb
 types`__, allowing to customise the load and dump function used.
 
 .. __: https://www.postgresql.org/docs/current/datatype-json.html
 
 Because several Python objects could be considered JSON (dicts, lists,
 scalars, even date/time if using a dumps function customised to use them),
-`!psycopg3` requires you to wrap what you want to dump as JSON into a wrapper:
-either `psycopg3.types.Json` or `~psycopg3.types.Jsonb`.
+Psycopg requires you to wrap what you want to dump as JSON into a wrapper:
+either `psycopg.types.json.Json` or `~psycopg.types.json.Jsonb`.
 
 .. code:: python
 
-    from psycopg3.types.json import Jsonb
+    from psycopg.types.json import Jsonb
 
     thing = {"foo": ["bar", 42]}
     conn.execute("insert into mytable values (%s)", [Jsonb(thing)])
 
-By default `!psycopg3` uses the standard library `json.dumps()`__ and
+By default Psycopg uses the standard library `json.dumps()`__ and
 `json.loads()`__ functions to serialize and de-serialize Python objects to
 JSON. If you want to customise globally how serialization happens, for
 instance changing serialization parameters or using a different JSON library,
 you can specify your own functions using the
-`psycopg3.types.json.set_json_dumps()` and
-`~psycopg3.types.json.set_json_loads()` functions.
+`psycopg.types.json.set_json_dumps()` and
+`~psycopg.types.json.set_json_loads()` functions.
 
 ..
     weird: intersphinx doesn't work
@@ -288,7 +288,7 @@ you can specify your own functions using the
 .. code:: python
 
     from functools import partial
-    from psycopg3.types.json import Jsonb, set_json_dumps, set_json_loads
+    from psycopg.types.json import Jsonb, set_json_dumps, set_json_loads
     import ujson
 
     # Use a faster dump function
index e753856429ccbf1f16718c19df292cef831d018e..7b0e7dd55b9c973513cd5aa74f06a3638cc549e7 100644 (file)
@@ -1,6 +1,6 @@
 
-Getting started with ``psycopg3``
-=================================
+Getting started with Psycopg 3
+==============================
 
 .. toctree::
     :maxdepth: 1
index 406678d89214806da107a8a5c22aa33be21d1769..ea8c2310801b6a3c4dc840d54d087a270b463cfd 100644 (file)
@@ -6,16 +6,16 @@ Installation
 Installing the development state
 --------------------------------
 
-``psycopg3`` packages have not been released yet, but you can try it out
+Psycopg 3 packages have not been released yet, but you can try it out
 already by installing it `from the GitHub project`__:
 
 .. code:: bash
 
-    $ pip install git+https://github.com/psycopg/psycopg3.git#subdirectory=psycopg3
+    $ pip install git+https://github.com/psycopg/psycopg.git#subdirectory=psycopg
     $ python3
-    >>> import psycopg3
+    >>> import psycopg
 
-.. __: https://github.com/psycopg/psycopg3
+.. __: https://github.com/psycopg/psycopg
 
 
 .. _binary-install:
@@ -25,21 +25,21 @@ Binary installation
 
 .. warning::
 
-    `!psycopg3` is still in a development phase: packages haven't been
+    Psycopg 3 is still in a development phase: packages haven't been
     released yet on PyPI.
 
     Please refer to `the README`__ for the current installation state, and
     please know that things may change.
 
-    .. __: https://github.com/psycopg/psycopg3#readme
+    .. __: https://github.com/psycopg/psycopg#readme
 
     The following is how it will be *supposed* to work, once it is released...
 
 
-The quickest way to start developing with psycopg3 is to install the binary
+The quickest way to start developing with Psycopg 3 is to install the binary
 packages by running::
 
-    pip install psycopg3[binary]
+    pip install psycopg[binary]
 
 This will install a self-contained package with all the libraries needed.
 
@@ -56,11 +56,11 @@ In these case you should proceed to a :ref:`local installation
 
 .. seealso::
 
-    Did ``psycopg3`` install ok? Great! You can now move on to the :ref:`basic
+    Did Psycopg 3 install ok? Great! You can now move on to the :ref:`basic
     module usage <module-usage>` to learn how it works.
 
     You can come back here if you the above method didn't work and you need a
-    way to install ``psycopg3`` past the basic one.
+    way to install Psycopg 3 past the basic one.
 
 
 .. _local-installation:
@@ -71,7 +71,7 @@ Local installation
 A "Local installation" means obtaining a performing and maintainable library.
 The library will include a performing C module and will be bound to the system
 libraries (``libpq``, ``libssl``...) so that system upgrade of libraries will
-upgrade the libraries used by ``psycopg3`` too.
+upgrade the libraries used by Psycopg 3 too.
 
 In order to perform a local installation you need some prerequisites:
 
@@ -86,7 +86,7 @@ try this and follow the `binary installation`_ instead.
 
 If your build prerequisites are in place you can run::
 
-    pip install psycopg3[c]
+    pip install psycopg[c]
 
 
 .. _pure-python-installation:
@@ -96,7 +96,7 @@ Pure Python installation
 
 If you simply install::
 
-    pip install psycopg3
+    pip install psycopg
 
 without ``[c]`` or ``[binary]`` extras you will obtain a pure Python
 implementation. This is particularly handy to debug and hack, but it still
@@ -114,8 +114,8 @@ installation`_.
 
 
 
-``psycopg3`` and the ``libpq``
-------------------------------
+Psycopg 3 and the ``libpq``
+---------------------------
 
 .. admonition:: TODO
 
index 5379ff6b4e6630573b77636e6fee86508499e13b..9f58caa73b079bcd28b3887f20b8697e21ba206a 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index::
     pair: Query; Parameters
@@ -100,7 +100,7 @@ query.
 - The variables placeholder *must always be a* ``%s``, even if a different
   placeholder (such as a ``%d`` for integers or ``%f`` for floats) may look
   more appropriate for the type. You may find other placeholders used in
-  `~psycopg3` queries (``%b`` and ``%t``) but they are not related to the
+  Psycopg queries (``%b`` and ``%t``) but they are not related to the
   type of the argument: see :ref:`binary-data` if you want to read more::
 
     cur.execute("INSERT INTO numbers VALUES (%d)", (10,))   # WRONG
@@ -109,7 +109,7 @@ query.
 - Only query values should be bound via this method: it shouldn't be used to
   merge table or field names to the query. If you need to generate SQL queries
   dynamically (for instance choosing a table name at runtime) you can use the
-  functionalities provided in the `psycopg3.sql` module::
+  functionalities provided in the `psycopg.sql` module::
 
     cur.execute("INSERT INTO %s VALUES (%s)", ('numbers', 10))  # WRONG
     cur.execute(                                                # correct
@@ -183,7 +183,7 @@ argument of the `Cursor.execute()` method::
 .. seealso::
 
     Now that you know how to pass parameters to queries, you can take a look
-    at :ref:`how psycopg3 converts data types <types-adaptation>`.
+    at :ref:`how Psycopg converts data types <types-adaptation>`.
 
 
 .. index::
@@ -195,11 +195,11 @@ Binary parameters and results
 -----------------------------
 
 PostgreSQL has two different ways to represent data type on the wire:
-`~psycopg3.pq.Format.TEXT`, always available, and
-`~psycopg3.pq.Format.BINARY`, available most of the times. Usually the binary
+`~psycopg.pq.Format.TEXT`, always available, and
+`~psycopg.pq.Format.BINARY`, available most of the times. Usually the binary
 format is more efficient to use.
 
-`~psycopg3` can support both the formats of each data type. Whenever a value
+Psycopg can support both the formats of each data type. Whenever a value
 is passed to a query using the normal ``%s`` placeholder, the best format
 available is chosen (often, but not always, the binary format is picked as the
 best choice).
@@ -207,14 +207,14 @@ best choice).
 If you have a reason to select explicitly the binary format or the text format
 for a value you can use respectively a ``%b`` placeholder or a ``%t``
 placeholder instead. `~Cursor.execute()` will fail if a
-`~psycopg3.adapt.Dumper` for the right parameter type and format is not
+`~psycopg.adapt.Dumper` for the right parameter type and format is not
 available.
 
 The same two formats, text or binary, are used by PostgreSQL to return data
 from a query to the client. Unlike with parameters, where you can choose the
 format value-by-value, all the columns returned by a query will have the same
 format. For each of the types returned by the query, a
-`~psycopg3.adapt.Loader` must be available, otherwise the data will be
+`~psycopg.adapt.Loader` must be available, otherwise the data will be
 returned as unparsed `!str` or buffer.
 
 .. warning::
@@ -222,7 +222,7 @@ returned as unparsed `!str` or buffer.
     Currently the default is to return values from database queries in textual
     type, for the simple reason that not all the PostgreSQL data types have a
     binary `!Loader` implemented. The plan is to support the binary format for
-    all PostgreSQL builtins before the first `psycopg3` released: TODO!
+    all PostgreSQL builtins before the first Psycopg 3 released: TODO!
 
 By default the data will be returned in text format. In order to return data
 in binary format you can create the cursor using `Connection.cursor`\
index e4205aac72c0b38ed52c2754ccecd8b0ab64824f..74efb1d329c6053dba1817b4ed46aee98e03cef8 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. index:: Transactions management
 .. index:: InFailedSqlTransaction
@@ -9,7 +9,7 @@
 Transaction management
 ======================
 
-`!psycopg3` has a behaviour that may result surprising compared to
+Psycopg has a behaviour that may result surprising compared to
 :program:`psql`: by default, any database operation will start a new
 transaction. As a consequence, changes made by any cursor of the connection
 will not be visible until `Connection.commit()` is called, and will be
@@ -34,7 +34,7 @@ Autocommit transactions
 -----------------------
 
 The manual commit requirement can be suspended using `~Connection.autocommit`,
-either as connection attribute or as `~psycopg3.Connection.connect()`
+either as connection attribute or as `~psycopg.Connection.connect()`
 parameter. This may be required to run operations that cannot be executed
 inside a transaction, such as :sql:`CREATE DATABASE`, :sql:`VACUUM`,
 :sql:`CALL` on `stored procedures`__ using transaction control.
@@ -130,7 +130,7 @@ but not entirely committed yet.
 
 .. code:: python
 
-    from psycopg3 import Rollback
+    from psycopg import Rollback
 
     with conn.transaction() as outer_tx:
         for command in commands():
index d2c29c04be6a4c268f7ce4bdedd178d9ce9bd7a1..cb5b36314a27292d33756b5f8bff13a7177e7166 100644 (file)
@@ -1,4 +1,4 @@
-.. currentmodule:: psycopg3
+.. currentmodule:: psycopg
 
 .. _module-usage:
 
@@ -15,8 +15,8 @@ the `DB-API`__ protocol. Other database adapters, such as the builtin
 
 .. _usage:
 
-Main objects in ``psycopg3``
-----------------------------
+Main objects in Psycopg 3
+-------------------------
 
 Here is an interactive session showing some of the basic commands:
 
@@ -24,10 +24,10 @@ Here is an interactive session showing some of the basic commands:
 
 .. code:: python
 
-    import psycopg3
+    import psycopg
 
     # Connect to an existing database
-    with psycopg3.connect("dbname=test user=postgres") as conn:
+    with psycopg.connect("dbname=test user=postgres") as conn:
 
         # Open a cursor to perform database operations
         with conn.cursor() as cur:
@@ -105,11 +105,11 @@ relate to each other:
 Connection context
 ------------------
 
-`!psycopg3` `Connection` can be used as a context manager:
+Psycopg 3 `Connection` can be used as a context manager:
 
 .. code:: python
 
-    with psycopg3.connect() as conn:
+    with psycopg.connect() as conn:
         ... # use the connection
 
     # the connection is now closed
index 1829a15ce2156edc5aad6b8d537419d779b2adcd..b4bd5f29a0ff6a9b28bbb3e10e026a894b6b824b 100644 (file)
@@ -23,7 +23,7 @@ sys.path.append(str(docs_dir / "lib"))
 
 # -- Project information -----------------------------------------------------
 
-project = "psycopg3"
+project = "psycopg"
 copyright = "2020-2021, Daniele Varrazzo and The Psycopg Team"
 author = "Daniele Varrazzo"
 release = "UNRELEASED"
index 394105b9c6f6f529abe8b5e26e54885e631a2f76..765d716389254f45fa3433fc58bf77ef201b26ce 100644 (file)
@@ -4,7 +4,7 @@
 Differences from ``psycopg2``
 =============================
 
-`!psycopg3` uses the common DBAPI structure of many other database adapter and
+Psycopg 3 uses the common DBAPI structure of many other database adapter and
 tries to behave as close as possible to `!psycopg2`. There are however a few
 differences to be aware of.
 
@@ -14,7 +14,7 @@ differences to be aware of.
 Server-side binding
 -------------------
 
-`!psycopg3` sends the query and the parameters to the server separately,
+Psycopg 3 sends the query and the parameters to the server separately,
 instead of merging them client-side. PostgreSQL may behave slightly
 differently in this case, usually throwing an error and suggesting to use an
 explicit cast.
@@ -34,17 +34,17 @@ explicit cast.
 PostgreSQL will also reject the execution of several queries at once
 (separated by semicolon), if they contain parameters. If parameters are used
 you should use distinct `execute()` calls; otherwise you may consider merging
-the query client-side, using `psycopg3.sql` module.
+the query client-side, using `psycopg.sql` module.
 
 Certain commands cannot be used with server-side binding, for instance
 :sql:`SET` or :sql:`NOTIFY`::
 
     >>> cur.execute("SET timezone TO %s", ["utc"])
     ...
-    psycopg3.errors.SyntaxError: syntax error at or near "$1"
+    psycopg.errors.SyntaxError: syntax error at or near "$1"
 
 Sometimes PostgreSQL offers an alternative (e.g. :sql:`SELECT set_config()`,
-:sql:`SELECT pg_notify()`). If no alternative exist you can use `psycopg3.sql`
+:sql:`SELECT pg_notify()`). If no alternative exist you can use `psycopg.sql`
 to compose the query client-side.
 
 You cannot use :sql:`IN %s` and pass a tuple, because `IN ()` is an SQL
@@ -75,7 +75,7 @@ Copy is no more file-based
 PostgreSQL :sql:`COPY`. The interface doesn't make easy to load
 dynamically-generated data to the database.
 
-There is now a single `~psycopg3.Cursor.copy()` method, which is similar to
+There is now a single `~psycopg.Cursor.copy()` method, which is similar to
 `!psycopg2` `!copy_expert()` in accepting a free-form :sql:`COPY` command and
 returns an object to read/write data, block-wise or record-wise. The different
 usage pattern also enables :sql:`COPY` to be used in async interactions.
@@ -103,12 +103,12 @@ resources, such as files.
 `cursor.callproc()` is not implemented. The method has a simplistic
 semantic which doesn't account for PostgreSQL positional parameters,
 procedures, set-returning functions. Use a normal
-`~psycopg3.Cursor.execute()` with :sql:`SELECT function_name(...)` or
+`~psycopg.Cursor.execute()` with :sql:`SELECT function_name(...)` or
 :sql:`CALL procedure_name(...)` instead.
 
 
-What's new in psycopg3
-----------------------
+What's new in Psycopg 3
+-----------------------
 
 .. admonition:: TODO
 
index d6f2132b3a831c83d828e1acf44f2dbf6f91a477..95ad1df4eaf9cd211880fdeeca7f4411b4c4e9d4 100644 (file)
@@ -2,11 +2,11 @@
 Psycopg 3 -- PostgreSQL database adapter for Python
 ===================================================
 
-`!psycopg3` is a newly designed PostgreSQL_ database adapter for the Python_
+Psycopg 3 is a newly designed PostgreSQL_ database adapter for the Python_
 programming language.
 
-`!psycopg3` presents a familiar interface for everyone who has used
-`!psycopg2` or any other `DB-API 2.0`__ database adapter, but allows to use
+Psycopg 3 presents a familiar interface for everyone who has used
+Psycopg 2 or any other `DB-API 2.0`__ database adapter, but allows to use
 more modern PostgreSQL and Python features, such as:
 
 - Strict Strong Typing
@@ -14,7 +14,7 @@ more modern PostgreSQL and Python features, such as:
 - :ref:`server-side parameters binding <server-side-binding>`
 - :ref:`binary communication <binary-data>`
 - :ref:`a great integration of the COPY support <copy>`
-- :ref:`direct access to the libpq functionalities <psycopg3.pq>`
+- :ref:`direct access to the libpq functionalities <psycopg.pq>`
 
 .. _Python: https://www.python.org/
 .. _PostgreSQL: https://www.postgresql.org/
index af1fd7097a1b948c95e876f5b026c651936aff7d..0d4ee927d45dd6bbcd544eeb63e9139e825f42a8 100644 (file)
@@ -35,9 +35,9 @@ def setup(app):
     app.connect("autodoc-process-signature", process_signature)
     app.connect("autodoc-before-process-signature", before_process_signature)
 
-    import psycopg3  # type: ignore
+    import psycopg  # type: ignore
 
-    recover_defined_module(psycopg3)
+    recover_defined_module(psycopg)
     monkeypatch_autodoc()
 
     # Disable warnings in sphinx_autodoc_typehints because it doesn't seem that
@@ -100,7 +100,7 @@ def monkeypatch_autodoc():
         Replace a docstring such as::
 
             .. py:attribute:: ConnectionInfo.dbname
-               :module: psycopg3
+               :module: psycopg
 
                The database name of the connection.
 
@@ -110,7 +110,7 @@ def monkeypatch_autodoc():
 
             .. py:attribute:: ConnectionInfo.dbname
                :type: str
-               :module: psycopg3
+               :module: psycopg
 
                The database name of the connection.
 
@@ -160,9 +160,9 @@ def unrest(s):
     s = re.sub(r":[^`]*:`~?([^`]*)`", r"\1", s)  # drop role
     s = re.sub(r"\\(.)", r"\1", s)  # drop escape
 
-    # note that ~psycopg3.pq.ConnStatus is converted to pq.ConnStatus
+    # note that ~psycopg.pq.ConnStatus is converted to pq.ConnStatus
     # which should be interpreted well if currentmodule is set ok.
-    s = re.sub(r"(?:typing|psycopg3)\.", "", s)  # drop unneeded modules
+    s = re.sub(r"(?:typing|psycopg)\.", "", s)  # drop unneeded modules
     s = re.sub(r"~", "", s)  # drop the tilde
 
     return s
similarity index 60%
rename from psycopg3/.flake8
rename to psycopg/.flake8
index ebb4945dd2a4aa86c11aa9f9d5637a6c11b493a5..325383773db8d326b3924706afbd6bf19e99e652 100644 (file)
@@ -1,5 +1,5 @@
 # Used for Vim ALE integration, which doesn't honur the top-level config file
 [flake8]
 per-file-ignores =
-    psycopg3/__init__.py: F401
-    psycopg3/types/__init__.py: F401
+    psycopg/__init__.py: F401
+    psycopg/types/__init__.py: F401
similarity index 100%
rename from psycopg3/.gitignore
rename to psycopg/.gitignore
similarity index 100%
rename from psycopg3/LICENSE.txt
rename to psycopg/LICENSE.txt
diff --git a/psycopg/README.rst b/psycopg/README.rst
new file mode 100644 (file)
index 0000000..7b44295
--- /dev/null
@@ -0,0 +1,17 @@
+Psycopg 3: PostgreSQL database adapter for Python
+=================================================
+
+This distribution contains the pure Python package ``psycopg``.
+
+Installation::
+
+    pip install psycopg
+
+Even if the package is pure Python, the PostgreSQL client library libpq must
+be available in the system.
+
+Please read `the project readme`__ for more details.
+
+.. __: https://github.com/psycopg/psycopg#readme
+
+Copyright (C) 2020-2021 The Psycopg Team
similarity index 96%
rename from psycopg3/psycopg3/__init__.py
rename to psycopg/psycopg/__init__.py
index 4d5cc8846c9ce555913f29b80d828ffcd19845b4..0b81125bc30d87467472fabf36343ff7643bef53 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 -- PostgreSQL database adapter for Python
+psycopg -- PostgreSQL database adapter for Python
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -28,7 +28,7 @@ from .dbapi20 import Timestamp, TimestampFromTicks
 from .version import __version__
 
 # Set the logger to a quiet default, can be enabled if needed
-logger = logging.getLogger("psycopg3")
+logger = logging.getLogger("psycopg")
 if logger.level == logging.NOTSET:
     logger.setLevel(logging.WARNING)
 
similarity index 99%
rename from psycopg3/psycopg3/_column.py
rename to psycopg/psycopg/_column.py
index e16ade777ac2312077d1af9b8e227a767d019e9a..e59831538f5a84b701c4e8d83db156edaba8aeaf 100644 (file)
@@ -21,7 +21,7 @@ class ColumnData(NamedTuple):
 
 class Column(Sequence[Any]):
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(self, cursor: "AnyCursor[Any]", index: int):
         res = cursor.pgresult
similarity index 86%
rename from psycopg3/psycopg3/_enums.py
rename to psycopg/psycopg/_enums.py
index 8c608efbcdbb604cffc5c42f6b6242deb958c10d..d005202953def4c6631305f8c565fddce1d2c523 100644 (file)
@@ -1,5 +1,5 @@
 """
-Enum values for psycopg3
+Enum values for psycopg
 
 These values are defined by us and are not necessarily dependent on
 libpq-defined enums.
@@ -16,11 +16,11 @@ class Format(str, Enum):
     """
     Enum representing the format wanted for a query argument.
 
-    The value `AUTO` allows psycopg3 to choose the best value for a certain
+    The value `AUTO` allows psycopg to choose the best value for a certain
     value.
     """
 
-    __module__ = "psycopg3.adapt"
+    __module__ = "psycopg.adapt"
 
     AUTO = "s"
     """Automatically chosen (``%s`` placeholder)."""
similarity index 99%
rename from psycopg3/psycopg3/_transform.py
rename to psycopg/psycopg/_transform.py
index f6ac9c0e16d78bfd6de28cc938f51e4794db2a63..f9c5e58c57db993c75bfcb85cb32fa71d90dfdd1 100644 (file)
@@ -36,7 +36,7 @@ class Transformer(AdaptContext):
     state so adapting several values of the same type can be optimised.
     """
 
-    __module__ = "psycopg3.adapt"
+    __module__ = "psycopg.adapt"
     _adapters: "AdaptersMap"
     _pgresult: Optional["PGresult"] = None
 
similarity index 98%
rename from psycopg3/psycopg3/_typeinfo.py
rename to psycopg/psycopg/_typeinfo.py
index 8743d90f5879388a6566a31f9f4f734e95fa86c5..e1a18cb308a155d12d7f1f606403bcc817fce7ee 100644 (file)
@@ -31,7 +31,7 @@ class TypeInfo:
     - configure a composite type adaptation using `register()`
     """
 
-    __module__ = "psycopg3.types"
+    __module__ = "psycopg.types"
 
     def __init__(
         self,
@@ -145,7 +145,7 @@ order by t.oid
 class RangeInfo(TypeInfo):
     """Manage information about a range type."""
 
-    __module__ = "psycopg3.types"
+    __module__ = "psycopg.types.range"
 
     def __init__(self, name: str, oid: int, array_oid: int, subtype_oid: int):
         super().__init__(name, oid, array_oid)
@@ -173,7 +173,7 @@ where t.oid = %(name)s::regtype
 class CompositeInfo(TypeInfo):
     """Manage information about a composite type."""
 
-    __module__ = "psycopg3.types"
+    __module__ = "psycopg.types.composite"
 
     def __init__(
         self,
similarity index 95%
rename from psycopg3/psycopg3/_tz.py
rename to psycopg/psycopg/_tz.py
index 743761d827642cc90325b551d0aaec3e17e0fa5a..5b34203ad4bd3ea79547e6d919f4a09540e3ad89 100644 (file)
@@ -11,7 +11,7 @@ from datetime import timezone, tzinfo
 from .compat import ZoneInfo
 from .pq.proto import PGconn
 
-logger = logging.getLogger("psycopg3")
+logger = logging.getLogger("psycopg")
 
 _timezones: Dict[Union[None, bytes], tzinfo] = {
     None: timezone.utc,
similarity index 96%
rename from psycopg3/psycopg3/adapt.py
rename to psycopg/psycopg/adapt.py
index 360201d20189b9fb27d1a592c6a86a4df5742fb2..06b404ba80cf52c6ca465be281b41c69359b953a 100644 (file)
@@ -269,13 +269,13 @@ class AdaptersMap(AdaptContext):
         except KeyError:
             pass
 
-        # Check if the class comes from psycopg3.types and there is a class
-        # with the same name in psycopg3_c._psycopg3.
-        from psycopg3 import types
-        from psycopg3_c import _psycopg3
+        # Check if the class comes from psycopg.types and there is a class
+        # with the same name in psycopg_c._psycopg.
+        from psycopg import types
+        from psycopg_c import _psycopg
 
         if cls.__module__.startswith(types.__name__):
-            new = cast(Type[RV], getattr(_psycopg3, cls.__name__, None))
+            new = cast(Type[RV], getattr(_psycopg, cls.__name__, None))
             if new:
                 self._optimised[cls] = new
                 return new
@@ -293,9 +293,9 @@ Transformer: Type[proto.Transformer]
 
 # Override it with fast object if available
 if pq.__impl__ == "c":
-    from psycopg3_c import _psycopg3
+    from psycopg_c import _psycopg
 
-    Transformer = _psycopg3.Transformer
+    Transformer = _psycopg.Transformer
 else:
     from . import _transform
 
similarity index 99%
rename from psycopg3/psycopg3/connection.py
rename to psycopg/psycopg/connection.py
index 821ed6b5d2fa35959e7b575509aba46921f55c90..906b5fdeb4ffd0ca2ac491e7dabf5d8b7ba113c4 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 connection objects
+psycopg connection objects
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -34,7 +34,7 @@ from ._preparing import PrepareManager
 from .transaction import Transaction, AsyncTransaction
 from .server_cursor import ServerCursor, AsyncServerCursor
 
-logger = logging.getLogger("psycopg3")
+logger = logging.getLogger("psycopg")
 
 connect: Callable[[str], PQGenConn["PGconn"]]
 execute: Callable[["PGconn"], PQGen[List["PGresult"]]]
@@ -48,10 +48,10 @@ if TYPE_CHECKING:
     from .pool.base import BasePool
 
 if pq.__impl__ == "c":
-    from psycopg3_c import _psycopg3
+    from psycopg_c import _psycopg
 
-    connect = _psycopg3.connect
-    execute = _psycopg3.execute
+    connect = _psycopg.connect
+    execute = _psycopg.execute
 
 else:
     from . import generators
@@ -73,7 +73,7 @@ class Notify(NamedTuple):
     """The PID of the backend process which sent the notification."""
 
 
-Notify.__module__ = "psycopg3"
+Notify.__module__ = "psycopg"
 
 NoticeHandler = Callable[[e.Diagnostic], None]
 NotifyHandler = Callable[[Notify], None]
@@ -443,7 +443,7 @@ class Connection(BaseConnection[Row]):
     Wrapper for a connection to the database.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(self, pgconn: "PGconn", row_factory: RowFactory[Row]):
         super().__init__(pgconn, row_factory)
@@ -656,7 +656,7 @@ class AsyncConnection(BaseConnection[Row]):
     Asynchronous wrapper for a connection to the database.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(self, pgconn: "PGconn", row_factory: RowFactory[Row]):
         super().__init__(pgconn, row_factory)
similarity index 99%
rename from psycopg3/psycopg3/conninfo.py
rename to psycopg/psycopg/conninfo.py
index 7a15bb4c70edd27bd79d2a071db01531d79ac709..469117dde25de2f4d1819646a57fdbf6b28493c9 100644 (file)
@@ -114,7 +114,7 @@ def _conninfo_connect_timeout(
 class ConnectionInfo:
     """Allow access to information about the connection."""
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(self, pgconn: pq.proto.PGconn):
         self.pgconn = pgconn
similarity index 98%
rename from psycopg3/psycopg3/copy.py
rename to psycopg/psycopg/copy.py
index a0e809c550b9289e9f9b31dfbacb33d083e6cf28..f34868edec670b544a8cdf411e2c0090a95a2ada 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 copy support
+psycopg copy support
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -151,7 +151,7 @@ class BaseCopy(Generic[ConnectionType]):
 class Copy(BaseCopy["Connection[Any]"]):
     """Manage a :sql:`COPY` operation."""
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(self, cursor: "Cursor[Any]"):
         super().__init__(cursor)
@@ -283,7 +283,7 @@ class Copy(BaseCopy["Connection[Any]"]):
 class AsyncCopy(BaseCopy["AsyncConnection[Any]"]):
     """Manage an asynchronous :sql:`COPY` operation."""
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(self, cursor: "AsyncCursor[Any]"):
         super().__init__(cursor)
@@ -640,12 +640,12 @@ def _load_sub(
 
 # Override functions with fast versions if available
 if pq.__impl__ == "c":
-    from psycopg3_c import _psycopg3
+    from psycopg_c import _psycopg
 
-    format_row_text = _psycopg3.format_row_text
-    format_row_binary = _psycopg3.format_row_binary
-    parse_row_text = _psycopg3.parse_row_text
-    parse_row_binary = _psycopg3.parse_row_binary
+    format_row_text = _psycopg.format_row_text
+    format_row_binary = _psycopg.format_row_binary
+    parse_row_text = _psycopg.parse_row_text
+    parse_row_binary = _psycopg.parse_row_binary
 
 else:
     format_row_text = _format_row_text
similarity index 99%
rename from psycopg3/psycopg3/cursor.py
rename to psycopg/psycopg/cursor.py
index 55c6ad10349d25f1c374d7958baa0c9330cde80e..0fd8a05738da516c0411d95318a97cbf7581fa89 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 cursor objects
+psycopg cursor objects
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -33,9 +33,9 @@ if TYPE_CHECKING:
 execute: Callable[["PGconn"], PQGen[List["PGresult"]]]
 
 if pq.__impl__ == "c":
-    from psycopg3_c import _psycopg3
+    from psycopg_c import _psycopg
 
-    execute = _psycopg3.execute
+    execute = _psycopg.execute
 
 else:
     execute = generators.execute
@@ -475,7 +475,7 @@ AnyCursor = BaseCursor[Any, Row]
 
 
 class Cursor(BaseCursor["Connection[Any]", Row]):
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
     __slots__ = ()
 
     def __enter__(self) -> "Cursor[Row]":
@@ -626,7 +626,7 @@ class Cursor(BaseCursor["Connection[Any]", Row]):
 
 
 class AsyncCursor(BaseCursor["AsyncConnection[Any]", Row]):
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
     __slots__ = ()
 
     async def __aenter__(self) -> "AsyncCursor[Row]":
similarity index 98%
rename from psycopg3/psycopg3/dbapi20.py
rename to psycopg/psycopg/dbapi20.py
index 5450c7780c2eb92e0071a35c8925a4590646c221..44e57af1fe0342b2d0f4ec47981a35d22a38d6ab 100644 (file)
@@ -21,7 +21,7 @@ class DBAPITypeObject:
         self.values = tuple(builtins[n].oid for n in type_names)
 
     def __repr__(self) -> str:
-        return f"psycopg3.{self.name}"
+        return f"psycopg.{self.name}"
 
     def __eq__(self, other: Any) -> bool:
         if isinstance(other, int):
similarity index 98%
rename from psycopg3/psycopg3/errors.py
rename to psycopg/psycopg/errors.py
index 5e170d5187cd7ca9dd4cc5689f41f0c002b76f44..80e36c5b66ef4a1bdfe65335ce0f03d9a09222cd 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 exceptions
+psycopg exceptions
 
 DBAPI-defined Exceptions are defined in the following hierarchy::
 
@@ -20,18 +20,18 @@ DBAPI-defined Exceptions are defined in the following hierarchy::
 
 from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Type, Union
 from typing import cast
-from psycopg3.pq.proto import PGresult
-from psycopg3.pq._enums import DiagnosticField
+from psycopg.pq.proto import PGresult
+from psycopg.pq._enums import DiagnosticField
 
 
 class Warning(Exception):
     """
     Exception raised for important warnings.
 
-    Defined for DBAPI compatibility, but never raised by ``psycopg3``.
+    Defined for DBAPI compatibility, but never raised by ``psycopg``.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 ErrorInfo = Union[None, PGresult, Dict[int, Optional[bytes]]]
@@ -39,7 +39,7 @@ ErrorInfo = Union[None, PGresult, Dict[int, Optional[bytes]]]
 
 class Error(Exception):
     """
-    Base exception for all the errors psycopg3 will raise.
+    Base exception for all the errors psycopg will raise.
 
     Exception that is the base class of all other error exceptions. You can
     use this to catch all errors with one single `!except` statement.
@@ -47,7 +47,7 @@ class Error(Exception):
     This exception is guaranteed to be picklable.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(
         self,
@@ -91,7 +91,7 @@ class InterfaceError(Error):
     An error related to the database interface rather than the database itself.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class DatabaseError(Error):
@@ -99,7 +99,7 @@ class DatabaseError(Error):
     Exception raised for errors that are related to the database.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class DataError(DatabaseError):
@@ -109,7 +109,7 @@ class DataError(DatabaseError):
     Examples may be division by zero, numeric value out of range, etc.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class OperationalError(DatabaseError):
@@ -122,7 +122,7 @@ class OperationalError(DatabaseError):
     during processing, etc.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class IntegrityError(DatabaseError):
@@ -132,7 +132,7 @@ class IntegrityError(DatabaseError):
     An example may be a foreign key check failed.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class InternalError(DatabaseError):
@@ -143,7 +143,7 @@ class InternalError(DatabaseError):
     of sync, etc.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class ProgrammingError(DatabaseError):
@@ -154,7 +154,7 @@ class ProgrammingError(DatabaseError):
     statement, wrong number of parameters specified, etc.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class NotSupportedError(DatabaseError):
@@ -162,7 +162,7 @@ class NotSupportedError(DatabaseError):
     A method or database API was used which is not supported by the database,
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
 
 class Diagnostic:
@@ -273,7 +273,7 @@ def lookup(sqlstate: str) -> Type[Error]:
 
 
 def error_from_result(result: PGresult, encoding: str = "utf-8") -> Error:
-    from psycopg3 import pq
+    from psycopg import pq
 
     state = result.error_field(DiagnosticField.SQLSTATE) or b""
     cls = _class_for_state(state.decode("ascii"))
similarity index 90%
rename from psycopg3/psycopg3/pool/__init__.py
rename to psycopg/psycopg/pool/__init__.py
index 4eeddd885b4b72443fd7c59cb3e074628e63a39b..3797a0479cf644118d3b66b88082b30e8dc6b341 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 connection pool package
+psycopg connection pool package
 """
 
 # Copyright (C) 2021 The Psycopg Team
similarity index 99%
rename from psycopg3/psycopg3/pool/async_pool.py
rename to psycopg/psycopg/pool/async_pool.py
index b1546571d662b341209633f790586dabb9e7b9d6..eadc693a9f73cacee250cd3e338aa88ac5068fe7 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 synchronous connection pool
+psycopg synchronous connection pool
 """
 
 # Copyright (C) 2021 The Psycopg Team
@@ -24,7 +24,7 @@ from .base import ConnectionAttempt, BasePool
 from .sched import AsyncScheduler
 from .errors import PoolClosed, PoolTimeout, TooManyRequests
 
-logger = logging.getLogger("psycopg3.pool")
+logger = logging.getLogger("psycopg.pool")
 
 
 class AsyncConnectionPool(BasePool[AsyncConnection[Any]]):
similarity index 99%
rename from psycopg3/psycopg3/pool/base.py
rename to psycopg/psycopg/pool/base.py
index dce0c1204865794dd5b1ebdd04dbbaf39d07233e..f652ecfe528f54c336ae40c4f6bb262c626fafee 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 connection pool base class and functionalities.
+psycopg connection pool base class and functionalities.
 """
 
 # Copyright (C) 2021 The Psycopg Team
similarity index 81%
rename from psycopg3/psycopg3/pool/errors.py
rename to psycopg/psycopg/pool/errors.py
index 23eef69d0f87321a28f338fdfdb5afc13d790e06..a579bb21e4938c8548b6e329dd144b7ae10b41f7 100644 (file)
@@ -10,16 +10,16 @@ from .. import errors as e
 class PoolClosed(e.OperationalError):
     """Attempt to get a connection from a closed pool."""
 
-    __module__ = "psycopg3.pool"
+    __module__ = "psycopg.pool"
 
 
 class PoolTimeout(e.OperationalError):
     """The pool couldn't provide a connection in acceptable time."""
 
-    __module__ = "psycopg3.pool"
+    __module__ = "psycopg.pool"
 
 
 class TooManyRequests(e.OperationalError):
     """Too many requests in the queue waiting for a connection from the pool."""
 
-    __module__ = "psycopg3.pool"
+    __module__ = "psycopg.pool"
similarity index 99%
rename from psycopg3/psycopg3/pool/pool.py
rename to psycopg/psycopg/pool/pool.py
index 269c3e73e9f65e129063a0f9afce40b9f56f45fa..33d31ce4c5c426aa4c50f7c8f9f89ef763850b8d 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 synchronous connection pool
+psycopg synchronous connection pool
 """
 
 # Copyright (C) 2021 The Psycopg Team
@@ -24,7 +24,7 @@ from .base import ConnectionAttempt, BasePool
 from .sched import Scheduler
 from .errors import PoolClosed, PoolTimeout, TooManyRequests
 
-logger = logging.getLogger("psycopg3.pool")
+logger = logging.getLogger("psycopg.pool")
 
 
 class ConnectionPool(BasePool[Connection[Any]]):
similarity index 91%
rename from psycopg3/psycopg3/pq/__init__.py
rename to psycopg/psycopg/pq/__init__.py
index 18a95953087fdf03a4365e7c736287625f8ffaff..74c279b921fe9a34b1fab13e787509a298777f35 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 libpq wrapper
+psycopg libpq wrapper
 
 This package exposes the libpq functionalities as Python objects and functions.
 
@@ -22,7 +22,7 @@ from . import proto
 logger = logging.getLogger(__name__)
 
 __impl__: str
-"""The currently loaded implementation of the `!psycopg3.pq` package.
+"""The currently loaded implementation of the `!psycopg.pq` package.
 
 Possible values include ``python``, ``c``, ``binary``.
 """
@@ -45,7 +45,7 @@ def import_from_libpq() -> None:
     # import these names into the module on success as side effect
     global __impl__, version, PGconn, PGresult, Conninfo, Escaping, PGcancel
 
-    impl = os.environ.get("PSYCOPG3_IMPL", "").lower()
+    impl = os.environ.get("PSYCOPG_IMPL", "").lower()
     module = None
     attempts: List[str] = []
 
@@ -62,14 +62,14 @@ def import_from_libpq() -> None:
     if not impl or impl == "c":
         try:
             # TODO: extension module not recognised by mypy?
-            from psycopg3_c import pq as module  # type: ignore
+            from psycopg_c import pq as module  # type: ignore
         except Exception as e:
             handle_error("c", e)
 
     # Second best implementation: fast and stand-alone
     if not module and (not impl or impl == "binary"):
         try:
-            from psycopg3_binary import pq as module  # type: ignore
+            from psycopg_binary import pq as module  # type: ignore
         except Exception as e:
             handle_error("binary", e)
 
similarity index 92%
rename from psycopg3/psycopg3/pq/_enums.py
rename to psycopg/psycopg/pq/_enums.py
index 7fe62b72ad929d64ce1345cc88b3c51d639fc73e..77b5c4a588b798a33d90ac82c6475891b0ebc50c 100644 (file)
@@ -1,5 +1,5 @@
 """
-libpq enum definitions for psycopg3
+libpq enum definitions for psycopg
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -12,7 +12,7 @@ class ConnStatus(IntEnum):
     Current status of the connection.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     OK = 0
     """The connection is in a working state."""
@@ -39,7 +39,7 @@ class PollingStatus(IntEnum):
     If ``READING`` or ``WRITING`` you may select before polling again.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     FAILED = 0
     """Connection attempt failed."""
@@ -58,7 +58,7 @@ class ExecStatus(IntEnum):
     The status of a command.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     EMPTY_QUERY = 0
     """The string sent to the server was empty."""
@@ -108,7 +108,7 @@ class TransactionStatus(IntEnum):
     The transaction status of a connection.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     IDLE = 0
     """Connection ready, no transaction active."""
@@ -129,7 +129,7 @@ class TransactionStatus(IntEnum):
 class Ping(IntEnum):
     """Response from a ping attempt."""
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     OK = 0
     """
@@ -157,7 +157,7 @@ class DiagnosticField(IntEnum):
     Fields in an error report.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     # from postgres_ext.h
     SEVERITY = ord("S")
@@ -184,11 +184,11 @@ class Format(IntEnum):
     """
     Enum representing the format of a query argument or return value.
 
-    These values are only the ones managed by the libpq. `~psycopg3` may also
-    support automatically-chosen values: see `psycopg3.adapt.Format`.
+    These values are only the ones managed by the libpq. `~psycopg` may also
+    support automatically-chosen values: see `psycopg.adapt.Format`.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     TEXT = 0
     """Text parameter."""
similarity index 99%
rename from psycopg3/psycopg3/pq/_pq_ctypes.py
rename to psycopg/psycopg/pq/_pq_ctypes.py
index 280038041d192f47c3c174c9c99768d1cf7fd70e..bcc200026cc2e1f08c2987edd8c954e2b1bbfa66 100644 (file)
@@ -11,7 +11,7 @@ from ctypes import Structure, CFUNCTYPE, POINTER
 from ctypes import c_char, c_char_p, c_int, c_size_t, c_ubyte, c_uint, c_void_p
 from typing import List, Tuple
 
-from psycopg3.errors import NotSupportedError
+from psycopg.errors import NotSupportedError
 
 if sys.platform == "win32":
     libname = ctypes.util.find_library("libpq.dll")
similarity index 99%
rename from psycopg3/psycopg3/pq/_pq_ctypes.pyi
rename to psycopg/psycopg/pq/_pq_ctypes.pyi
index e6728339f149d7600ded03cc1a5fa2efad5d3884..05cbbb75d6f4194ed46517f35b4fc160ac667351 100644 (file)
@@ -92,7 +92,7 @@ def PQsetNoticeReceiver(
 ) -> Callable[[Any], PGresult_struct]: ...
 
 # TODO: Ignoring type as getting an error on mypy/ctypes:
-# Type argument "psycopg3.pq._pq_ctypes.PGnotify_struct" of "pointer" must be
+# Type argument "psycopg.pq._pq_ctypes.PGnotify_struct" of "pointer" must be
 # a subtype of "ctypes._CData"
 def PQnotifies(
     arg1: Optional[PGconn_struct],
similarity index 98%
rename from psycopg3/psycopg3/pq/misc.py
rename to psycopg/psycopg/pq/misc.py
index f5957e7e37b2ac7d096b6a07de6c0a344f934dbc..ae145fdb299b8f9458d7c3b9841c7b93e6c16785 100644 (file)
@@ -58,7 +58,7 @@ def error_message(obj: Union[PGconn, PGresult], encoding: str = "utf8") -> str:
             bmsg = bmsg.split(b":", 1)[-1].strip()
 
     elif hasattr(obj, "error_message"):
-        from psycopg3.encodings import py_codecs
+        from psycopg.encodings import py_codecs
 
         # obj is a PGconn
         obj = cast(PGconn, obj)
similarity index 98%
rename from psycopg3/psycopg3/pq/pq_ctypes.py
rename to psycopg/psycopg/pq/pq_ctypes.py
index 194ba20ed12e88b519c0d403278c386c88e25c66..52f65539f2a33dba7109a852ab7ace15f75852e5 100644 (file)
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
 
 __impl__ = "python"
 
-logger = logging.getLogger("psycopg3")
+logger = logging.getLogger("psycopg")
 
 
 def version() -> int:
@@ -58,7 +58,7 @@ class PGconn:
     Python representation of a libpq connection.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
     __slots__ = (
         "_pgconn_ptr",
         "notice_handler",
@@ -128,7 +128,7 @@ class PGconn:
         `!None` if the connection is closed.
 
         The value can be used to pass the structure to libpq functions which
-        psycopg3 doesn't (currently) wrap, either in C or in Python using FFI
+        psycopg doesn't (currently) wrap, either in C or in Python using FFI
         libraries such as `ctypes`.
         """
         if self._pgconn_ptr is None:
@@ -649,7 +649,7 @@ class PGresult:
     Python representation of a libpq result.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
     __slots__ = ("_pgresult_ptr",)
 
     def __init__(self, pgresult_ptr: impl.PGresult_struct):
@@ -675,7 +675,7 @@ class PGresult:
         `!None` if the result waas cleared.
 
         The value can be used to pass the structure to libpq functions which
-        psycopg3 doesn't (currently) wrap, either in C or in Python using FFI
+        psycopg doesn't (currently) wrap, either in C or in Python using FFI
         libraries such as `ctypes`.
         """
         if self._pgresult_ptr is None:
@@ -780,7 +780,7 @@ class PGcancel:
     Created by `PGconn.get_cancel()`.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
     __slots__ = ("pgcancel_ptr",)
 
     def __init__(self, pgcancel_ptr: impl.PGcancel_struct):
@@ -821,7 +821,7 @@ class Conninfo:
     Utility object to manipulate connection strings.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     @classmethod
     def get_defaults(cls) -> List[ConninfoOption]:
@@ -876,7 +876,7 @@ class Escaping:
     Utility object to escape strings for SQL interpolation.
     """
 
-    __module__ = "psycopg3.pq"
+    __module__ = "psycopg.pq"
 
     def __init__(self, conn: Optional[PGconn] = None):
         self.conn = conn
similarity index 95%
rename from psycopg3/psycopg3/rows.py
rename to psycopg/psycopg/rows.py
index f9b3efe7ee4d15d31b00128e5c5010f8151376cf..1ffa9893d12191ee8ff02b6137a54a58d02ac35f 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 row factories
+psycopg row factories
 """
 
 # Copyright (C) 2021 The Psycopg Team
@@ -40,11 +40,11 @@ class RowMaker(Protocol[Row_co]):
 
 class RowFactory(Protocol[Row]):
     """
-    Callable protocol taking a `~psycopg3.Cursor` and returning a `RowMaker`.
+    Callable protocol taking a `~psycopg.Cursor` and returning a `RowMaker`.
 
     A `!RowFactory` is typically called when a `!Cursor` receives a result.
     This way it can inspect the cursor state (for instance the
-    `~psycopg3.Cursor.description` attribute) and help a `!RowMaker` to create
+    `~psycopg.Cursor.description` attribute) and help a `!RowMaker` to create
     a complete object.
 
     For instance the `dict_row()` `!RowFactory` uses the names of the column to
similarity index 99%
rename from psycopg3/psycopg3/server_cursor.py
rename to psycopg/psycopg/server_cursor.py
index 5031b5beed4535d5fc904574420d54287eba64f9..39e2e01553cc0dd743507bd07a3b43a43aeb2efe 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 server-side cursor objects.
+psycopg server-side cursor objects.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -168,7 +168,7 @@ class ServerCursorHelper(Generic[ConnectionType, Row]):
 
 
 class ServerCursor(BaseCursor["Connection[Any]", Row]):
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
     __slots__ = ("_helper", "itersize")
 
     def __init__(
@@ -289,7 +289,7 @@ class ServerCursor(BaseCursor["Connection[Any]", Row]):
 
 
 class AsyncServerCursor(BaseCursor["AsyncConnection[Any]", Row]):
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
     __slots__ = ("_helper", "itersize")
 
     def __init__(
similarity index 98%
rename from psycopg3/psycopg3/sql.py
rename to psycopg/psycopg/sql.py
index 3072f854efde514f5a87754e249fa08a129441b6..24e26c628dc992d487cb1c72eec3b09ef3958906 100644 (file)
@@ -35,8 +35,8 @@ class Composable(ABC):
     Abstract base class for objects that can be used to compose an SQL string.
 
     `!Composable` objects can be passed directly to
-    `~psycopg3.Cursor.execute()`, `~psycopg3.Cursor.executemany()`,
-    `~psycopg3.Cursor.copy()` in place of the query string.
+    `~psycopg.Cursor.execute()`, `~psycopg.Cursor.executemany()`,
+    `~psycopg.Cursor.copy()` in place of the query string.
 
     `!Composable` objects can be joined using the ``+`` operator: the result
     will be a `Composed` instance containing the objects joined. The operator
@@ -59,8 +59,8 @@ class Composable(ABC):
         :param context: the context to evaluate the object into.
         :type context: `connection` or `cursor`
 
-        The method is automatically invoked by `~psycopg3.Cursor.execute()`,
-        `~psycopg3.Cursor.executemany()`, `~psycopg3.Cursor.copy()` if a
+        The method is automatically invoked by `~psycopg.Cursor.execute()`,
+        `~psycopg.Cursor.executemany()`, `~psycopg.Cursor.copy()` if a
         `!Composable` is passed instead of the query string.
 
         """
similarity index 98%
rename from psycopg3/psycopg3/transaction.py
rename to psycopg/psycopg/transaction.py
index 47a8f6da0965b73931a18106a4724009d678bf0c..e3e54d2a04f144d9d183b6507b16547a48a8e403 100644 (file)
@@ -31,7 +31,7 @@ class Rollback(Exception):
     enclosing transactions contexts up to and including the one specified.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     def __init__(
         self,
@@ -177,7 +177,7 @@ class Transaction(BaseTransaction["Connection[Any]"]):
     Returned by `Connection.transaction()` to handle a transaction block.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     @property
     def connection(self) -> "Connection[Any]":
@@ -204,7 +204,7 @@ class AsyncTransaction(BaseTransaction["AsyncConnection[Any]"]):
     Returned by `AsyncConnection.transaction()` to handle a transaction block.
     """
 
-    __module__ = "psycopg3"
+    __module__ = "psycopg"
 
     @property
     def connection(self) -> "AsyncConnection[Any]":
similarity index 97%
rename from psycopg3/psycopg3/types/__init__.py
rename to psycopg/psycopg/types/__init__.py
index e79334306f5dba1a8a3f6cd7cf796333d67da276..1d2dae888a2551a9d7b33b48ccde81fa876661f1 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 types package
+psycopg types package
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
similarity index 67%
rename from psycopg3/psycopg3/version.py
rename to psycopg/psycopg/version.py
index a415c310320c019c420139b21afe00c221299d4a..19b8e3225189968b62a62131fb3e7148ca89777b 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3 distribution version file.
+psycopg distribution version file.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
similarity index 82%
rename from psycopg3/setup.cfg
rename to psycopg/setup.cfg
index 3949a2cb417db4c2f2e53941810d5b5cda5dff8a..af58def2e5124877947abdc55044fd8e6be214c3 100644 (file)
@@ -1,5 +1,5 @@
 [metadata]
-name = psycopg3
+name = psycopg
 description = PostgreSQL database adapter for Python
 url = https://psycopg.org/psycopg3/
 author = Daniele Varrazzo
@@ -8,9 +8,9 @@ license = GNU Lesser General Public License v3 (LGPLv3)
 
 project_urls =
     Homepage = https://psycopg.org/
-    Code = https://github.com/psycopg/psycopg3
-    Issue Tracker = https://github.com/psycopg/psycopg3/issues
-    Download = https://pypi.org/project/psycopg3/
+    Code = https://github.com/psycopg/psycopg
+    Issue Tracker = https://github.com/psycopg/psycopg/issues
+    Download = https://pypi.org/project/psycopg/
 
 classifiers =
     Intended Audience :: Developers
@@ -34,4 +34,4 @@ install_requires =
     typing_extensions; python_version < "3.8"
 
 [options.package_data]
-psycopg3 = py.typed
+psycopg = py.typed
similarity index 90%
rename from psycopg3/setup.py
rename to psycopg/setup.py
index 712c14e108ab16ee15c196a7c847e3b27c82f9e4..58a1026200a0cae1fd8a109f4adcce77d28f9c1e 100644 (file)
@@ -15,7 +15,7 @@ here = os.path.abspath(os.path.dirname(__file__))
 if os.path.abspath(os.getcwd()) != here:
     os.chdir(here)
 
-with open("psycopg3/version.py") as f:
+with open("psycopg/version.py") as f:
     data = f.read()
     m = re.search(r"""(?m)^__version__\s*=\s*['"]([^'"]+)['"]""", data)
     if not m:
@@ -25,11 +25,11 @@ with open("psycopg3/version.py") as f:
 extras_require = {
     # Install the C extension module (requires dev tools)
     "c": [
-        f"psycopg3-c == {version}",
+        f"psycopg-c == {version}",
     ],
     # Install the stand-alone C extension module
     "binary": [
-        f"psycopg3-binary == {version}",
+        f"psycopg-binary == {version}",
     ],
     "test": [
         "mypy >= 0.812",
similarity index 72%
rename from psycopg3/tox.ini
rename to psycopg/tox.ini
index 94d2ef7977ce62dd4a147ebb6bb7a3b3dda4374f..3166081f2216076a0d5b47da7a09a89b025c4262 100644 (file)
@@ -6,7 +6,7 @@ isolated_build = True
 changedir = ..
 commands =
     pytest {posargs}
-passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS PSYCOPG3_IMPL TRAVIS*
+passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL
 extras = test
 
 [flake8]
diff --git a/psycopg3/README.rst b/psycopg3/README.rst
deleted file mode 100644 (file)
index 3d4af3f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-PostgreSQL database adapter for Python
-======================================
-
-This distribution contains the pure Python package ``psycopg3``.
-
-Installation::
-
-    pip install psycopg3
-
-Even if the package is pure Python, the PostgreSQL client library libpq must
-be available in the system.
-
-Please read `the project readme`__ for more details.
-
-.. __: https://github.com/psycopg/psycopg3#readme
-
-Copyright (C) 2020-2021 The Psycopg Team
diff --git a/psycopg3_c/psycopg3_c/__init__.py b/psycopg3_c/psycopg3_c/__init__.py
deleted file mode 100644 (file)
index e3d7546..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-psycopg3 -- PostgreSQL database adapter for Python -- C optimization package
-"""
-
-# Copyright (C) 2020-2021 The Psycopg Team
-
-import sys
-
-# This package shouldn't be imported before psycopg3 itself, or weird things
-# will happen
-if "psycopg3" not in sys.modules:
-    raise ImportError(
-        "the psycopg3 package should be imported before psycopg3_c"
-    )
-
-from .version import __version__  # noqa
similarity index 100%
rename from psycopg3_c/.gitignore
rename to psycopg_c/.gitignore
similarity index 100%
rename from psycopg3_c/LICENSE.txt
rename to psycopg_c/LICENSE.txt
similarity index 71%
rename from psycopg3_c/README.rst
rename to psycopg_c/README.rst
index 7f26428cb3dc28ffb8cfe5a0ee47a64139430d53..3745595470bc0c315217e19d2d5ac4ceac4c5ff6 100644 (file)
@@ -1,20 +1,20 @@
-PostgreSQL database adapter for Python - optimisation package
-=============================================================
+Psycopg 3: PostgreSQL database adapter for Python - optimisation package
+========================================================================
 
-This distribution contains the optional optimization package ``psycopg3_c``.
+This distribution contains the optional optimization package ``psycopg_c``.
 
 You shouldn't install this package directly: use instead ::
 
-    pip install psycopg3[c]
+    pip install psycopg[c]
 
 Installing this distribution requires the ``libpq-dev`` package and other
 packages normally used to build Python C extensions. If you cannot meet these
 dependencies, don't worry: you don't need the package: please install the
-``psycopg3`` package only.
+``psycopg`` package only.
 
 Please read `the project readme`__ for more details.
 
-.. __: https://github.com/psycopg/psycopg3#readme
+.. __: https://github.com/psycopg/psycopg#readme
 
 
 Requirements
@@ -35,9 +35,9 @@ Binary version
 --------------
 
 This library is available pre-compiled and bundled with all the required
-client library as ``psycopg3_binary``. In order to use it please install::
+client library as ``psycopg_binary``. In order to use it please install::
 
-    pip install psycopg3[binary]
+    pip install psycopg[binary]
 
 
 Copyright (C) 2020-2021 The Psycopg Team
similarity index 60%
rename from psycopg3_c/psycopg3_c/.gitignore
rename to psycopg_c/psycopg_c/.gitignore
index 20bb0e25bf13f92f05f2168c1babe243a89156ec..36edb643b7030194822f8324c3d7455f49f055a8 100644 (file)
@@ -1,4 +1,4 @@
 /*.so
-_psycopg3.c
+_psycopg.c
 pq.c
 *.html
diff --git a/psycopg_c/psycopg_c/__init__.py b/psycopg_c/psycopg_c/__init__.py
new file mode 100644 (file)
index 0000000..6bd9b8d
--- /dev/null
@@ -0,0 +1,16 @@
+"""
+psycopg -- PostgreSQL database adapter for Python -- C optimization package
+"""
+
+# Copyright (C) 2020-2021 The Psycopg Team
+
+import sys
+
+# This package shouldn't be imported before psycopg itself, or weird things
+# will happen
+if "psycopg" not in sys.modules:
+    raise ImportError(
+        "the psycopg package should be imported before psycopg_c"
+    )
+
+from .version import __version__  # noqa
similarity index 88%
rename from psycopg3_c/psycopg3_c/_psycopg3.pyi
rename to psycopg_c/psycopg_c/_psycopg.pyi
index 32beb2fb69531139e276cca937b839b142cb9d1b..9854b8bd1589a9b7576c4d23ef9e29d168b28df8 100644 (file)
@@ -1,5 +1,5 @@
 """
-Stub representaton of the public objects exposed by the _psycopg3 module.
+Stub representaton of the public objects exposed by the _psycopg module.
 
 TODO: this should be generated by mypy's stubgen but it crashes with no
 information. Will submit a bug.
@@ -9,12 +9,12 @@ information. Will submit a bug.
 
 from typing import Any, Iterable, List, Optional, Sequence, Tuple
 
-from psycopg3 import pq
-from psycopg3 import proto
-from psycopg3.rows import Row, RowMaker
-from psycopg3.adapt import Dumper, Loader, AdaptersMap, Format
-from psycopg3.pq.proto import PGconn, PGresult
-from psycopg3.connection import BaseConnection
+from psycopg import pq
+from psycopg import proto
+from psycopg.rows import Row, RowMaker
+from psycopg.adapt import Dumper, Loader, AdaptersMap, Format
+from psycopg.pq.proto import PGconn, PGresult
+from psycopg.connection import BaseConnection
 
 class Transformer(proto.AdaptContext):
     def __init__(self, context: Optional[proto.AdaptContext] = None): ...
similarity index 52%
rename from psycopg3_c/psycopg3_c/_psycopg3.pyx
rename to psycopg_c/psycopg_c/_psycopg.pyx
index 7fbca05560244abe1ef0348e6c6e14bb1a6f7e40..0c97f7904dc56d4cada731865d5655b6874201d7 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3_c._psycopg3 optimization module.
+psycopg_c._psycopg optimization module.
 
 The module contains optimized C code used in preference to Python code
 if a compiler is available.
@@ -7,12 +7,12 @@ if a compiler is available.
 
 # Copyright (C) 2020-2021 The Psycopg Team
 
-from psycopg3_c cimport pq
-from psycopg3_c.pq cimport libpq
-from psycopg3_c._psycopg3 cimport oids
+from psycopg_c cimport pq
+from psycopg_c.pq cimport libpq
+from psycopg_c._psycopg cimport oids
 
-from psycopg3.pq import Format as _pq_Format
-from psycopg3._enums import Format as _pg_Format
+from psycopg.pq import Format as _pq_Format
+from psycopg._enums import Format as _pg_Format
 
 PQ_TEXT = _pq_Format.TEXT
 PQ_BINARY = _pq_Format.BINARY
@@ -22,10 +22,10 @@ PG_TEXT = _pg_Format.TEXT
 PG_BINARY = _pg_Format.BINARY
 
 
-include "_psycopg3/adapt.pyx"
-include "_psycopg3/copy.pyx"
-include "_psycopg3/generators.pyx"
-include "_psycopg3/transform.pyx"
+include "_psycopg/adapt.pyx"
+include "_psycopg/copy.pyx"
+include "_psycopg/generators.pyx"
+include "_psycopg/transform.pyx"
 
 include "types/datetime.pyx"
 include "types/numeric.pyx"
similarity index 64%
rename from psycopg3_c/psycopg3_c/_psycopg3/__init__.pxd
rename to psycopg_c/psycopg_c/_psycopg/__init__.pxd
index b29349b66caddaab50b188b81650e9462dc92421..faacb869bb8633daa195351b39209c3df9273125 100644 (file)
@@ -1,9 +1,9 @@
 """
-psycopg3_c.pq cython module.
+psycopg_c._psycopg cython module.
 
 This file is necessary to allow c-importing pxd files from this directory.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
 
-from psycopg3_c._psycopg3 cimport oids
+from psycopg_c._psycopg cimport oids
similarity index 94%
rename from psycopg3_c/psycopg3_c/_psycopg3/adapt.pyx
rename to psycopg_c/psycopg_c/_psycopg/adapt.pyx
index da60d7c48e6413e6049c14919c88141a79e74339..ed30dc69b56502243e8b2de63578c990cef40e5f 100644 (file)
@@ -20,13 +20,13 @@ from cpython.bytes cimport PyBytes_AsStringAndSize
 from cpython.bytearray cimport PyByteArray_FromStringAndSize, PyByteArray_Resize
 from cpython.bytearray cimport PyByteArray_GET_SIZE, PyByteArray_AS_STRING
 
-from psycopg3_c.pq cimport _buffer_as_string_and_size
+from psycopg_c.pq cimport _buffer_as_string_and_size
 
-from psycopg3 import errors as e
-from psycopg3.pq.misc import error_message
+from psycopg import errors as e
+from psycopg.pq.misc import error_message
 
 import logging
-logger = logging.getLogger("psycopg3.adapt")
+logger = logging.getLogger("psycopg.adapt")
 
 
 @cython.freelist(8)
@@ -114,7 +114,7 @@ cdef class CDumper:
         if context is not None:
             adapters = context.adapters
         else:
-            from psycopg3.adapt import global_adapters as adapters
+            from psycopg.adapt import global_adapters as adapters
 
         adapters.register_dumper(cls, this_cls)
 
@@ -163,6 +163,6 @@ cdef class CLoader:
         if context is not None:
             adapters = context.adapters
         else:
-            from psycopg3.adapt import global_adapters as adapters
+            from psycopg.adapt import global_adapters as adapters
 
         adapters.register_loader(oid, cls)
similarity index 99%
rename from psycopg3_c/psycopg3_c/_psycopg3/copy.pyx
rename to psycopg_c/psycopg_c/_psycopg/copy.pyx
index 603178014b8d3525e5f003f0989936bdec9eef4b..dc02beb53fd7795c6d45d1955aa947e2f3e57d14 100644 (file)
@@ -11,10 +11,10 @@ from cpython.bytearray cimport PyByteArray_FromStringAndSize, PyByteArray_Resize
 from cpython.bytearray cimport PyByteArray_AS_STRING, PyByteArray_GET_SIZE
 from cpython.memoryview cimport PyMemoryView_FromObject
 
-from psycopg3_c._psycopg3 cimport endian
-from psycopg3_c.pq cimport ViewBuffer
+from psycopg_c._psycopg cimport endian
+from psycopg_c.pq cimport ViewBuffer
 
-from psycopg3 import errors as e
+from psycopg import errors as e
 
 cdef int32_t _binary_null = -1
 
similarity index 96%
rename from psycopg3_c/psycopg3_c/_psycopg3/generators.pyx
rename to psycopg_c/psycopg_c/_psycopg/generators.pyx
index a569badcc1d468e1b87c7a15217a8b77213666fc..2a1e5f319b60ed6a859d156fbe53c19d522d070c 100644 (file)
@@ -9,10 +9,10 @@ from cpython.object cimport PyObject_CallFunctionObjArgs
 import logging
 from typing import List
 
-from psycopg3 import errors as e
-from psycopg3.pq import proto, error_message
-from psycopg3.proto import PQGen
-from psycopg3.waiting import Wait, Ready
+from psycopg import errors as e
+from psycopg.pq import proto, error_message
+from psycopg.proto import PQGen
+from psycopg.waiting import Wait, Ready
 
 cdef object WAIT_W = Wait.W
 cdef object WAIT_R = Wait.R
similarity index 97%
rename from psycopg3_c/psycopg3_c/_psycopg3/transform.pyx
rename to psycopg_c/psycopg_c/_psycopg/transform.pyx
index 15bd996080003f037594a7040fe9764541276b26..7502f44b729564629704b040e052c1a65a2b423e 100644 (file)
@@ -21,10 +21,10 @@ from cpython.object cimport PyObject, PyObject_CallFunctionObjArgs
 
 from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple
 
-from psycopg3 import errors as e
-from psycopg3._enums import Format as Pg3Format
-from psycopg3.pq import Format as PqFormat
-from psycopg3.rows import Row, RowMaker
+from psycopg import errors as e
+from psycopg._enums import Format as Pg3Format
+from psycopg.pq import Format as PqFormat
+from psycopg.rows import Row, RowMaker
 
 # internal structure: you are not supposed to know this. But it's worth some
 # 10% of the innermost loop, so I'm willing to ask for forgiveness later...
@@ -89,7 +89,7 @@ cdef class Transformer:
             self.adapters = context.adapters
             self.connection = context.connection
         else:
-            from psycopg3.adapt import global_adapters
+            from psycopg.adapt import global_adapters
             self.adapters = global_adapters
             self.connection = None
 
@@ -183,7 +183,7 @@ cdef class Transformer:
             cache = <PyObject *>self._text_dumpers
         else:
             raise ValueError(
-                f"format should be a psycopg3.adapt.Format, not {<object>fmt}")
+                f"format should be a psycopg.adapt.Format, not {<object>fmt}")
 
         # Reuse an existing Dumper class for objects of the same type
         ptr = PyDict_GetItem(<object>cache, key)
@@ -444,7 +444,7 @@ cdef class Transformer:
             cache = <PyObject *>self._binary_loaders
         else:
             raise ValueError(
-                f"format should be a psycopg3.pq.Format, not {format}")
+                f"format should be a psycopg.pq.Format, not {format}")
 
         ptr = PyDict_GetItem(<object>cache, <object>oid)
         if ptr != NULL:
similarity index 97%
rename from psycopg3_c/psycopg3_c/pq.pxd
rename to psycopg_c/psycopg_c/pq.pxd
index 55aeb63cbd8540ae463e2333db563a3d9b3debf0..990d4532b0bf3521b034ab973cb455c3f7bbb04c 100644 (file)
@@ -1,5 +1,5 @@
 from posix.fcntl cimport pid_t
-from psycopg3_c.pq cimport libpq
+from psycopg_c.pq cimport libpq
 
 ctypedef char *(*conn_bytes_f) (const libpq.PGconn *)
 ctypedef int(*conn_int_f) (const libpq.PGconn *)
similarity index 69%
rename from psycopg3_c/psycopg3_c/pq.pyx
rename to psycopg_c/psycopg_c/pq.pyx
index cff9498702914eaf2375c24c833c96c636b56ebb..f607e4250119fac0839af66863e1d36d0d2c2bc2 100644 (file)
@@ -4,11 +4,11 @@ libpq Python wrapper using cython bindings.
 
 # Copyright (C) 2020-2021 The Psycopg Team
 
-from psycopg3_c.pq cimport libpq
+from psycopg_c.pq cimport libpq
 
-from psycopg3 import errors as e
-from psycopg3.pq import Format
-from psycopg3.pq.misc import error_message
+from psycopg import errors as e
+from psycopg.pq import Format
+from psycopg.pq.misc import error_message
 
 __impl__ = 'c'
 
similarity index 67%
rename from psycopg3_c/psycopg3_c/pq/__init__.pxd
rename to psycopg_c/psycopg_c/pq/__init__.pxd
index 3add4aa63d3b4651520c03d6ef8a286cab361713..686d178b1a9ab934ca78b4383f612b987b07c2ec 100644 (file)
@@ -1,9 +1,9 @@
 """
-psycopg3_c.pq cython module.
+psycopg_c.pq cython module.
 
 This file is necessary to allow c-importing pxd files from this directory.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
 
-from psycopg3_c.pq cimport libpq
+from psycopg_c.pq cimport libpq
similarity index 95%
rename from psycopg3_c/psycopg3_c/pq/conninfo.pyx
rename to psycopg_c/psycopg_c/pq/conninfo.pyx
index 30814e75b0217b72f248dc6794d35f1845b3e474..65d633f234eff07763899ecbc4db264325da469e 100644 (file)
@@ -1,10 +1,10 @@
 """
-psycopg3_c.pq.Conninfo object implementation.
+psycopg_c.pq.Conninfo object implementation.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
 
-from psycopg3.pq.misc import ConninfoOption
+from psycopg.pq.misc import ConninfoOption
 
 
 class Conninfo:
similarity index 98%
rename from psycopg3_c/psycopg3_c/pq/escaping.pyx
rename to psycopg_c/psycopg_c/pq/escaping.pyx
index d4d6561df4830bfafa1ddfe7e919be9a755f8c50..836412ba19c37d5f46567fff50d36b13552a37f9 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3_c.pq.Escaping object implementation.
+psycopg_c.pq.Escaping object implementation.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
similarity index 99%
rename from psycopg3_c/psycopg3_c/pq/libpq.pxd
rename to psycopg_c/psycopg_c/pq/libpq.pxd
index dd51fd6f6a989fdc72b6e762ff77e732e37b8f56..56d408f624200e4b17734e863d91da5ef2094527 100644 (file)
@@ -1,5 +1,5 @@
 """
-Libpq header definition for the cython psycopg3.pq implementation.
+Libpq header definition for the cython psycopg.pq implementation.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
similarity index 94%
rename from psycopg3_c/psycopg3_c/pq/pgcancel.pyx
rename to psycopg_c/psycopg_c/pq/pgcancel.pyx
index 93f12619041a704324c4ef9e9f16d75b8b5d59c5..61d114f1eed177d7145ffa333bfe1d8bba8b00ac 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3_c.pq.PGcancel object implementation.
+psycopg_c.pq.PGcancel object implementation.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
similarity index 98%
rename from psycopg3_c/psycopg3_c/pq/pgconn.pyx
rename to psycopg_c/psycopg_c/pq/pgconn.pyx
index 91d937f2d7e890b6437c6db5e3ec4898227cbc43..a0eecb429e51243bd8ee7ef40c12dfb223825391 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3_c.pq.PGconn object implementation.
+psycopg_c.pq.PGconn object implementation.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -12,11 +12,11 @@ from cpython.memoryview cimport PyMemoryView_FromObject
 import ctypes
 import logging
 
-from psycopg3.pq import Format as PqFormat
-from psycopg3.pq.misc import PGnotify, connection_summary
-from psycopg3_c.pq cimport PQBuffer
+from psycopg.pq import Format as PqFormat
+from psycopg.pq.misc import PGnotify, connection_summary
+from psycopg_c.pq cimport PQBuffer
 
-logger = logging.getLogger('psycopg3')
+logger = logging.getLogger('psycopg')
 
 
 cdef class PGconn:
@@ -118,7 +118,7 @@ cdef class PGconn:
     @property
     def hostaddr(self) -> bytes:
         # Available only from PG 12. Use the dynamic ctypes implementation
-        from psycopg3.pq import _pq_ctypes
+        from psycopg.pq import _pq_ctypes
 
         _ensure_pgconn(self)
         return _pq_ctypes.PQhostaddr(
similarity index 97%
rename from psycopg3_c/psycopg3_c/pq/pgresult.pyx
rename to psycopg_c/psycopg_c/pq/pgresult.pyx
index e05c203d59cae87d03ef6f1dd6bc213dfa84cc6b..cab97b210b5464f7eb70e7bcad66a1c4bbcec13b 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3_c.pq.PGresult object implementation.
+psycopg_c.pq.PGresult object implementation.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -7,8 +7,8 @@ psycopg3_c.pq.PGresult object implementation.
 cimport cython
 from cpython.mem cimport PyMem_Malloc, PyMem_Free
 
-from psycopg3.pq.misc import PGresAttDesc
-from psycopg3.pq._enums import ExecStatus
+from psycopg.pq.misc import PGresAttDesc
+from psycopg.pq._enums import ExecStatus
 
 
 @cython.freelist(8)
similarity index 99%
rename from psycopg3_c/psycopg3_c/types/datetime.pyx
rename to psycopg_c/psycopg_c/types/datetime.pyx
index 4af9647f5e9a2c1465ff3316d2257f32188f5b02..3a04e364ad9663e39899c6d76cb0fdf90f0a7a46 100644 (file)
@@ -28,10 +28,10 @@ static int _uspad[] = {0, 100000, 10000, 1000, 100, 10, 1};
 
 from datetime import date, time, timedelta, datetime, timezone
 
-from psycopg3_c._psycopg3 cimport endian
+from psycopg_c._psycopg cimport endian
 
-from psycopg3 import errors as e
-from psycopg3.compat import ZoneInfo
+from psycopg import errors as e
+from psycopg.compat import ZoneInfo
 
 
 # Initialise the datetime C API
@@ -1109,7 +1109,7 @@ cdef object _timezone_from_connection(pq.PGconn pgconn, __cache={}):
     try:
         zi = ZoneInfo(sname)
     except KeyError:
-        logger = logging.getLogger("psycopg3")
+        logger = logging.getLogger("psycopg")
         logger.warning(
             "unknown PostgreSQL timezone: %r; will use UTC", sname
         )
similarity index 99%
rename from psycopg3_c/psycopg3_c/types/numeric.pyx
rename to psycopg_c/psycopg_c/types/numeric.pyx
index 82f05766d55aebea4678e6273f891c1fd7a3df00..01a67b3a3f33446222dee01f895cd6a135234260 100644 (file)
@@ -19,10 +19,10 @@ from cpython.unicode cimport PyUnicode_DecodeUTF8
 
 from decimal import Decimal, Context, DefaultContext
 
-from psycopg3_c._psycopg3 cimport endian
-from psycopg3 import errors as e
+from psycopg_c._psycopg cimport endian
+from psycopg import errors as e
 
-from psycopg3.types.numeric import Int2, Int4, Int8, IntNumeric
+from psycopg.types.numeric import Int2, Int4, Int8, IntNumeric
 
 cdef extern from "Python.h":
     # work around https://github.com/cython/cython/issues/3909
similarity index 97%
rename from psycopg3_c/psycopg3_c/types/string.pyx
rename to psycopg_c/psycopg_c/types/string.pyx
index 0430f9a7d28b4dc4daae3247b9f6dc7cbf7e41df..3e7a9584761a70086c623c941ea689ebe41925d6 100644 (file)
@@ -16,10 +16,10 @@ from cpython.unicode cimport (
     PyUnicode_DecodeUTF8,
 )
 
-from psycopg3_c.pq cimport libpq, Escaping, _buffer_as_string_and_size
+from psycopg_c.pq cimport libpq, Escaping, _buffer_as_string_and_size
 
-from psycopg3 import errors as e
-from psycopg3.encodings import pg2py
+from psycopg import errors as e
+from psycopg.encodings import pg2py
 
 cdef extern from "Python.h":
     const char *PyUnicode_AsUTF8AndSize(unicode obj, Py_ssize_t *size) except NULL
similarity index 66%
rename from psycopg3_c/psycopg3_c/version.py
rename to psycopg_c/psycopg_c/version.py
index c72b90e08b2ab4114880878c8518fe85cb2d6fe4..0735061a2480187f96f50bb36b0ec6a50144bf57 100644 (file)
@@ -1,5 +1,5 @@
 """
-psycopg3-c distribution version file.
+psycopg-c distribution version file.
 """
 
 # Copyright (C) 2020-2021 The Psycopg Team
similarity index 83%
rename from psycopg3_c/setup.cfg
rename to psycopg_c/setup.cfg
index a4b11dc8f02937716c50b7b3a76c30fafdde9b26..b7e638534b072c9f27f0907370ab715270cc3d0e 100644 (file)
@@ -1,5 +1,5 @@
 [metadata]
-name = psycopg3-c
+name = psycopg-c
 description = PostgreSQL database adapter for Python -- C optimisation distribution
 url = https://psycopg.org/psycopg3/
 author = Daniele Varrazzo
@@ -8,9 +8,9 @@ license = GNU Lesser General Public License v3 (LGPLv3)
 
 project_urls =
     Homepage = https://psycopg.org/
-    Code = https://github.com/psycopg/psycopg3
-    Issue Tracker = https://github.com/psycopg/psycopg3/issues
-    Download = https://pypi.org/project/psycopg3-c/
+    Code = https://github.com/psycopg/psycopg
+    Issue Tracker = https://github.com/psycopg/psycopg/issues
+    Download = https://pypi.org/project/psycopg-c/
 
 # TODO: classifiers
 classifiers =
@@ -36,9 +36,9 @@ zip_safe = False
 # NOTE: do not include .pyx files: they shouldn't be in the sdist
 # package, so that build is only performed from the .c files (which are
 # distributed instead).
-psycopg3_c =
+psycopg_c =
     py.typed
     *.pyi
     *.pxd
-    _psycopg3/*.pxd
+    _psycopg/*.pxd
     pq/*.pxd
similarity index 85%
rename from psycopg3_c/setup.py
rename to psycopg_c/setup.py
index d04363aea999b0bcc18d55458bd9b9b07446a845..02ef04bf9c8731228e83e52e38cb9365612fb860 100644 (file)
@@ -19,7 +19,7 @@ here = os.path.abspath(os.path.dirname(__file__))
 if os.path.abspath(os.getcwd()) != here:
     os.chdir(here)
 
-with open("psycopg3_c/version.py") as f:
+with open("psycopg_c/version.py") as f:
     data = f.read()
     m = re.search(r"""(?m)^__version__\s*=\s*['"]([^'"]+)['"]""", data)
     if m is None:
@@ -27,7 +27,7 @@ with open("psycopg3_c/version.py") as f:
     version = m.group(1)
 
 
-class psycopg3_build_ext(build_ext):
+class psycopg_build_ext(build_ext):
     def finalize_options(self) -> None:
         self._setup_ext_build()
         super().finalize_options()
@@ -37,7 +37,7 @@ class psycopg3_build_ext(build_ext):
 
         # In the sdist there are not .pyx, only c, so we don't need Cython
         # Otherwise Cython is a requirement and is be used to compile pyx to c
-        if os.path.exists("psycopg3_c/_psycopg3.pyx"):
+        if os.path.exists("psycopg_c/_psycopg.pyx"):
             from Cython.Build import cythonize
 
         # Add the include dir for the libpq.
@@ -72,20 +72,20 @@ class psycopg3_build_ext(build_ext):
             self.distribution.ext_modules = [pgext, pqext]
 
 
-# Some details missing, to be finished by psycopg3_build_ext.finalize_options
+# Some details missing, to be finished by psycopg_build_ext.finalize_options
 pgext = Extension(
-    "psycopg3_c._psycopg3",
+    "psycopg_c._psycopg",
     [
-        "psycopg3_c/_psycopg3.c",
-        "psycopg3_c/types/numutils.c",
+        "psycopg_c/_psycopg.c",
+        "psycopg_c/types/numutils.c",
     ],
     libraries=["pq"],
     include_dirs=[],
 )
 
 pqext = Extension(
-    "psycopg3_c.pq",
-    ["psycopg3_c/pq.c"],
+    "psycopg_c.pq",
+    ["psycopg_c/pq.c"],
     libraries=["pq"],
     include_dirs=[],
 )
@@ -93,5 +93,5 @@ pqext = Extension(
 setup(
     version=version,
     ext_modules=[pgext, pqext],
-    cmdclass={"build_ext": psycopg3_build_ext},
+    cmdclass={"build_ext": psycopg_build_ext},
 )
similarity index 53%
rename from psycopg3_c/tox.ini
rename to psycopg_c/tox.ini
index 523e2415490870351573007373b3f62468afc92f..6b974ec3f1744561e10d80fa5abc0b00463e757b 100644 (file)
@@ -6,6 +6,6 @@ isolated_build = True
 changedir = ..
 commands =
     pytest {posargs}
-passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS PSYCOPG3_IMPL TRAVIS*
+passenv = PG* PSYCOPG_TEST_DSN PYTEST_ADDOPTS PSYCOPG_IMPL
 deps =
-    -e {toxinidir}/../psycopg3[test]
+    -e {toxinidir}/../psycopg[test]
index d7f68c4ff8feb6131cd3366865f44426be84bb88..a428bb4d7a749886b5c8d423bb5fa46961114621 100644 (file)
@@ -1,22 +1,22 @@
-psycopg3 test suite
+psycopg test suite
 ===================
 
 Quick version
 -------------
 
 To run tests on the current code you can install the `test` extra of the
-package, specify a connection string  in the `PSYCOPG3_TEST_DSN` env var to
+package, specify a connection string  in the `PSYCOPG_TEST_DSN` env var to
 connect to a test database, and run ``pytest``::
 
-    $ pip install -e psycopg3[test]
-    $ export PSYCOPG3_TEST_DSN="host=localhost dbname=psycopg3_test"
+    $ pip install -e psycopg[test]
+    $ export PSYCOPG_TEST_DSN="host=localhost dbname=psycopg_test"
     $ pytest
 
 
 Test options
 ------------
 
-- The tests output header shows additional psycopg3 related information,
+- The tests output header shows additional psycopg related information,
   on top of the one normally displayed by ``pytest`` and the extensions used::
 
       $ pytest
@@ -27,18 +27,18 @@ Test options
       libpq wrapper implementation: c
 
 
-- By default the tests run using the ``pq`` implementation that psycopg3 would
+- By default the tests run using the ``pq`` implementation that psycopg would
   choose (the C module if installed, else the Python one). In order to test a
   different implementation, use the normal `pq module selection mechanism`__
-  of the ``PSYCOPG3_IMPL`` env var::
+  of the ``PSYCOPG_IMPL`` env var::
 
-      $ PSYCOPG3_IMPL=python pytest 
+      $ PSYCOPG_IMPL=python pytest 
       ========================= test session starts =========================
       [...]
       libpq available: 130002
       libpq wrapper implementation: python
 
-  .. __: https://www.psycopg.org/psycopg3/docs/api/pq.html#pq-module-implementations
+  .. __: https://www.psycopg.org/psycopg/docs/api/pq.html#pq-module-implementations
 
 
 - Slow tests have a ``slow`` marker which can be selected to reduce test
@@ -66,8 +66,8 @@ test dsn in order to connect to a database running on the docker host: specify
 a set of env vars working for your setup::
 
     $ docker run -ti --rm --volume `pwd`:/src --workdir /src \
-      -e PSYCOPG3_TEST_DSN -e PGHOST=172.17.0.1 -e PGUSER=`whoami` \
+      -e PSYCOPG_TEST_DSN -e PGHOST=172.17.0.1 -e PGUSER=`whoami` \
       python:3.7 bash
 
-    # pip install -e ./psycopg3[test] ./psycopg3_c
+    # pip install -e ./psycopg[test] ./psycopg_c
     # pytest
index 05c3779d4863e203b9b1997fff7de8f23be930db..d83cd42df39709c7c54705a92dc79c150353d738 100644 (file)
@@ -20,7 +20,7 @@ def pytest_configure(config):
     # There are troubles on travis with these kind of tests and I cannot
     # catch the exception for my life.
     config.addinivalue_line(
-        "markers", "subprocess: the test import psycopg3 after subprocess"
+        "markers", "subprocess: the test import psycopg after subprocess"
     )
 
 
index ee01caa4a2cd5abc45346b0f85be264ce1d57c35..d826b2a5f61327644f1906fcc189d6f7a9df8d07 100644 (file)
@@ -8,9 +8,9 @@ def pytest_addoption(parser):
     parser.addoption(
         "--test-dsn",
         metavar="DSN",
-        default=os.environ.get("PSYCOPG3_TEST_DSN") or None,
+        default=os.environ.get("PSYCOPG_TEST_DSN") or None,
         help="Connection string to run database tests requiring a connection"
-        " [you can also use the PSYCOPG3_TEST_DSN env var].",
+        " [you can also use the PSYCOPG_TEST_DSN env var].",
     )
 
 
@@ -35,7 +35,7 @@ def dsn(request):
 @pytest.fixture
 def pgconn(dsn, request):
     """Return a PGconn connection open to `--test-dsn`."""
-    from psycopg3 import pq
+    from psycopg import pq
 
     conn = pq.PGconn.connect(dsn.encode("utf8"))
     if conn.status != pq.ConnStatus.OK:
@@ -53,7 +53,7 @@ def pgconn(dsn, request):
 @pytest.fixture
 def conn(dsn, request):
     """Return a `Connection` connected to the ``--test-dsn`` database."""
-    from psycopg3 import Connection
+    from psycopg import Connection
 
     conn = Connection.connect(dsn)
     msg = check_connection_version(conn.info.server_version, request.function)
@@ -67,7 +67,7 @@ def conn(dsn, request):
 @pytest.fixture
 async def aconn(dsn, request):
     """Return an `AsyncConnection` connected to the ``--test-dsn`` database."""
-    from psycopg3 import AsyncConnection
+    from psycopg import AsyncConnection
 
     conn = await AsyncConnection.connect(dsn)
     msg = check_connection_version(conn.info.server_version, request.function)
@@ -83,7 +83,7 @@ def svcconn(dsn):
     """
     Return a session `Connection` connected to the ``--test-dsn`` database.
     """
-    from psycopg3 import Connection
+    from psycopg import Connection
 
     conn = Connection.connect(dsn, autocommit=True)
     yield conn
@@ -104,7 +104,7 @@ def acommands(aconn, monkeypatch):
 
 def patch_exec(conn, monkeypatch):
     """Helper to implement the commands fixture both sync and async."""
-    from psycopg3 import sql
+    from psycopg import sql
 
     _orig_exec_command = conn._exec_command
     L = ListPopAll()
index 4b552af5f74e27f8d44224211866c70ef7178b4d..300786f90f0e132999dcd63bbe4010c45dc52cc1 100644 (file)
@@ -9,11 +9,11 @@ from collections import deque
 
 import pytest
 
-import psycopg3
-from psycopg3 import sql
-from psycopg3.adapt import Format
-from psycopg3.types.range import Range
-from psycopg3.types.numeric import Int4, Int8
+import psycopg
+from psycopg import sql
+from psycopg.adapt import Format
+from psycopg.types.range import Range
+from psycopg.types.numeric import Int4, Int8
 
 
 @pytest.fixture
@@ -80,7 +80,7 @@ class Faker:
             return self._types_names
 
         record = self.make_record(nulls=0)
-        tx = psycopg3.adapt.Transformer(self.conn)
+        tx = psycopg.adapt.Transformer(self.conn)
         types = [
             self._get_type_name(tx, schema, value)
             for schema, value in zip(self.schema, record)
index 115803f98c8481c2f16f69a584439f25b77734ce..bf1ca14f95fbab4473daa81bbae4b99aab4a7c1c 100644 (file)
@@ -7,7 +7,7 @@ from .utils import check_libpq_version
 
 def pytest_report_header(config):
     try:
-        from psycopg3 import pq
+        from psycopg import pq
     except ImportError:
         return []
 
@@ -27,7 +27,7 @@ def pytest_configure(config):
 
 
 def pytest_runtest_setup(item):
-    from psycopg3 import pq
+    from psycopg import pq
 
     for m in item.iter_markers(name="libpq"):
         assert len(m.args) == 1
@@ -50,7 +50,7 @@ def libpq():
         assert libname, "libpq libname not found"
         return ctypes.pydll.LoadLibrary(libname)
     except Exception as e:
-        from psycopg3 import pq
+        from psycopg import pq
 
         if pq.__impl__ == "binary":
             pytest.skip(f"can't load libpq for testing: {e}")
index 6651aa00f04788c9961daf1cd7fa2a0d52b47a81..ef87b6397e7e7e1c11b5b719e957a86cb7a04255 100644 (file)
@@ -6,8 +6,8 @@ from shutil import which
 
 import pytest
 
-import psycopg3
-from psycopg3 import conninfo
+import psycopg
+from psycopg import conninfo
 
 logger = logging.getLogger()
 
@@ -71,7 +71,7 @@ class Proxy:
         # verify that the proxy works
         # TODO: investigate why it doesn't on Travis
         try:
-            with psycopg3.connect(self.client_dsn):
+            with psycopg.connect(self.client_dsn):
                 pass
         except Exception as e:
             pytest.xfail(f"failed to create a working proxy: {e}")
index 235b0af5cc6080e3659ba2cbdde711fe3f0b0a8b..f934e3988f321fe633599b52cdc191b28d2e960a 100644 (file)
@@ -7,9 +7,9 @@ from collections import Counter
 
 import pytest
 
-import psycopg3
-from psycopg3 import pool
-from psycopg3.pq import TransactionStatus
+import psycopg
+from psycopg import pool
+from psycopg.pq import TransactionStatus
 
 
 def test_defaults(dsn):
@@ -34,7 +34,7 @@ def test_min_size_max_size(dsn):
 
 
 def test_connection_class(dsn):
-    class MyConn(psycopg3.Connection):
+    class MyConn(psycopg.Connection):
         pass
 
     with pool.ConnectionPool(dsn, connection_class=MyConn, min_size=1) as p:
@@ -167,7 +167,7 @@ def test_configure(dsn):
 
 @pytest.mark.slow
 def test_configure_badstate(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     def configure(conn):
         conn.execute("select 1")
@@ -182,7 +182,7 @@ def test_configure_badstate(dsn, caplog):
 
 @pytest.mark.slow
 def test_configure_broken(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     def configure(conn):
         with conn.transaction():
@@ -226,7 +226,7 @@ def test_reset(dsn):
 
 
 def test_reset_badstate(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     def reset(conn):
         conn.execute("reset all")
@@ -246,7 +246,7 @@ def test_reset_badstate(dsn, caplog):
 
 
 def test_reset_broken(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     def reset(conn):
         with conn.transaction():
@@ -429,7 +429,7 @@ def test_broken_reconnect(dsn):
 
 
 def test_intrans_rollback(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     with pool.ConnectionPool(dsn, min_size=1) as p:
         conn = p.getconn()
@@ -450,12 +450,12 @@ def test_intrans_rollback(dsn, caplog):
 
 
 def test_inerror_rollback(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     with pool.ConnectionPool(dsn, min_size=1) as p:
         conn = p.getconn()
         pid = conn.pgconn.backend_pid
-        with pytest.raises(psycopg3.ProgrammingError):
+        with pytest.raises(psycopg.ProgrammingError):
             conn.execute("wat")
         assert conn.pgconn.transaction_status == TransactionStatus.INERROR
         p.putconn(conn)
@@ -469,7 +469,7 @@ def test_inerror_rollback(dsn, caplog):
 
 
 def test_active_close(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     with pool.ConnectionPool(dsn, min_size=1) as p:
         conn = p.getconn()
@@ -490,7 +490,7 @@ def test_active_close(dsn, caplog):
 
 
 def test_fail_rollback_close(dsn, caplog, monkeypatch):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     with pool.ConnectionPool(dsn, min_size=1) as p:
         conn = p.getconn()
@@ -504,7 +504,7 @@ def test_fail_rollback_close(dsn, caplog, monkeypatch):
         monkeypatch.setattr(conn, "rollback", bad_rollback)
 
         pid = conn.pgconn.backend_pid
-        with pytest.raises(psycopg3.ProgrammingError):
+        with pytest.raises(psycopg.ProgrammingError):
             conn.execute("wat")
         assert conn.pgconn.transaction_status == TransactionStatus.INERROR
         p.putconn(conn)
@@ -533,7 +533,7 @@ def test_close_no_threads(dsn):
 
 def test_putconn_no_pool(dsn):
     with pool.ConnectionPool(dsn, min_size=1) as p:
-        conn = psycopg3.connect(dsn)
+        conn = psycopg.connect(dsn)
         with pytest.raises(ValueError):
             p.putconn(conn)
 
@@ -655,7 +655,7 @@ def test_grow(dsn, monkeypatch, retries):
 @pytest.mark.slow
 def test_shrink(dsn, monkeypatch):
 
-    from psycopg3.pool.pool import ShrinkPool
+    from psycopg.pool.pool import ShrinkPool
 
     results = []
 
@@ -686,7 +686,7 @@ def test_shrink(dsn, monkeypatch):
 
 @pytest.mark.slow
 def test_reconnect(proxy, caplog, monkeypatch):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     assert pool.base.ConnectionAttempt.INITIAL_DELAY == 1.0
     assert pool.base.ConnectionAttempt.DELAY_JITTER == 0.1
@@ -698,7 +698,7 @@ def test_reconnect(proxy, caplog, monkeypatch):
         p.wait(2.0)
         proxy.stop()
 
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             with p.connection() as conn:
                 conn.execute("select 1")
 
@@ -741,7 +741,7 @@ def test_reconnect_failure(proxy):
         p.wait(2.0)
         proxy.stop()
 
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             with p.connection() as conn:
                 conn.execute("select 1")
 
@@ -835,7 +835,7 @@ def test_max_lifetime(dsn):
 
 
 def test_check(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
     with pool.ConnectionPool(dsn, min_size=4) as p:
         p.wait(1.0)
         with p.connection() as conn:
@@ -861,7 +861,7 @@ def test_check(dsn, caplog):
 def test_async_pool_not_supported(dsn):
     # note: this test is here because the all the ones in test_pool_async are
     # skipped on Py 3.6
-    with pytest.raises(psycopg3.NotSupportedError):
+    with pytest.raises(psycopg.NotSupportedError):
         pool.AsyncConnectionPool(dsn)
 
 
@@ -993,5 +993,5 @@ def delay_connection(monkeypatch, sec):
         sleep(sec - (t1 - t0))
         return rv
 
-    connect_orig = psycopg3.Connection.connect
-    monkeypatch.setattr(psycopg3.Connection, "connect", connect_delay)
+    connect_orig = psycopg.Connection.connect
+    monkeypatch.setattr(psycopg.Connection, "connect", connect_delay)
index e1c146c35837edb5225b92953f0632842b9b2905..5054198fdf49011d50d648c3eeb5e295b5254779 100644 (file)
@@ -6,10 +6,10 @@ from collections import Counter
 
 import pytest
 
-import psycopg3
-from psycopg3 import pool
-from psycopg3.pq import TransactionStatus
-from psycopg3.compat import create_task
+import psycopg
+from psycopg import pool
+from psycopg.pq import TransactionStatus
+from psycopg.compat import create_task
 
 pytestmark = [
     pytest.mark.asyncio,
@@ -42,7 +42,7 @@ async def test_min_size_max_size(dsn):
 
 
 async def test_connection_class(dsn):
-    class MyConn(psycopg3.AsyncConnection):
+    class MyConn(psycopg.AsyncConnection):
         pass
 
     async with pool.AsyncConnectionPool(
@@ -185,7 +185,7 @@ async def test_configure(dsn):
 
 @pytest.mark.slow
 async def test_configure_badstate(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     async def configure(conn):
         await conn.execute("select 1")
@@ -202,7 +202,7 @@ async def test_configure_badstate(dsn, caplog):
 
 @pytest.mark.slow
 async def test_configure_broken(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     async def configure(conn):
         async with conn.transaction():
@@ -248,7 +248,7 @@ async def test_reset(dsn):
 
 
 async def test_reset_badstate(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     async def reset(conn):
         await conn.execute("reset all")
@@ -268,7 +268,7 @@ async def test_reset_badstate(dsn, caplog):
 
 
 async def test_reset_broken(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
 
     async def reset(conn):
         async with conn.transaction():
@@ -466,7 +466,7 @@ async def test_intrans_rollback(dsn, caplog):
     recs = [
         r
         for r in caplog.records
-        if r.name.startswith("psycopg3") and r.levelno >= logging.WARNING
+        if r.name.startswith("psycopg") and r.levelno >= logging.WARNING
     ]
     assert len(recs) == 1
     assert "INTRANS" in recs[0].message
@@ -476,7 +476,7 @@ async def test_inerror_rollback(dsn, caplog):
     async with pool.AsyncConnectionPool(dsn, min_size=1) as p:
         conn = await p.getconn()
         pid = conn.pgconn.backend_pid
-        with pytest.raises(psycopg3.ProgrammingError):
+        with pytest.raises(psycopg.ProgrammingError):
             await conn.execute("wat")
         assert conn.pgconn.transaction_status == TransactionStatus.INERROR
         await p.putconn(conn)
@@ -488,7 +488,7 @@ async def test_inerror_rollback(dsn, caplog):
     recs = [
         r
         for r in caplog.records
-        if r.name.startswith("psycopg3") and r.levelno >= logging.WARNING
+        if r.name.startswith("psycopg") and r.levelno >= logging.WARNING
     ]
     assert len(recs) == 1
     assert "INERROR" in recs[0].message
@@ -513,7 +513,7 @@ async def test_active_close(dsn, caplog):
     recs = [
         r
         for r in caplog.records
-        if r.name.startswith("psycopg3") and r.levelno >= logging.WARNING
+        if r.name.startswith("psycopg") and r.levelno >= logging.WARNING
     ]
     assert len(recs) == 2
     assert "ACTIVE" in recs[0].message
@@ -533,7 +533,7 @@ async def test_fail_rollback_close(dsn, caplog, monkeypatch):
         monkeypatch.setattr(conn, "rollback", bad_rollback)
 
         pid = conn.pgconn.backend_pid
-        with pytest.raises(psycopg3.ProgrammingError):
+        with pytest.raises(psycopg.ProgrammingError):
             await conn.execute("wat")
         assert conn.pgconn.transaction_status == TransactionStatus.INERROR
         await p.putconn(conn)
@@ -545,7 +545,7 @@ async def test_fail_rollback_close(dsn, caplog, monkeypatch):
     recs = [
         r
         for r in caplog.records
-        if r.name.startswith("psycopg3") and r.levelno >= logging.WARNING
+        if r.name.startswith("psycopg") and r.levelno >= logging.WARNING
     ]
     assert len(recs) == 3
     assert "INERROR" in recs[0].message
@@ -567,7 +567,7 @@ async def test_close_no_tasks(dsn):
 
 async def test_putconn_no_pool(dsn):
     async with pool.AsyncConnectionPool(dsn, min_size=1) as p:
-        conn = psycopg3.connect(dsn)
+        conn = psycopg.connect(dsn)
         with pytest.raises(ValueError):
             await p.putconn(conn)
 
@@ -663,7 +663,7 @@ async def test_grow(dsn, monkeypatch, retries):
 @pytest.mark.slow
 async def test_shrink(dsn, monkeypatch):
 
-    from psycopg3.pool.async_pool import ShrinkPool
+    from psycopg.pool.async_pool import ShrinkPool
 
     results = []
 
@@ -706,7 +706,7 @@ async def test_reconnect(proxy, caplog, monkeypatch):
         await p.wait(2.0)
         proxy.stop()
 
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             async with p.connection() as conn:
                 await conn.execute("select 1")
 
@@ -720,7 +720,7 @@ async def test_reconnect(proxy, caplog, monkeypatch):
     recs = [
         r
         for r in caplog.records
-        if r.name.startswith("psycopg3") and r.levelno >= logging.WARNING
+        if r.name.startswith("psycopg") and r.levelno >= logging.WARNING
     ]
     assert "BAD" in recs[0].message
     times = [rec.created for rec in recs]
@@ -754,7 +754,7 @@ async def test_reconnect_failure(proxy):
         await p.wait(2.0)
         proxy.stop()
 
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             async with p.connection() as conn:
                 await conn.execute("select 1")
 
@@ -851,7 +851,7 @@ async def test_max_lifetime(dsn):
 
 
 async def test_check(dsn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3.pool")
+    caplog.set_level(logging.WARNING, logger="psycopg.pool")
     async with pool.AsyncConnectionPool(dsn, min_size=4) as p:
         await p.wait(1.0)
         async with p.connection() as conn:
@@ -995,5 +995,5 @@ def delay_connection(monkeypatch, sec):
         await asyncio.sleep(sec - (t1 - t0))
         return rv
 
-    connect_orig = psycopg3.AsyncConnection.connect
-    monkeypatch.setattr(psycopg3.AsyncConnection, "connect", connect_delay)
+    connect_orig = psycopg.AsyncConnection.connect
+    monkeypatch.setattr(psycopg.AsyncConnection, "connect", connect_delay)
index fdd9222653d5ec00b25c3bd93b70fddc09b7793d..e2bb5e126574b501dbaf544cb2357168447e3f60 100644 (file)
@@ -5,7 +5,7 @@ from threading import Thread
 
 import pytest
 
-from psycopg3.pool.sched import Scheduler
+from psycopg.pool.sched import Scheduler
 
 
 @pytest.mark.slow
@@ -59,7 +59,7 @@ def test_sched_thread():
 
 @pytest.mark.slow
 def test_sched_error(caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3")
+    caplog.set_level(logging.WARNING, logger="psycopg")
     s = Scheduler()
     t = Thread(target=s.run, daemon=True)
     t.start()
index 4feb104046d8dfb5ad12e641d7fce4d654606e8c..bc06fd96026f1e125ccc53efd1e7cd4dd316db4b 100644 (file)
@@ -5,8 +5,8 @@ from functools import partial
 
 import pytest
 
-from psycopg3.compat import create_task
-from psycopg3.pool.sched import AsyncScheduler
+from psycopg.compat import create_task
+from psycopg.pool.sched import AsyncScheduler
 
 pytestmark = pytest.mark.asyncio
 
@@ -61,7 +61,7 @@ async def test_sched_task():
 
 @pytest.mark.slow
 async def test_sched_error(caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3")
+    caplog.set_level(logging.WARNING, logger="psycopg")
     s = AsyncScheduler()
     t = create_task(s.run())
 
index 68d95383bdfd3615741bdcc163ec46d6f9a3e82b..3f8eb35e89d387086380cbbe50aec21b885b47dc 100644 (file)
@@ -1,12 +1,12 @@
 import pytest
 from select import select
-import psycopg3
-from psycopg3 import pq
-from psycopg3.generators import execute
+import psycopg
+from psycopg import pq
+from psycopg.generators import execute
 
 
 def execute_wait(pgconn):
-    return psycopg3.waiting.wait(execute(pgconn), pgconn.socket)
+    return psycopg.waiting.wait(execute(pgconn), pgconn.socket)
 
 
 def test_send_query(pgconn):
@@ -62,7 +62,7 @@ def test_send_query(pgconn):
 
 
 def test_send_query_compact_test(pgconn):
-    # Like the above test but use psycopg3 facilities for compactness
+    # Like the above test but use psycopg facilities for compactness
     pgconn.send_query(
         b"/* %s */ select pg_sleep(0.01); select 1 as foo;"
         % (b"x" * 1_000_000)
@@ -78,7 +78,7 @@ def test_send_query_compact_test(pgconn):
     assert results[1].get_value(0, 0) == b"1"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.send_query(b"select 1")
 
 
@@ -111,7 +111,7 @@ def test_send_query_params(pgconn):
     assert res.get_value(0, 0) == b"8"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.send_query_params(b"select $1", [b"1"])
 
 
@@ -125,9 +125,9 @@ def test_send_prepare(pgconn):
     assert res.get_value(0, 0) == b"8"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.send_prepare(b"prep", b"select $1::int + $2::int")
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.send_query_prepared(b"prep", [b"3", b"5"])
 
 
@@ -187,7 +187,7 @@ def test_send_describe_prepared(pgconn):
     assert res.ftype(0) == 23
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.send_describe_prepared(b"prep")
 
 
@@ -207,5 +207,5 @@ def test_send_describe_portal(pgconn):
     assert res.fname(0) == b"foo"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.send_describe_portal(b"cur")
index a1933f7bca9b65dba64a7c01aaf77297b3d0441a..91184a348c7a568d5e3d642bf7a5faa82941bfbc 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
-import psycopg3
-from psycopg3 import pq
+import psycopg
+from psycopg import pq
 
 
 def test_defaults(monkeypatch):
@@ -30,6 +30,6 @@ def test_conninfo_parse():
 
 
 def test_conninfo_parse_bad():
-    with pytest.raises(psycopg3.OperationalError) as e:
+    with pytest.raises(psycopg.OperationalError) as e:
         pq.Conninfo.parse(b"bad_conninfo=")
         assert "bad_conninfo" in str(e.value)
index aab25afb14468e137bc49232909fe7b9e528cfbc..fa275adf1b90ace2ed28a46a0e86987e101397f3 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
-import psycopg3
-from psycopg3 import pq
+import psycopg
+from psycopg import pq
 
 sample_values = "values (10::int, 20::int, 'hello'::text), (40, NULL, 'world')"
 
@@ -30,20 +30,20 @@ sample_binary = b"".join(sample_binary_rows)
 
 
 def test_put_data_no_copy(pgconn):
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.put_copy_data(b"wat")
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.put_copy_data(b"wat")
 
 
 def test_put_end_no_copy(pgconn):
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.put_copy_end()
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.put_copy_end()
 
 
@@ -136,11 +136,11 @@ def test_copy_out_error_end(pgconn):
 
 
 def test_get_data_no_copy(pgconn):
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.get_copy_data(0)
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.get_copy_data(0)
 
 
index d6ba9de0b74df2ad44e765dfe926718acf2e9588..fde461872fcc13819b6df261f8d6806ff7ea3ca2 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
-import psycopg3
-from psycopg3 import pq
+import psycopg
+from psycopg import pq
 
 
 @pytest.mark.parametrize(
@@ -36,12 +36,12 @@ def test_escape_literal_1char(pgconn, scs):
 
 def test_escape_literal_noconn(pgconn):
     esc = pq.Escaping()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_literal(b"hi")
 
     esc = pq.Escaping(pgconn)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_literal(b"hi")
 
 
@@ -77,12 +77,12 @@ def test_escape_identifier_1char(pgconn, scs):
 
 def test_escape_identifier_noconn(pgconn):
     esc = pq.Escaping()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_identifier(b"hi")
 
     esc = pq.Escaping(pgconn)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_identifier(b"hi")
 
 
@@ -138,7 +138,7 @@ def test_escape_string_noconn(data, want):
 def test_escape_string_badconn(pgconn):
     esc = pq.Escaping(pgconn)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_string(b"hi")
 
 
@@ -147,7 +147,7 @@ def test_escape_string_badenc(pgconn):
     assert res.status == pq.ExecStatus.COMMAND_OK
     data = "\u20ac".encode("utf8")[:-1]
     esc = pq.Escaping(pgconn)
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_string(data)
 
 
@@ -159,7 +159,7 @@ def test_escape_bytea(pgconn, data):
     assert rv == exp
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.escape_bytea(data)
 
 
@@ -190,5 +190,5 @@ def test_unescape_bytea(pgconn, data):
     assert rv == data
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         esc.unescape_bytea(data)
index bb80bbfeb129f963a571650a5a628f92bbb76741..ce21be2f3e87c746fec5eb2e40859b35cadb53b5 100644 (file)
@@ -2,8 +2,8 @@
 
 import pytest
 
-import psycopg3
-from psycopg3 import pq
+import psycopg
+from psycopg import pq
 
 
 def test_exec_none(pgconn):
@@ -15,7 +15,7 @@ def test_exec(pgconn):
     res = pgconn.exec_(b"select 'hel' || 'lo'")
     assert res.get_value(0, 0) == b"hello"
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.exec_(b"select 'hello'")
 
 
@@ -24,7 +24,7 @@ def test_exec_params(pgconn):
     assert res.status == pq.ExecStatus.TUPLES_OK
     assert res.get_value(0, 0) == b"8"
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.exec_params(b"select $1::int + $2", [b"5", b"3"])
 
 
@@ -91,9 +91,9 @@ def test_prepare(pgconn):
     assert res.get_value(0, 0) == b"8"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.prepare(b"prep", b"select $1::int + $2::int")
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.exec_prepared(b"prep", [b"3", b"5"])
 
 
@@ -149,5 +149,5 @@ def test_describe_portal(pgconn):
     assert res.fname(0) == b"foo"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.describe_portal(b"cur")
index 60355ea250aa53b6072daec8971ae4b048eb445e..c92160a4518ff6291215fd4e99bb6036ac3d1138 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 
-import psycopg3
-from psycopg3 import pq
+import psycopg
+from psycopg import pq
 
 
 def test_error_message(pgconn):
@@ -78,5 +78,5 @@ def test_result_set_attrs(pgconn):
     assert res.ftype(1) == 1700
     assert res.ftype(2) == 25
 
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         res.set_attributes(attrs)
index f7f8b07c60cea42b9bd2edaef6c043aac68f97b1..cb1665f8977ebd958c057661e23b7cf8d13ab35d 100644 (file)
@@ -6,9 +6,9 @@ from select import select
 
 import pytest
 
-import psycopg3
-from psycopg3 import pq
-import psycopg3.generators
+import psycopg
+from psycopg import pq
+import psycopg.generators
 
 from ..utils import gc_collect
 
@@ -19,7 +19,7 @@ def test_connectdb(dsn):
 
 
 def test_connectdb_error():
-    conn = pq.PGconn.connect(b"dbname=psycopg3_test_not_for_real")
+    conn = pq.PGconn.connect(b"dbname=psycopg_test_not_for_real")
     assert conn.status == pq.ConnStatus.BAD
 
 
@@ -47,7 +47,7 @@ def test_connect_async(dsn):
     assert conn.status == pq.ConnStatus.OK
 
     conn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         conn.connect_poll()
 
 
@@ -57,7 +57,7 @@ def test_connect_async_bad(dsn):
         for e in pq.Conninfo.parse(dsn.encode("utf8"))
         if e.val
     }
-    parsed_dsn[b"dbname"] = b"psycopg3_test_not_for_real"
+    parsed_dsn[b"dbname"] = b"psycopg_test_not_for_real"
     dsn = b" ".join(b"%s='%s'" % item for item in parsed_dsn.items())
     conn = pq.PGconn.connect_start(dsn)
     while 1:
@@ -120,7 +120,7 @@ def test_info(dsn, pgconn):
     assert dbname.val == (name or user)
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.info
 
 
@@ -132,7 +132,7 @@ def test_reset(pgconn):
     assert pgconn.status == pq.ConnStatus.OK
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.reset()
 
     assert pgconn.status == pq.ConnStatus.BAD
@@ -156,10 +156,10 @@ def test_reset_async(pgconn):
     assert pgconn.status == pq.ConnStatus.OK
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.reset_start()
 
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.reset_poll()
 
 
@@ -175,7 +175,7 @@ def test_db(pgconn):
     name = [o.val for o in pgconn.info if o.keyword == b"dbname"][0]
     assert pgconn.db == name
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.db
 
 
@@ -183,7 +183,7 @@ def test_user(pgconn):
     user = [o.val for o in pgconn.info if o.keyword == b"user"][0]
     assert pgconn.user == user
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.user
 
 
@@ -191,7 +191,7 @@ def test_password(pgconn):
     # not in info
     assert isinstance(pgconn.password, bytes)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.password
 
 
@@ -199,7 +199,7 @@ def test_host(pgconn):
     # might be not in info
     assert isinstance(pgconn.host, bytes)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.host
 
 
@@ -208,14 +208,14 @@ def test_hostaddr(pgconn):
     # not in info
     assert isinstance(pgconn.hostaddr, bytes), pgconn.hostaddr
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.hostaddr
 
 
 @pytest.mark.xfail
 @pytest.mark.libpq("< 12")
 def test_hostaddr_missing(pgconn):
-    with pytest.raises(psycopg3.NotSupportedError):
+    with pytest.raises(psycopg.NotSupportedError):
         pgconn.hostaddr
 
 
@@ -223,7 +223,7 @@ def test_port(pgconn):
     port = [o.val for o in pgconn.info if o.keyword == b"port"][0]
     assert pgconn.port == port
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.port
 
 
@@ -231,7 +231,7 @@ def test_tty(pgconn):
     tty = [o.val for o in pgconn.info if o.keyword == b"tty"][0]
     assert pgconn.tty == tty
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.tty
 
 
@@ -241,19 +241,19 @@ def test_transaction_status(pgconn):
     assert pgconn.transaction_status == pq.TransactionStatus.INTRANS
     pgconn.send_query(b"select 1")
     assert pgconn.transaction_status == pq.TransactionStatus.ACTIVE
-    psycopg3.waiting.wait(psycopg3.generators.execute(pgconn), pgconn.socket)
+    psycopg.waiting.wait(psycopg.generators.execute(pgconn), pgconn.socket)
     assert pgconn.transaction_status == pq.TransactionStatus.INTRANS
     pgconn.finish()
     assert pgconn.transaction_status == pq.TransactionStatus.UNKNOWN
 
 
 def test_parameter_status(dsn, monkeypatch):
-    monkeypatch.setenv("PGAPPNAME", "psycopg3 tests")
+    monkeypatch.setenv("PGAPPNAME", "psycopg tests")
     pgconn = pq.PGconn.connect(dsn.encode("utf8"))
-    assert pgconn.parameter_status(b"application_name") == b"psycopg3 tests"
+    assert pgconn.parameter_status(b"application_name") == b"psycopg tests"
     assert pgconn.parameter_status(b"wat") is None
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.parameter_status(b"application_name")
 
 
@@ -271,21 +271,21 @@ def test_encoding(pgconn):
     assert pgconn.parameter_status(b"client_encoding") == b"UTF8"
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.parameter_status(b"client_encoding")
 
 
 def test_protocol_version(pgconn):
     assert pgconn.protocol_version == 3
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.protocol_version
 
 
 def test_server_version(pgconn):
     assert pgconn.server_version >= 90400
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.server_version
 
 
@@ -299,7 +299,7 @@ def test_socket(pgconn):
     # so let's see if at least an ok value comes out of it.
     try:
         assert pgconn.socket == socket
-    except psycopg3.OperationalError:
+    except psycopg.OperationalError:
         pass
 
 
@@ -316,7 +316,7 @@ def test_error_message(pgconn):
 def test_backend_pid(pgconn):
     assert isinstance(pgconn.backend_pid, int)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.backend_pid
 
 
@@ -362,12 +362,12 @@ def test_ssl_in_use(pgconn):
             assert pgconn.ssl_in_use
 
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.ssl_in_use
 
 
 def test_set_single_row_mode(pgconn):
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.set_single_row_mode()
 
     pgconn.send_query(b"select 1")
@@ -380,14 +380,14 @@ def test_cancel(pgconn):
     cancel.cancel()
     pgconn.finish()
     cancel.cancel()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         pgconn.get_cancel()
 
 
 def test_cancel_free(pgconn):
     cancel = pgconn.get_cancel()
     cancel.free()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         cancel.cancel()
     cancel.free()
 
@@ -445,7 +445,7 @@ def test_notice(pgconn):
 
 
 def test_notice_error(pgconn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3")
+    caplog.set_level(logging.WARNING, logger="psycopg")
 
     def callback(res):
         raise Exception("hello error")
index 5004bf65273bd637d5565706206e93886ee1f004..0cfcfcf45170bf20428811393d8322e4db590463 100644 (file)
@@ -1,7 +1,7 @@
 import ctypes
 import pytest
 
-from psycopg3 import pq
+from psycopg import pq
 
 
 @pytest.mark.parametrize(
index 0411bf2f950a29958ae605f9b669997799fb9284..98b7b626644c55fa802510a1a7b3120e94949d83 100644 (file)
@@ -1,4 +1,4 @@
-from psycopg3 import pq
+from psycopg import pq
 
 
 def test_version():
index cb143ebd82dd0e74e3bb71f4a6bb750215a5b6bb..d4fc5822d3bd6982ecd7cd50401fee1feb471b36 100644 (file)
@@ -3,17 +3,17 @@ A quick and rough performance comparison of text vs. binary Decimal adaptation
 """
 from random import randrange
 from decimal import Decimal
-import psycopg3
-from psycopg3 import sql
+import psycopg
+from psycopg import sql
 
 ncols = 10
 nrows = 500000
-format = psycopg3.pq.Format.BINARY
+format = psycopg.pq.Format.BINARY
 test = "copy"
 
 
 def main():
-    cnn = psycopg3.connect()
+    cnn = psycopg.connect()
 
     cnn.execute(
         sql.SQL("create table testdec ({})").format(
index 00030b266d9f59425bff42e87fdf6a7ad838bb99..1e7a52810f502ac47bc3faf4344e9d618148894f 100644 (file)
@@ -13,7 +13,7 @@ import sys
 import time
 import threading
 
-import psycopg3.pool
+import psycopg.pool
 
 import logging
 
@@ -28,7 +28,7 @@ def main():
 
         logging.getLogger("psycopg2.pool").setLevel(loglevel)
 
-    with psycopg3.pool.ConnectionPool(
+    with psycopg.pool.ConnectionPool(
         opt.dsn,
         min_size=opt.min_size,
         max_size=opt.max_size,
@@ -102,7 +102,7 @@ class Measurer:
             time.sleep(interval)
 
 
-class DelayedConnection(psycopg3.Connection):
+class DelayedConnection(psycopg.Connection):
     """A connection adding a delay to the connection time."""
 
     @classmethod
index decc3dc90305fdd3af8ec8e0f14889f3627a2267..3988d7d37044619eb6a6533fe3be0fb53b29cd4d 100644 (file)
@@ -3,10 +3,10 @@ from types import ModuleType
 
 import pytest
 
-import psycopg3
-from psycopg3 import pq
-from psycopg3.adapt import Transformer, Format, Dumper, Loader
-from psycopg3.oids import postgres_types as builtins, TEXT_OID
+import psycopg
+from psycopg import pq
+from psycopg.adapt import Transformer, Format, Dumper, Loader
+from psycopg.oids import postgres_types as builtins, TEXT_OID
 
 
 @pytest.mark.parametrize(
@@ -94,7 +94,7 @@ def test_dump_subclass(conn, fmt_out):
 
 def test_subclass_dumper(conn):
     # This might be a C fast object: make sure that the Python code is called
-    from psycopg3.types.string import StrDumper
+    from psycopg.types.string import StrDumper
 
     class MyStrDumper(StrDumper):
         def dump(self, obj):
@@ -106,7 +106,7 @@ def test_subclass_dumper(conn):
 
 def test_subclass_loader(conn):
     # This might be a C fast object: make sure that the Python code is called
-    from psycopg3.types.string import TextLoader
+    from psycopg.types.string import TextLoader
 
     class MyTextLoader(TextLoader):
         def load(self, data):
@@ -237,7 +237,7 @@ def test_array_dumper(conn, fmt_out):
 
     L = []
     L.append(L)
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         assert t.get_dumper(L, fmt_in)
 
 
@@ -292,28 +292,28 @@ def test_no_cast_needed(conn, fmt_in):
     assert cur.fetchone()[0] == 20
 
 
-@pytest.mark.skipif(psycopg3.pq.__impl__ == "python", reason="C module test")
+@pytest.mark.skipif(psycopg.pq.__impl__ == "python", reason="C module test")
 def test_optimised_adapters():
 
-    from psycopg3_c import _psycopg3
+    from psycopg_c import _psycopg
 
     # All the optimised adapters available
     c_adapters = {}
-    for n in dir(_psycopg3):
+    for n in dir(_psycopg):
         if n.startswith("_") or n in ("CDumper", "CLoader"):
             continue
-        obj = getattr(_psycopg3, n)
+        obj = getattr(_psycopg, n)
         if not isinstance(obj, type):
             continue
-        if not issubclass(obj, (_psycopg3.CDumper, _psycopg3.CLoader)):
+        if not issubclass(obj, (_psycopg.CDumper, _psycopg.CLoader)):
             continue
         c_adapters[n] = obj
 
     # All the registered adapters
     reg_adapters = set()
     adapters = (
-        list(psycopg3.global_adapters._dumpers.values())
-        + psycopg3.global_adapters._loaders
+        list(psycopg.global_adapters._dumpers.values())
+        + psycopg.global_adapters._loaders
     )
     assert len(adapters) == 5
     for m in adapters:
@@ -329,8 +329,8 @@ def test_optimised_adapters():
     assert n >= 10
 
     # Check that every optimised adapter is the optimised version of a Py one
-    for n in dir(psycopg3.types):
-        mod = getattr(psycopg3.types, n)
+    for n in dir(psycopg.types):
+        mod = getattr(psycopg.types, n)
         if not isinstance(mod, ModuleType):
             continue
         for n1 in dir(mod):
@@ -357,7 +357,7 @@ def test_random(conn, faker, fmt, fmt_out):
         cur.execute(faker.create_stmt)
         try:
             cur.executemany(faker.insert_stmt, faker.records)
-        except psycopg3.DatabaseError:
+        except psycopg.DatabaseError:
             # Insert one by one to find problematic values
             conn.rollback()
             cur.execute(faker.drop_stmt)
index 2f9347bf169f9e66eabd4a633af02078109a0a68..308eaa7278648a05ce45232a8a1eac7622edde1b 100644 (file)
@@ -11,13 +11,13 @@ import selectors
 import threading
 import subprocess as sp
 
-import psycopg3
+import psycopg
 
 
 @pytest.mark.slow
 def test_concurrent_execution(dsn):
     def worker():
-        cnn = psycopg3.connect(dsn)
+        cnn = psycopg.connect(dsn)
         cur = cnn.cursor()
         cur.execute("select pg_sleep(0.5)")
         cur.close()
@@ -67,10 +67,10 @@ def test_multiprocess_close(dsn, tmpdir):
     # Subprocess gcs the copy of the fd after fork so it closes connection.
     module = f"""\
 import time
-import psycopg3
+import psycopg
 
 def thread():
-    conn = psycopg3.connect({dsn!r})
+    conn = psycopg.connect({dsn!r})
     curs = conn.cursor()
     for i in range(10):
         curs.execute("select 1")
@@ -105,7 +105,7 @@ t.join()
 
 @pytest.mark.slow
 def test_notifies(conn, dsn):
-    nconn = psycopg3.connect(dsn, autocommit=True)
+    nconn = psycopg.connect(dsn, autocommit=True)
     npid = nconn.pgconn.backend_pid
 
     def notifier():
@@ -131,7 +131,7 @@ def test_notifies(conn, dsn):
     assert len(ns) == 2
 
     n, t1 = ns[0]
-    assert isinstance(n, psycopg3.Notify)
+    assert isinstance(n, psycopg.Notify)
     assert n.pid == npid
     assert n.channel == "foo"
     assert n.payload == "1"
@@ -161,7 +161,7 @@ def test_cancel(conn):
     t0 = time.time()
     t.start()
 
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         cur.execute("select pg_sleep(2)")
 
     t1 = time.time()
@@ -175,7 +175,7 @@ def test_cancel(conn):
 
 @pytest.mark.slow
 def test_identify_closure(conn, dsn):
-    conn2 = psycopg3.connect(dsn)
+    conn2 = psycopg.connect(dsn)
 
     def closer():
         time.sleep(0.3)
@@ -190,7 +190,7 @@ def test_identify_closure(conn, dsn):
     t.start()
 
     assert sel.select(timeout=1.0)
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         conn.execute("select 1")
     t1 = time.time()
     assert 0.3 < t1 - t0 < 0.5
index 0a57dcc7f7216f6a74ae9c10dcb2a17faa8548cc..023d0ab43bfbaced38cb913cbf18e0ac7cc2c77c 100644 (file)
@@ -3,8 +3,8 @@ import pytest
 import asyncio
 from asyncio.queues import Queue
 
-import psycopg3
-from psycopg3.compat import create_task
+import psycopg
+from psycopg.compat import create_task
 
 pytestmark = pytest.mark.asyncio
 
@@ -44,7 +44,7 @@ async def test_commit_concurrency(aconn):
 @pytest.mark.slow
 async def test_concurrent_execution(dsn):
     async def worker():
-        cnn = await psycopg3.AsyncConnection.connect(dsn)
+        cnn = await psycopg.AsyncConnection.connect(dsn)
         cur = cnn.cursor()
         await cur.execute("select pg_sleep(0.5)")
         await cur.close()
@@ -58,7 +58,7 @@ async def test_concurrent_execution(dsn):
 
 @pytest.mark.slow
 async def test_notifies(aconn, dsn):
-    nconn = await psycopg3.AsyncConnection.connect(dsn, autocommit=True)
+    nconn = await psycopg.AsyncConnection.connect(dsn, autocommit=True)
     npid = nconn.pgconn.backend_pid
 
     async def notifier():
@@ -112,7 +112,7 @@ async def test_cancel(aconn):
 
     async def worker():
         cur = aconn.cursor()
-        with pytest.raises(psycopg3.DatabaseError):
+        with pytest.raises(psycopg.DatabaseError):
             await cur.execute("select pg_sleep(2)")
 
     workers = [worker(), canceller()]
@@ -133,7 +133,7 @@ async def test_cancel(aconn):
 
 @pytest.mark.slow
 async def test_identify_closure(aconn, dsn):
-    conn2 = await psycopg3.AsyncConnection.connect(dsn)
+    conn2 = await psycopg.AsyncConnection.connect(dsn)
 
     async def closer():
         await asyncio.sleep(0.3)
@@ -148,7 +148,7 @@ async def test_identify_closure(aconn, dsn):
     create_task(closer())
 
     await asyncio.wait_for(ev.wait(), 1.0)
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await aconn.execute("select 1")
     t1 = time.time()
     assert 0.3 < t1 - t0 < 0.5
index 3b4ae43c7059aeea4cf9605a55861220713b2d16..afc2c1ecb6e1da9264572bc5b6a45e352222239f 100644 (file)
@@ -6,12 +6,12 @@ import logging
 import weakref
 from threading import Thread
 
-import psycopg3
-from psycopg3 import encodings
-from psycopg3 import Connection, Notify
-from psycopg3.rows import tuple_row
-from psycopg3.errors import UndefinedTable
-from psycopg3.conninfo import conninfo_to_dict
+import psycopg
+from psycopg import encodings
+from psycopg import Connection, Notify
+from psycopg.rows import tuple_row
+from psycopg.errors import UndefinedTable
+from psycopg.conninfo import conninfo_to_dict
 
 from .utils import gc_collect
 from .test_cursor import my_row_factory
@@ -33,7 +33,7 @@ def test_connect_str_subclass(dsn):
 
 
 def test_connect_bad():
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         Connection.connect("dbname=nosuchdb")
 
 
@@ -52,7 +52,7 @@ def test_connect_timeout():
     Thread(target=closer).start()
 
     t0 = time.time()
-    with pytest.raises(psycopg3.OperationalError, match="timeout expired"):
+    with pytest.raises(psycopg.OperationalError, match="timeout expired"):
         Connection.connect(host="localhost", port=port, connect_timeout=1)
     elapsed = time.time() - t0
     assert elapsed == pytest.approx(1.0, abs=0.05)
@@ -72,12 +72,12 @@ def test_close(conn):
     assert conn.closed
     assert conn.pgconn.status == conn.ConnStatus.BAD
 
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         cur.execute("select 1")
 
 
 def test_broken(conn):
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         conn.execute(
             "select pg_terminate_backend(%s)", [conn.pgconn.backend_pid]
         )
@@ -126,7 +126,7 @@ def test_context_commit(conn, dsn):
     assert conn.closed
     assert not conn.broken
 
-    with psycopg3.connect(dsn) as conn:
+    with psycopg.connect(dsn) as conn:
         with conn.cursor() as cur:
             cur.execute("select * from textctx")
             assert cur.fetchall() == []
@@ -146,7 +146,7 @@ def test_context_rollback(conn, dsn):
     assert conn.closed
     assert not conn.broken
 
-    with psycopg3.connect(dsn) as conn:
+    with psycopg.connect(dsn) as conn:
         with conn.cursor() as cur:
             with pytest.raises(UndefinedTable):
                 cur.execute("select * from textctx")
@@ -160,7 +160,7 @@ def test_context_close(conn):
 
 def test_context_rollback_no_clobber(conn, dsn, recwarn):
     with pytest.raises(ZeroDivisionError):
-        with psycopg3.connect(dsn) as conn2:
+        with psycopg.connect(dsn) as conn2:
             conn2.execute("select 1")
             conn.execute(
                 "select pg_terminate_backend(%s::int)",
@@ -172,7 +172,7 @@ def test_context_rollback_no_clobber(conn, dsn, recwarn):
 
 
 def test_weakref(dsn):
-    conn = psycopg3.connect(dsn)
+    conn = psycopg.connect(dsn)
     w = weakref.ref(conn)
     conn.close()
     del conn
@@ -192,7 +192,7 @@ def test_commit(conn):
     assert res.get_value(0, 0) == b"1"
 
     conn.close()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         conn.commit()
 
 
@@ -208,7 +208,7 @@ def test_rollback(conn):
     assert res.ntuples == 0
 
     conn.close()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         conn.rollback()
 
 
@@ -238,11 +238,11 @@ def test_auto_transaction_fail(conn):
     cur.execute("insert into foo values (1)")
     assert conn.pgconn.transaction_status == conn.TransactionStatus.INTRANS
 
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         cur.execute("meh")
     assert conn.pgconn.transaction_status == conn.TransactionStatus.INERROR
 
-    with pytest.raises(psycopg3.errors.InFailedSqlTransaction):
+    with pytest.raises(psycopg.errors.InFailedSqlTransaction):
         cur.execute("select 1")
 
     conn.commit()
@@ -269,17 +269,17 @@ def test_autocommit_intrans(conn):
     cur = conn.cursor()
     assert cur.execute("select 1").fetchone() == (1,)
     assert conn.pgconn.transaction_status == conn.TransactionStatus.INTRANS
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         conn.autocommit = True
     assert not conn.autocommit
 
 
 def test_autocommit_inerror(conn):
     cur = conn.cursor()
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         cur.execute("meh")
     assert conn.pgconn.transaction_status == conn.TransactionStatus.INERROR
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         conn.autocommit = True
     assert not conn.autocommit
 
@@ -287,7 +287,7 @@ def test_autocommit_inerror(conn):
 def test_autocommit_unknown(conn):
     conn.close()
     assert conn.pgconn.transaction_status == conn.TransactionStatus.UNKNOWN
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         conn.autocommit = True
     assert not conn.autocommit
 
@@ -337,7 +337,7 @@ def test_normalize_encoding(conn, enc, out, codec):
 )
 def test_encoding_env_var(dsn, monkeypatch, enc, out, codec):
     monkeypatch.setenv("PGCLIENTENCODING", enc)
-    conn = psycopg3.connect(dsn)
+    conn = psycopg.connect(dsn)
     assert (
         conn.pgconn.parameter_status(b"client_encoding").decode("utf-8") == out
     )
@@ -347,7 +347,7 @@ def test_encoding_env_var(dsn, monkeypatch, enc, out, codec):
 def test_set_encoding_unsupported(conn):
     cur = conn.cursor()
     cur.execute("set client_encoding to EUC_TW")
-    with pytest.raises(psycopg3.NotSupportedError):
+    with pytest.raises(psycopg.NotSupportedError):
         cur.execute("select 'x'")
 
 
@@ -380,8 +380,8 @@ def test_connect_args(monkeypatch, pgconn, args, kwargs, want):
         return pgconn
         yield
 
-    monkeypatch.setattr(psycopg3.connection, "connect", fake_connect)
-    psycopg3.Connection.connect(*args, **kwargs)
+    monkeypatch.setattr(psycopg.connection, "connect", fake_connect)
+    psycopg.Connection.connect(*args, **kwargs)
     assert conninfo_to_dict(the_conninfo) == conninfo_to_dict(want)
 
 
@@ -398,20 +398,20 @@ def test_connect_badargs(monkeypatch, pgconn, args, kwargs):
         return pgconn
         yield
 
-    monkeypatch.setattr(psycopg3.connection, "connect", fake_connect)
-    with pytest.raises((TypeError, psycopg3.ProgrammingError)):
-        psycopg3.Connection.connect(*args, **kwargs)
+    monkeypatch.setattr(psycopg.connection, "connect", fake_connect)
+    with pytest.raises((TypeError, psycopg.ProgrammingError)):
+        psycopg.Connection.connect(*args, **kwargs)
 
 
 def test_broken_connection(conn):
     cur = conn.cursor()
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         cur.execute("select pg_terminate_backend(pg_backend_pid())")
     assert conn.closed
 
 
 def test_notice_handlers(conn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3")
+    caplog.set_level(logging.WARNING, logger="psycopg")
     messages = []
     severities = []
 
@@ -538,5 +538,5 @@ def test_str(conn):
 def test_fileno(conn):
     assert conn.fileno() == conn.pgconn.socket
     conn.close()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         conn.fileno()
index cf1356164912ab46b96adf49c9c7c319c2219927..779925f4dcd7392667718f84cf1f5d01ea842ba5 100644 (file)
@@ -5,12 +5,12 @@ import asyncio
 import logging
 import weakref
 
-import psycopg3
-from psycopg3 import encodings
-from psycopg3 import AsyncConnection, Notify
-from psycopg3.rows import tuple_row
-from psycopg3.errors import UndefinedTable
-from psycopg3.conninfo import conninfo_to_dict
+import psycopg
+from psycopg import encodings
+from psycopg import AsyncConnection, Notify
+from psycopg.rows import tuple_row
+from psycopg.errors import UndefinedTable
+from psycopg.conninfo import conninfo_to_dict
 
 from .utils import gc_collect
 from .test_cursor import my_row_factory
@@ -25,7 +25,7 @@ async def test_connect(dsn):
 
 
 async def test_connect_bad():
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await AsyncConnection.connect("dbname=nosuchdb")
 
 
@@ -51,7 +51,7 @@ async def test_connect_timeout():
 
     async def connect():
         t0 = time.time()
-        with pytest.raises(psycopg3.OperationalError, match="timeout expired"):
+        with pytest.raises(psycopg.OperationalError, match="timeout expired"):
             await AsyncConnection.connect(
                 host="localhost", port=port, connect_timeout=1
             )
@@ -77,12 +77,12 @@ async def test_close(aconn):
     assert aconn.closed
     assert aconn.pgconn.status == aconn.ConnStatus.BAD
 
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await cur.execute("select 1")
 
 
 async def test_broken(aconn):
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await aconn.execute(
             "select pg_terminate_backend(%s)", [aconn.pgconn.backend_pid]
         )
@@ -131,7 +131,7 @@ async def test_context_commit(aconn, dsn):
     assert aconn.closed
     assert not aconn.broken
 
-    async with await psycopg3.AsyncConnection.connect(dsn) as aconn:
+    async with await psycopg.AsyncConnection.connect(dsn) as aconn:
         async with aconn.cursor() as cur:
             await cur.execute("select * from textctx")
             assert await cur.fetchall() == []
@@ -151,7 +151,7 @@ async def test_context_rollback(aconn, dsn):
     assert aconn.closed
     assert not aconn.broken
 
-    async with await psycopg3.AsyncConnection.connect(dsn) as aconn:
+    async with await psycopg.AsyncConnection.connect(dsn) as aconn:
         async with aconn.cursor() as cur:
             with pytest.raises(UndefinedTable):
                 await cur.execute("select * from textctx")
@@ -165,7 +165,7 @@ async def test_context_close(aconn):
 
 async def test_context_rollback_no_clobber(conn, dsn, recwarn):
     with pytest.raises(ZeroDivisionError):
-        async with await psycopg3.AsyncConnection.connect(dsn) as conn2:
+        async with await psycopg.AsyncConnection.connect(dsn) as conn2:
             await conn2.execute("select 1")
             conn.execute(
                 "select pg_terminate_backend(%s::int)",
@@ -177,7 +177,7 @@ async def test_context_rollback_no_clobber(conn, dsn, recwarn):
 
 
 async def test_weakref(dsn):
-    conn = await psycopg3.AsyncConnection.connect(dsn)
+    conn = await psycopg.AsyncConnection.connect(dsn)
     w = weakref.ref(conn)
     await conn.close()
     del conn
@@ -197,7 +197,7 @@ async def test_commit(aconn):
     assert res.get_value(0, 0) == b"1"
 
     await aconn.close()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await aconn.commit()
 
 
@@ -213,7 +213,7 @@ async def test_rollback(aconn):
     assert res.ntuples == 0
 
     await aconn.close()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await aconn.rollback()
 
 
@@ -244,7 +244,7 @@ async def test_auto_transaction_fail(aconn):
     await cur.execute("insert into foo values (1)")
     assert aconn.pgconn.transaction_status == aconn.TransactionStatus.INTRANS
 
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         await cur.execute("meh")
     assert aconn.pgconn.transaction_status == aconn.TransactionStatus.INERROR
 
@@ -270,7 +270,7 @@ async def test_autocommit(aconn):
 
 
 async def test_autocommit_connect(dsn):
-    aconn = await psycopg3.AsyncConnection.connect(dsn, autocommit=True)
+    aconn = await psycopg.AsyncConnection.connect(dsn, autocommit=True)
     assert aconn.autocommit
 
 
@@ -279,17 +279,17 @@ async def test_autocommit_intrans(aconn):
     await cur.execute("select 1")
     assert await cur.fetchone() == (1,)
     assert aconn.pgconn.transaction_status == aconn.TransactionStatus.INTRANS
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         await aconn.set_autocommit(True)
     assert not aconn.autocommit
 
 
 async def test_autocommit_inerror(aconn):
     cur = aconn.cursor()
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         await cur.execute("meh")
     assert aconn.pgconn.transaction_status == aconn.TransactionStatus.INERROR
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         await aconn.set_autocommit(True)
     assert not aconn.autocommit
 
@@ -297,7 +297,7 @@ async def test_autocommit_inerror(aconn):
 async def test_autocommit_unknown(aconn):
     await aconn.close()
     assert aconn.pgconn.transaction_status == aconn.TransactionStatus.UNKNOWN
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         await aconn.set_autocommit(True)
     assert not aconn.autocommit
 
@@ -355,7 +355,7 @@ async def test_normalize_encoding(aconn, enc, out, codec):
 )
 async def test_encoding_env_var(dsn, monkeypatch, enc, out, codec):
     monkeypatch.setenv("PGCLIENTENCODING", enc)
-    aconn = await psycopg3.AsyncConnection.connect(dsn)
+    aconn = await psycopg.AsyncConnection.connect(dsn)
     assert (
         aconn.pgconn.parameter_status(b"client_encoding").decode("utf-8")
         == out
@@ -366,7 +366,7 @@ async def test_encoding_env_var(dsn, monkeypatch, enc, out, codec):
 async def test_set_encoding_unsupported(aconn):
     cur = aconn.cursor()
     await cur.execute("set client_encoding to EUC_TW")
-    with pytest.raises(psycopg3.NotSupportedError):
+    with pytest.raises(psycopg.NotSupportedError):
         await cur.execute("select 'x'")
 
 
@@ -399,8 +399,8 @@ async def test_connect_args(monkeypatch, pgconn, args, kwargs, want):
         return pgconn
         yield
 
-    monkeypatch.setattr(psycopg3.connection, "connect", fake_connect)
-    await psycopg3.AsyncConnection.connect(*args, **kwargs)
+    monkeypatch.setattr(psycopg.connection, "connect", fake_connect)
+    await psycopg.AsyncConnection.connect(*args, **kwargs)
     assert conninfo_to_dict(the_conninfo) == conninfo_to_dict(want)
 
 
@@ -417,20 +417,20 @@ async def test_connect_badargs(monkeypatch, pgconn, args, kwargs):
         return pgconn
         yield
 
-    monkeypatch.setattr(psycopg3.connection, "connect", fake_connect)
-    with pytest.raises((TypeError, psycopg3.ProgrammingError)):
-        await psycopg3.AsyncConnection.connect(*args, **kwargs)
+    monkeypatch.setattr(psycopg.connection, "connect", fake_connect)
+    with pytest.raises((TypeError, psycopg.ProgrammingError)):
+        await psycopg.AsyncConnection.connect(*args, **kwargs)
 
 
 async def test_broken_connection(aconn):
     cur = aconn.cursor()
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         await cur.execute("select pg_terminate_backend(pg_backend_pid())")
     assert aconn.closed
 
 
 async def test_notice_handlers(aconn, caplog):
-    caplog.set_level(logging.WARNING, logger="psycopg3")
+    caplog.set_level(logging.WARNING, logger="psycopg")
     messages = []
     severities = []
 
@@ -556,5 +556,5 @@ async def test_str(aconn):
 async def test_fileno(aconn):
     assert aconn.fileno() == aconn.pgconn.socket
     await aconn.close()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         aconn.fileno()
index eb2e8c65d6c32221a5c41049692fea65cdab11e7..d98e0c543b37d7b4042853b578c9403cd5849457 100644 (file)
@@ -2,9 +2,9 @@ import datetime as dt
 
 import pytest
 
-import psycopg3
-from psycopg3 import ProgrammingError
-from psycopg3.conninfo import (
+import psycopg
+from psycopg import ProgrammingError
+from psycopg.conninfo import (
     _conninfo_connect_timeout,
     make_conninfo,
     conninfo_to_dict,
@@ -136,7 +136,7 @@ class TestConnectionInfo:
         else:
             info_attr = pgconn_attr = attr
 
-        if info_attr == "hostaddr" and psycopg3.pq.version() < 120000:
+        if info_attr == "hostaddr" and psycopg.pq.version() < 120000:
             pytest.skip("hostaddr not supported on libpq < 12")
 
         info_val = getattr(conn.info, info_attr)
@@ -144,18 +144,18 @@ class TestConnectionInfo:
         assert info_val == pgconn_val
 
         conn.close()
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             getattr(conn.info, info_attr)
 
     @pytest.mark.libpq("< 12")
     def test_hostaddr_not_supported(self, conn):
-        with pytest.raises(psycopg3.NotSupportedError):
+        with pytest.raises(psycopg.NotSupportedError):
             conn.info.hostaddr
 
     def test_port(self, conn):
         assert conn.info.port == int(conn.pgconn.port.decode("utf-8"))
         conn.close()
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             conn.info.port
 
     def test_get_params(self, conn, dsn):
@@ -168,11 +168,11 @@ class TestConnectionInfo:
         dsn.pop("application_name", None)
 
         monkeypatch.delenv("PGAPPNAME", raising=False)
-        with psycopg3.connect(**dsn) as conn:
+        with psycopg.connect(**dsn) as conn:
             assert "application_name" not in conn.info.get_parameters()
 
         monkeypatch.setenv("PGAPPNAME", "hello test")
-        with psycopg3.connect(**dsn) as conn:
+        with psycopg.connect(**dsn) as conn:
             assert (
                 conn.info.get_parameters()["application_name"] == "hello test"
             )
@@ -189,7 +189,7 @@ class TestConnectionInfo:
 
     def test_no_password(self, dsn):
         dsn2 = make_conninfo(dsn, password="the-pass-word")
-        pgconn = psycopg3.pq.PGconn.connect_start(dsn2.encode("utf8"))
+        pgconn = psycopg.pq.PGconn.connect_start(dsn2.encode("utf8"))
         info = ConnectionInfo(pgconn)
         assert info.password == "the-pass-word"
         assert "password" not in info.get_parameters()
@@ -209,7 +209,7 @@ class TestConnectionInfo:
 
     def test_error_message(self, conn):
         assert conn.info.error_message == ""
-        with pytest.raises(psycopg3.ProgrammingError) as ex:
+        with pytest.raises(psycopg.ProgrammingError) as ex:
             conn.execute("wat")
 
         assert conn.info.error_message
@@ -217,14 +217,14 @@ class TestConnectionInfo:
         assert ex.value.diag.severity in conn.info.error_message
 
         conn.close()
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             conn.info.error_message
 
     def test_backend_pid(self, conn):
         assert conn.info.backend_pid
         assert conn.info.backend_pid == conn.pgconn.backend_pid
         conn.close()
-        with pytest.raises(psycopg3.OperationalError):
+        with pytest.raises(psycopg.OperationalError):
             conn.info.backend_pid
 
     def test_timezone(self, conn):
index 70d0dd2169177c22c3b50e68bfd9846f555e41c5..b62097a728ce6138e04c48cc04f94df820439fd1 100644 (file)
@@ -6,13 +6,13 @@ from itertools import cycle
 
 import pytest
 
-import psycopg3
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3 import errors as e
-from psycopg3.pq import Format
-from psycopg3.adapt import Format as PgFormat
-from psycopg3.types.numeric import Int4
+import psycopg
+from psycopg import pq
+from psycopg import sql
+from psycopg import errors as e
+from psycopg.pq import Format
+from psycopg.adapt import Format as PgFormat
+from psycopg.types.numeric import Int4
 
 from .utils import gc_collect
 
@@ -259,9 +259,9 @@ def test_copy_in_empty(conn, format):
 @pytest.mark.parametrize("format", [Format.TEXT, Format.BINARY])
 def test_subclass_adapter(conn, format):
     if format == Format.TEXT:
-        from psycopg3.types.string import StrDumper as BaseDumper
+        from psycopg.types.string import StrDumper as BaseDumper
     else:
-        from psycopg3.types.string import StrBinaryDumper as BaseDumper
+        from psycopg.types.string import StrBinaryDumper as BaseDumper
 
     class MyStrDumper(BaseDumper):
         def dump(self, obj):
@@ -501,7 +501,7 @@ def test_copy_to_leaks(dsn, faker, fmt, method, retries):
     faker.make_records(20)
 
     def work():
-        with psycopg3.connect(dsn) as conn:
+        with psycopg.connect(dsn) as conn:
             with conn.cursor(binary=fmt) as cur:
                 cur.execute(faker.drop_stmt)
                 cur.execute(faker.create_stmt)
@@ -558,7 +558,7 @@ def test_copy_from_leaks(dsn, faker, fmt, retries):
     faker.make_records(20)
 
     def work():
-        with psycopg3.connect(dsn) as conn:
+        with psycopg.connect(dsn) as conn:
             with conn.cursor(binary=fmt) as cur:
                 cur.execute(faker.drop_stmt)
                 cur.execute(faker.create_stmt)
index 4675e8b77ae6aece99c3b915cbaed942e0a06594..c34286e78e0e5c046f2bdbb5bc5f320a5a80d5bd 100644 (file)
@@ -6,12 +6,12 @@ from itertools import cycle
 
 import pytest
 
-import psycopg3
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3 import errors as e
-from psycopg3.pq import Format
-from psycopg3.adapt import Format as PgFormat
+import psycopg
+from psycopg import pq
+from psycopg import sql
+from psycopg import errors as e
+from psycopg.pq import Format
+from psycopg.adapt import Format as PgFormat
 
 from .utils import gc_collect
 from .test_copy import sample_text, sample_binary, sample_binary_rows  # noqa
@@ -477,7 +477,7 @@ async def test_copy_to_leaks(dsn, faker, fmt, method, retries):
     faker.make_records(20)
 
     async def work():
-        async with await psycopg3.AsyncConnection.connect(dsn) as conn:
+        async with await psycopg.AsyncConnection.connect(dsn) as conn:
             async with conn.cursor(binary=fmt) as cur:
                 await cur.execute(faker.drop_stmt)
                 await cur.execute(faker.create_stmt)
@@ -536,7 +536,7 @@ async def test_copy_from_leaks(dsn, faker, fmt, retries):
     faker.make_records(20)
 
     async def work():
-        async with await psycopg3.AsyncConnection.connect(dsn) as conn:
+        async with await psycopg.AsyncConnection.connect(dsn) as conn:
             async with conn.cursor(binary=fmt) as cur:
                 await cur.execute(faker.drop_stmt)
                 await cur.execute(faker.create_stmt)
index e3caa85a1441bbb018149f34b3efe4e6f0b44205..49e3f23136906719fa4c36b1ebd3abe7e79443c0 100644 (file)
@@ -5,10 +5,10 @@ import datetime as dt
 
 import pytest
 
-import psycopg3
-from psycopg3 import pq, sql, rows
-from psycopg3.oids import postgres_types as builtins
-from psycopg3.adapt import Format
+import psycopg
+from psycopg import pq, sql, rows
+from psycopg.oids import postgres_types as builtins
+from psycopg.adapt import Format
 
 from .utils import gc_collect
 
@@ -19,7 +19,7 @@ def test_close(conn):
     cur.close()
     assert cur.closed
 
-    with pytest.raises(psycopg3.InterfaceError):
+    with pytest.raises(psycopg.InterfaceError):
         cur.execute("select 'foo'")
 
     cur.close()
@@ -85,7 +85,7 @@ def test_execute_empty_query(conn, query):
     cur = conn.cursor()
     cur.execute(query)
     assert cur.status == cur.ExecStatus.EMPTY_QUERY
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         cur.fetchone()
 
 
@@ -95,7 +95,7 @@ def test_execute_empty_query(conn, query):
 def test_execute_copy(conn, query):
     cur = conn.cursor()
     cur.execute("create table testcopy (id int)")
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         cur.execute(query)
 
 
@@ -204,7 +204,7 @@ def test_executemany_returning_rowcount(conn, execmany):
 )
 def test_executemany_badquery(conn, query):
     cur = conn.cursor()
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         cur.executemany(query, [(10, "hello"), (20, "world")])
 
 
@@ -216,7 +216,7 @@ def test_executemany_null_first(conn, fmt_in):
         f"insert into testmany values (%{fmt_in}, %{fmt_in})",
         [[1, None], [3, 4]],
     )
-    with pytest.raises((psycopg3.DataError, psycopg3.ProgrammingError)):
+    with pytest.raises((psycopg.DataError, psycopg.ProgrammingError)):
         cur.executemany(
             f"insert into testmany values (%{fmt_in}, %{fmt_in})",
             [[1, ""], [3, 4]],
@@ -306,7 +306,7 @@ def test_row_factory(conn):
 
 def test_scroll(conn):
     cur = conn.cursor()
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         cur.scroll(0)
 
     cur.execute("select generate_series(0,9)")
@@ -359,7 +359,7 @@ def test_query_params_execute(conn):
     assert cur.query == b"select 1"
     assert cur.params is None
 
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         cur.execute("select %t::int", ["wat"])
 
     assert cur.query == b"select $1::int"
@@ -373,7 +373,7 @@ def test_query_params_executemany(conn):
     assert cur.query == b"select $1, $2"
     assert cur.params == [b"3", b"4"]
 
-    with pytest.raises((psycopg3.DataError, TypeError)):
+    with pytest.raises((psycopg.DataError, TypeError)):
         cur.executemany("select %t::int", [[1], ["x"], [2]])
     assert cur.query == b"select $1::int"
     # TODO: cannot really check this: after introduced row_dumpers, this
@@ -424,7 +424,7 @@ def test_stream_row_factory(conn):
 )
 def test_stream_badquery(conn, query):
     cur = conn.cursor()
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         for rec in cur.stream(query):
             pass
 
@@ -551,7 +551,7 @@ def test_leak(dsn, faker, fmt, fmt_out, fetch, row_factory):
 
     n = []
     for i in range(3):
-        with psycopg3.connect(dsn) as conn:
+        with psycopg.connect(dsn) as conn:
             with conn.cursor(binary=fmt_out, row_factory=row_factory) as cur:
                 cur.execute(faker.drop_stmt)
                 cur.execute(faker.create_stmt)
index c915231964130796a732accc7cb584ca519e8a22..3a206861bf3e70f404e52cdd0522809bfb3f06b0 100644 (file)
@@ -3,9 +3,9 @@ import pytest
 import weakref
 import datetime as dt
 
-import psycopg3
-from psycopg3 import pq, sql, rows
-from psycopg3.adapt import Format
+import psycopg
+from psycopg import pq, sql, rows
+from psycopg.adapt import Format
 
 from .utils import gc_collect
 from .test_cursor import my_row_factory
@@ -19,7 +19,7 @@ async def test_close(aconn):
     await cur.close()
     assert cur.closed
 
-    with pytest.raises(psycopg3.InterfaceError):
+    with pytest.raises(psycopg.InterfaceError):
         await cur.execute("select 'foo'")
 
     await cur.close()
@@ -88,7 +88,7 @@ async def test_execute_empty_query(aconn, query):
     cur = aconn.cursor()
     await cur.execute(query)
     assert cur.status == cur.ExecStatus.EMPTY_QUERY
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         await cur.fetchone()
 
 
@@ -98,7 +98,7 @@ async def test_execute_empty_query(aconn, query):
 async def test_execute_copy(aconn, query):
     cur = aconn.cursor()
     await cur.execute("create table testcopy (id int)")
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         await cur.execute(query)
 
 
@@ -204,7 +204,7 @@ async def test_executemany_returning_rowcount(aconn, execmany):
 )
 async def test_executemany_badquery(aconn, query):
     cur = aconn.cursor()
-    with pytest.raises(psycopg3.DatabaseError):
+    with pytest.raises(psycopg.DatabaseError):
         await cur.executemany(query, [(10, "hello"), (20, "world")])
 
 
@@ -216,7 +216,7 @@ async def test_executemany_null_first(aconn, fmt_in):
         f"insert into testmany values (%{fmt_in}, %{fmt_in})",
         [[1, None], [3, 4]],
     )
-    with pytest.raises((psycopg3.DataError, psycopg3.ProgrammingError)):
+    with pytest.raises((psycopg.DataError, psycopg.ProgrammingError)):
         await cur.executemany(
             f"insert into testmany values (%{fmt_in}, %{fmt_in})",
             [[1, ""], [3, 4]],
@@ -312,7 +312,7 @@ async def test_row_factory(aconn):
 
 async def test_scroll(aconn):
     cur = aconn.cursor()
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         await cur.scroll(0)
 
     await cur.execute("select generate_series(0,9)")
@@ -365,7 +365,7 @@ async def test_query_params_execute(aconn):
     assert cur.query == b"select 1"
     assert cur.params is None
 
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         await cur.execute("select %t::int", ["wat"])
 
     assert cur.query == b"select $1::int"
@@ -379,7 +379,7 @@ async def test_query_params_executemany(aconn):
     assert cur.query == b"select $1, $2"
     assert cur.params == [b"3", b"4"]
 
-    with pytest.raises((psycopg3.DataError, TypeError)):
+    with pytest.raises((psycopg.DataError, TypeError)):
         await cur.executemany("select %t::int", [[1], ["x"], [2]])
     assert cur.query == b"select $1::int"
     # TODO: cannot really check this: after introduced row_dumpers, this
@@ -430,7 +430,7 @@ async def test_stream_row_factory(aconn):
 )
 async def test_stream_badquery(aconn, query):
     cur = aconn.cursor()
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         async for rec in cur.stream(query):
             pass
 
@@ -465,7 +465,7 @@ async def test_leak(dsn, faker, fmt, fmt_out, fetch, row_factory):
 
     n = []
     for i in range(3):
-        async with await psycopg3.AsyncConnection.connect(dsn) as conn:
+        async with await psycopg.AsyncConnection.connect(dsn) as conn:
             async with conn.cursor(
                 binary=fmt_out, row_factory=row_factory
             ) as cur:
index 0267778bb5cd2b1a9a1a9b88f62dd71851c9a54a..9572813508a5cafb914aadfeed45028360cbc80c 100644 (file)
@@ -1,8 +1,8 @@
 import codecs
 import pytest
 
-import psycopg3
-from psycopg3 import encodings
+import psycopg
+from psycopg import encodings
 
 
 def test_names_normalised():
@@ -39,5 +39,5 @@ def test_pg2py(pyenc, pgenc):
 
 @pytest.mark.parametrize("pgenc", ["MULE_INTERNAL", "EUC_TW"])
 def test_pg2py_missing(pgenc):
-    with pytest.raises(psycopg3.NotSupportedError):
+    with pytest.raises(psycopg.NotSupportedError):
         encodings.pg2py(pgenc.encode("utf-8"))
index 154fee7757a48b36dad509243080972395d0bfd2..0f77fea404b5d82ece7e59903ddcd73ccfc22056 100644 (file)
@@ -3,8 +3,8 @@ from weakref import ref
 
 import pytest
 
-from psycopg3 import pq
-from psycopg3 import errors as e
+from psycopg import pq
+from psycopg import errors as e
 
 from .utils import gc_collect
 
index 6f594d815c36af7316257a62935e6e9ddbe3d4f3..e54f5f6c87b842f8f254cf91202ea05f211c248c 100644 (file)
@@ -11,11 +11,11 @@ import pytest
     ],
 )
 def test_connect(monkeypatch, dsn, args, kwargs, want_conninfo):
-    # Check the main args passing from psycopg3.connect to the conn generator
+    # Check the main args passing from psycopg.connect to the conn generator
     # Details of the params manipulation are in test_conninfo.
-    import psycopg3.connection
+    import psycopg.connection
 
-    orig_connect = psycopg3.connection.connect
+    orig_connect = psycopg.connection.connect
 
     got_conninfo = None
 
@@ -24,7 +24,7 @@ def test_connect(monkeypatch, dsn, args, kwargs, want_conninfo):
         got_conninfo = conninfo
         return orig_connect(dsn)
 
-    monkeypatch.setattr(psycopg3.connection, "connect", mock_connect)
+    monkeypatch.setattr(psycopg.connection, "connect", mock_connect)
 
-    psycopg3.connect(*args, **kwargs)
+    psycopg.connect(*args, **kwargs)
     assert got_conninfo == want_conninfo
index c36bd653df51e510efd5d82b99da2a0b2ccd12f8..1e0f03f235f0b7cae2292b6728ce78867684a4be 100644 (file)
@@ -1,8 +1,8 @@
 import pytest
 import datetime as dt
 
-import psycopg3
-from psycopg3.conninfo import conninfo_to_dict
+import psycopg
+from psycopg.conninfo import conninfo_to_dict
 
 from . import dbapi20
 
@@ -13,8 +13,8 @@ def with_dsn(request, dsn):
 
 
 @pytest.mark.usefixtures("with_dsn")
-class Psycopg3Tests(dbapi20.DatabaseAPI20Test):
-    driver = psycopg3
+class PsycopgTests(dbapi20.DatabaseAPI20Test):
+    driver = psycopg
     # connect_args = () # set by the fixture
     connect_kw_args = {}
 
@@ -28,7 +28,7 @@ class Psycopg3Tests(dbapi20.DatabaseAPI20Test):
 
 
 # Shut up warnings
-Psycopg3Tests.failUnless = Psycopg3Tests.assertTrue
+PsycopgTests.failUnless = PsycopgTests.assertTrue
 
 
 @pytest.mark.parametrize(
@@ -55,7 +55,7 @@ Psycopg3Tests.failUnless = Psycopg3Tests.assertTrue
     ],
 )
 def test_singletons(conn, typename, singleton):
-    singleton = getattr(psycopg3, singleton)
+    singleton = getattr(psycopg, singleton)
     cur = conn.cursor()
     cur.execute(f"select null::{typename}")
     oid = cur.description[0].type_code
@@ -73,7 +73,7 @@ def test_singletons(conn, typename, singleton):
     ],
 )
 def test_timestamp_from_ticks(ticks, want):
-    s = psycopg3.TimestampFromTicks(ticks)
+    s = psycopg.TimestampFromTicks(ticks)
     want = dt.datetime.strptime(want, "%Y-%m-%dT%H:%M:%S.%f%z")
     assert s == want
 
@@ -87,7 +87,7 @@ def test_timestamp_from_ticks(ticks, want):
     ],
 )
 def test_date_from_ticks(ticks, want):
-    s = psycopg3.DateFromTicks(ticks)
+    s = psycopg.DateFromTicks(ticks)
     if isinstance(want, str):
         want = [want]
     want = [dt.datetime.strptime(w, "%Y-%m-%d").date() for w in want]
@@ -99,7 +99,7 @@ def test_date_from_ticks(ticks, want):
     [(0, "00:00:00.000000"), (1273173119.99992, "00:11:59.999920")],
 )
 def test_time_from_ticks(ticks, want):
-    s = psycopg3.TimeFromTicks(ticks)
+    s = psycopg.TimeFromTicks(ticks)
     want = dt.datetime.strptime(want, "%H:%M:%S.%f").time()
     assert s.replace(hour=0) == want
 
@@ -128,8 +128,8 @@ def test_connect_args(monkeypatch, pgconn, args, kwargs, want):
         return pgconn
         yield
 
-    monkeypatch.setattr(psycopg3.connection, "connect", fake_connect)
-    psycopg3.connect(*args, **kwargs)
+    monkeypatch.setattr(psycopg.connection, "connect", fake_connect)
+    psycopg.connect(*args, **kwargs)
     assert conninfo_to_dict(the_conninfo) == conninfo_to_dict(want)
 
 
@@ -146,6 +146,6 @@ def test_connect_badargs(monkeypatch, pgconn, args, kwargs):
         return pgconn
         yield
 
-    monkeypatch.setattr(psycopg3.connection, "connect", fake_connect)
-    with pytest.raises((TypeError, psycopg3.ProgrammingError)):
-        psycopg3.connect(*args, **kwargs)
+    monkeypatch.setattr(psycopg.connection, "connect", fake_connect)
+    with pytest.raises((TypeError, psycopg.ProgrammingError)):
+        psycopg.connect(*args, **kwargs)
index 3c596f5ba16c5bea8c612482d3cf996562f0bf5f..12ac37e48563a761d61523d407e39a7fd9e39373 100644 (file)
@@ -1,9 +1,9 @@
 import pytest
 
-import psycopg3
-from psycopg3 import pq
-from psycopg3.adapt import Transformer, Format
-from psycopg3._queries import PostgresQuery, _split_query
+import psycopg
+from psycopg import pq
+from psycopg.adapt import Transformer, Format
+from psycopg._queries import PostgresQuery, _split_query
 
 
 @pytest.mark.parametrize(
@@ -61,7 +61,7 @@ def test_split_query(input, want):
     ],
 )
 def test_split_query_bad(input):
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         _split_query(input)
 
 
@@ -158,5 +158,5 @@ def test_pq_query_badtype(query, params):
 )
 def test_pq_query_badprog(query, params):
     pq = PostgresQuery(Transformer())
-    with pytest.raises(psycopg3.ProgrammingError):
+    with pytest.raises(psycopg.ProgrammingError):
         pq.convert(query, params)
index 166344ac65aa40f70e8245dc9490608f896f33a6..a1546d3b0a67278646d4f93787e3c2aee6365ca3 100644 (file)
@@ -1,4 +1,4 @@
-from psycopg3 import rows
+from psycopg import rows
 
 
 def test_tuple_row(conn):
index 3978cd371957947c218512405e3b9fdfb2f5085e..9f008e7b48b4830ca55f7fe618536a80788e9473 100644 (file)
@@ -1,8 +1,8 @@
 import pytest
 
-from psycopg3 import errors as e
-from psycopg3.pq import Format
-from psycopg3.rows import dict_row
+from psycopg import errors as e
+from psycopg.pq import Format
+from psycopg.rows import dict_row
 
 
 def test_funny_name(conn):
index 7e95b68fbe71abd9297b3e7119d5c11a7390fcd5..c3ac472ec8f8118b4628575b66d72132ca1e6148 100644 (file)
@@ -1,8 +1,8 @@
 import pytest
 
-from psycopg3 import errors as e
-from psycopg3.rows import dict_row
-from psycopg3.pq import Format
+from psycopg import errors as e
+from psycopg.rows import dict_row
+from psycopg.pq import Format
 
 pytestmark = pytest.mark.asyncio
 
index 5b1fa490e69f442ff633289affe0bdab21af77fd..6813173d96cfe1e5f6db5c1756270790413c3e18 100644 (file)
@@ -7,8 +7,8 @@ import datetime as dt
 
 import pytest
 
-from psycopg3 import sql, ProgrammingError
-from psycopg3.adapt import Format
+from psycopg import sql, ProgrammingError
+from psycopg.adapt import Format
 
 
 @pytest.mark.parametrize(
index 62563251b53d092093d4a5d425952100e2882edc..00860dcae8f5f26d975bf0f745b965566a5e621f 100644 (file)
@@ -1,6 +1,6 @@
 import pytest
 
-from psycopg3 import Connection, ProgrammingError, Rollback
+from psycopg import Connection, ProgrammingError, Rollback
 
 
 @pytest.fixture(autouse=True)
index 92945d77fa66c6045874044e9e335831c1a7ee85..25dfb64920d62e4bc30acda073f039c25988364c 100644 (file)
@@ -1,6 +1,6 @@
 import pytest
 
-from psycopg3 import ProgrammingError, Rollback
+from psycopg import ProgrammingError, Rollback
 
 from .test_transaction import in_transaction, insert_row, inserted
 from .test_transaction import ExpectedException
index 6e531853400b515e40c2002a477b52bc739e6b30..365ae542b1bf9e6604d9b0b0da25878d43488516 100644 (file)
@@ -19,40 +19,40 @@ def test_typing_example(mypy):
     "conn, type",
     [
         (
-            "psycopg3.connect()",
-            "psycopg3.Connection[Tuple[Any, ...]]",
+            "psycopg.connect()",
+            "psycopg.Connection[Tuple[Any, ...]]",
         ),
         (
-            "psycopg3.connect(row_factory=rows.tuple_row)",
-            "psycopg3.Connection[Tuple[Any, ...]]",
+            "psycopg.connect(row_factory=rows.tuple_row)",
+            "psycopg.Connection[Tuple[Any, ...]]",
         ),
         (
-            "psycopg3.connect(row_factory=rows.dict_row)",
-            "psycopg3.Connection[Dict[str, Any]]",
+            "psycopg.connect(row_factory=rows.dict_row)",
+            "psycopg.Connection[Dict[str, Any]]",
         ),
         (
-            "psycopg3.connect(row_factory=rows.namedtuple_row)",
-            "psycopg3.Connection[NamedTuple]",
+            "psycopg.connect(row_factory=rows.namedtuple_row)",
+            "psycopg.Connection[NamedTuple]",
         ),
         (
-            "psycopg3.connect(row_factory=thing_row)",
-            "psycopg3.Connection[Thing]",
+            "psycopg.connect(row_factory=thing_row)",
+            "psycopg.Connection[Thing]",
         ),
         (
-            "psycopg3.Connection.connect()",
-            "psycopg3.Connection[Tuple[Any, ...]]",
+            "psycopg.Connection.connect()",
+            "psycopg.Connection[Tuple[Any, ...]]",
         ),
         (
-            "psycopg3.Connection.connect(row_factory=rows.dict_row)",
-            "psycopg3.Connection[Dict[str, Any]]",
+            "psycopg.Connection.connect(row_factory=rows.dict_row)",
+            "psycopg.Connection[Dict[str, Any]]",
         ),
         (
-            "await psycopg3.AsyncConnection.connect()",
-            "psycopg3.AsyncConnection[Tuple[Any, ...]]",
+            "await psycopg.AsyncConnection.connect()",
+            "psycopg.AsyncConnection[Tuple[Any, ...]]",
         ),
         (
-            "await psycopg3.AsyncConnection.connect(row_factory=rows.dict_row)",
-            "psycopg3.AsyncConnection[Dict[str, Any]]",
+            "await psycopg.AsyncConnection.connect(row_factory=rows.dict_row)",
+            "psycopg.AsyncConnection[Dict[str, Any]]",
         ),
     ],
 )
@@ -66,72 +66,72 @@ def test_connection_type(conn, type, mypy, tmpdir):
     "conn, curs, type",
     [
         (
-            "psycopg3.connect()",
+            "psycopg.connect()",
             "conn.cursor()",
-            "psycopg3.Cursor[Tuple[Any, ...]]",
+            "psycopg.Cursor[Tuple[Any, ...]]",
         ),
         (
-            "psycopg3.connect(row_factory=rows.dict_row)",
+            "psycopg.connect(row_factory=rows.dict_row)",
             "conn.cursor()",
-            "psycopg3.Cursor[Dict[str, Any]]",
+            "psycopg.Cursor[Dict[str, Any]]",
         ),
         (
-            "psycopg3.connect(row_factory=rows.dict_row)",
+            "psycopg.connect(row_factory=rows.dict_row)",
             "conn.cursor(row_factory=rows.namedtuple_row)",
-            "psycopg3.Cursor[NamedTuple]",
+            "psycopg.Cursor[NamedTuple]",
         ),
         (
-            "psycopg3.connect(row_factory=thing_row)",
+            "psycopg.connect(row_factory=thing_row)",
             "conn.cursor()",
-            "psycopg3.Cursor[Thing]",
+            "psycopg.Cursor[Thing]",
         ),
         (
-            "psycopg3.connect()",
+            "psycopg.connect()",
             "conn.cursor(row_factory=thing_row)",
-            "psycopg3.Cursor[Thing]",
+            "psycopg.Cursor[Thing]",
         ),
         # Async cursors
         (
-            "await psycopg3.AsyncConnection.connect()",
+            "await psycopg.AsyncConnection.connect()",
             "conn.cursor()",
-            "psycopg3.AsyncCursor[Tuple[Any, ...]]",
+            "psycopg.AsyncCursor[Tuple[Any, ...]]",
         ),
         (
-            "await psycopg3.AsyncConnection.connect()",
+            "await psycopg.AsyncConnection.connect()",
             "conn.cursor(row_factory=thing_row)",
-            "psycopg3.AsyncCursor[Thing]",
+            "psycopg.AsyncCursor[Thing]",
         ),
         # Server-side cursors
         (
-            "psycopg3.connect()",
+            "psycopg.connect()",
             "conn.cursor(name='foo')",
-            "psycopg3.ServerCursor[Tuple[Any, ...]]",
+            "psycopg.ServerCursor[Tuple[Any, ...]]",
         ),
         (
-            "psycopg3.connect(row_factory=rows.dict_row)",
+            "psycopg.connect(row_factory=rows.dict_row)",
             "conn.cursor(name='foo')",
-            "psycopg3.ServerCursor[Dict[str, Any]]",
+            "psycopg.ServerCursor[Dict[str, Any]]",
         ),
         (
-            "psycopg3.connect()",
+            "psycopg.connect()",
             "conn.cursor(name='foo', row_factory=rows.dict_row)",
-            "psycopg3.ServerCursor[Dict[str, Any]]",
+            "psycopg.ServerCursor[Dict[str, Any]]",
         ),
         # Async server-side cursors
         (
-            "await psycopg3.AsyncConnection.connect()",
+            "await psycopg.AsyncConnection.connect()",
             "conn.cursor(name='foo')",
-            "psycopg3.AsyncServerCursor[Tuple[Any, ...]]",
+            "psycopg.AsyncServerCursor[Tuple[Any, ...]]",
         ),
         (
-            "await psycopg3.AsyncConnection.connect(row_factory=rows.dict_row)",
+            "await psycopg.AsyncConnection.connect(row_factory=rows.dict_row)",
             "conn.cursor(name='foo')",
-            "psycopg3.AsyncServerCursor[Dict[str, Any]]",
+            "psycopg.AsyncServerCursor[Dict[str, Any]]",
         ),
         (
-            "psycopg3.connect()",
+            "psycopg.connect()",
             "conn.cursor(name='foo', row_factory=rows.dict_row)",
-            "psycopg3.ServerCursor[Dict[str, Any]]",
+            "psycopg.ServerCursor[Dict[str, Any]]",
         ),
     ],
 )
@@ -168,7 +168,7 @@ def test_fetchone_type(conn_class, server_side, curs, type, mypy, tmpdir):
     if server_side:
         curs = curs.replace("(", "(name='foo',", 1)
     stmts = f"""\
-conn = {await_} psycopg3.{conn_class}.connect()
+conn = {await_} psycopg.{conn_class}.connect()
 curs = {curs}
 obj = {await_} curs.fetchone()
 """
@@ -205,7 +205,7 @@ def test_iter_type(conn_class, server_side, curs, type, mypy, tmpdir):
     if server_side:
         curs = curs.replace("(", "(name='foo',", 1)
     stmts = f"""\
-conn = {await_}psycopg3.{conn_class}.connect()
+conn = {await_}psycopg.{conn_class}.connect()
 curs = {curs}
 {async_}for obj in curs:
     pass
@@ -241,7 +241,7 @@ def test_fetchsome_type(
     if server_side:
         curs = curs.replace("(", "(name='foo',", 1)
     stmts = f"""\
-conn = {await_} psycopg3.{conn_class}.connect()
+conn = {await_} psycopg.{conn_class}.connect()
 curs = {curs}
 obj = {await_} curs.{method}()
 """
@@ -274,15 +274,15 @@ def _test_reveal(stmts, type, mypy, tmpdir):
 
     src = f"""\
 from typing import Any, Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple
-import psycopg3
-from psycopg3 import rows
+import psycopg
+from psycopg import rows
 
 class Thing:
     def __init__(self, **kwargs: Any) -> None:
         self.kwargs = kwargs
 
 def thing_row(
-    cur: psycopg3.AnyCursor[Thing],
+    cur: psycopg.AnyCursor[Thing],
 ) -> Callable[[Sequence[Any]], Thing]:
     assert cur.description
     names = [d.name for d in cur.description]
index 2b40d3c0f5bb57897f712fec6cd4619b39b47c5a..9f4f58f6989b461f94a0d413c2d65c7d1fe5222a 100644 (file)
@@ -2,10 +2,10 @@ import select
 
 import pytest
 
-import psycopg3
-from psycopg3 import waiting
-from psycopg3 import generators
-from psycopg3.pq import ConnStatus, ExecStatus
+import psycopg
+from psycopg import waiting
+from psycopg import generators
+from psycopg.pq import ConnStatus, ExecStatus
 
 
 skip_no_epoll = pytest.mark.skipif(
@@ -30,7 +30,7 @@ def test_wait_conn(dsn, timeout):
 
 def test_wait_conn_bad(dsn):
     gen = generators.connect("dbname=nosuchdb")
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         waiting.wait_conn(gen)
 
 
@@ -54,7 +54,7 @@ def test_wait_selector_bad(pgconn):
     pgconn.send_query(b"select 1")
     gen = generators.execute(pgconn)
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         waiting.wait_selector(gen, pgconn.socket)
 
 
@@ -86,7 +86,7 @@ async def test_wait_conn_async(dsn, timeout):
 @pytest.mark.asyncio
 async def test_wait_conn_async_bad(dsn):
     gen = generators.connect("dbname=nosuchdb")
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await waiting.wait_conn_async(gen)
 
 
@@ -104,5 +104,5 @@ async def test_wait_async_bad(pgconn):
     gen = generators.execute(pgconn)
     socket = pgconn.socket
     pgconn.finish()
-    with pytest.raises(psycopg3.OperationalError):
+    with pytest.raises(psycopg.OperationalError):
         await waiting.wait_async(gen, socket)
index ea1805df1151e50a5fb7bfde8135d8b771230446..90cf1bd1e80790ca8bb14f622ccc175604c3ff1d 100644 (file)
@@ -1,10 +1,10 @@
 import pytest
-import psycopg3
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.oids import postgres_types as builtins
-from psycopg3.adapt import Format, Transformer
-from psycopg3.types import TypeInfo
+import psycopg
+from psycopg import pq
+from psycopg import sql
+from psycopg.oids import postgres_types as builtins
+from psycopg.adapt import Format, Transformer
+from psycopg.types import TypeInfo
 
 
 tests_str = [
@@ -89,7 +89,7 @@ def test_dump_list_int(conn, obj, want):
 )
 def test_bad_binary_array(input):
     tx = Transformer()
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         tx.get_dumper(input, Format.BINARY).dump(input)
 
 
index 8ec3102fe0a3ec8b00fac5b613b9d67612b65787..e8c3ba0acd6fcb90b379f060dab41b9646fe8e0c 100644 (file)
@@ -1,9 +1,9 @@
 import pytest
 
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.oids import postgres_types as builtins
-from psycopg3.adapt import Transformer, Format
+from psycopg import pq
+from psycopg import sql
+from psycopg.oids import postgres_types as builtins
+from psycopg.adapt import Transformer, Format
 
 
 @pytest.mark.parametrize("fmt_in", [Format.AUTO, Format.TEXT, Format.BINARY])
index da02e80be80fddfbe05709acc25dcf0cd3ea884f..4cbaa47dce0b2916174d1cbc7449c8de94b164bd 100644 (file)
@@ -1,10 +1,10 @@
 import pytest
 
-from psycopg3 import pq
-from psycopg3.sql import Identifier
-from psycopg3.oids import postgres_types as builtins
-from psycopg3.adapt import Format, global_adapters
-from psycopg3.types.composite import CompositeInfo
+from psycopg import pq
+from psycopg.sql import Identifier
+from psycopg.oids import postgres_types as builtins
+from psycopg.adapt import Format, global_adapters
+from psycopg.types.composite import CompositeInfo
 
 
 tests_str = [
index fbb8f0025041cdfe2e82c98493e8899d625a69eb..55a8191691e79475fc2b580b0bc0c482e0ea526b 100644 (file)
@@ -2,8 +2,8 @@ import datetime as dt
 
 import pytest
 
-from psycopg3 import DataError, pq, sql
-from psycopg3.adapt import Format
+from psycopg import DataError, pq, sql
+from psycopg.adapt import Format
 
 
 class TestDate:
@@ -582,8 +582,8 @@ class TestInterval:
     def test_infinity_date_example(self, conn):
         # NOTE: this is an example in the docs. Make sure it doesn't regress when
         # adding binary datetime adapters
-        from psycopg3.oids import postgres_types as builtins
-        from psycopg3.types.datetime import DateLoader, DateDumper
+        from psycopg.oids import postgres_types as builtins
+        from psycopg.types.datetime import DateLoader, DateDumper
 
         class InfDateDumper(DateDumper):
             def dump(self, obj):
index f1a5d094817f7e4e90cc0baad017c9ce167706c0..c72bd6327e8e14418ea943683c155f7d496a1c45 100644 (file)
@@ -3,11 +3,11 @@ from copy import deepcopy
 
 import pytest
 
-import psycopg3.types
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.adapt import Format
-from psycopg3.types.json import Json, Jsonb, set_json_dumps, set_json_loads
+import psycopg.types
+from psycopg import pq
+from psycopg import sql
+from psycopg.adapt import Format
+from psycopg.types.json import Json, Jsonb, set_json_dumps, set_json_loads
 
 samples = [
     "null",
@@ -68,7 +68,7 @@ def test_json_load_copy(conn, val, jtype, fmt_out):
 @pytest.mark.parametrize("fmt_in", [Format.AUTO, Format.TEXT, Format.BINARY])
 @pytest.mark.parametrize("wrapper", ["Json", "Jsonb"])
 def test_json_dump_customise(conn, wrapper, fmt_in):
-    wrapper = getattr(psycopg3.types.json, wrapper)
+    wrapper = getattr(psycopg.types.json, wrapper)
     obj = {"foo": "bar"}
     cur = conn.cursor()
 
@@ -84,10 +84,10 @@ def test_json_dump_customise(conn, wrapper, fmt_in):
 @pytest.mark.parametrize("wrapper", ["Json", "Jsonb"])
 def test_json_dump_subclass(conn, wrapper, fmt_in):
     JDumper = getattr(
-        psycopg3.types.json,
+        psycopg.types.json,
         f"{wrapper}{'Binary' if fmt_in != Format.TEXT else ''}Dumper",
     )
-    wrapper = getattr(psycopg3.types.json, wrapper)
+    wrapper = getattr(psycopg.types.json, wrapper)
 
     class MyJsonDumper(JDumper):
         def get_dumps(self):
@@ -120,7 +120,7 @@ def test_json_load_customise(conn, binary, pgtype):
 @pytest.mark.parametrize("pgtype", ["json", "jsonb"])
 def test_json_load_subclass(conn, binary, pgtype):
     JLoader = getattr(
-        psycopg3.types.json,
+        psycopg.types.json,
         f"{pgtype.title()}{'Binary' if binary else ''}Loader",
     )
 
index bafc7afe38fe5bc190a0af5734050967490211bf..38058774ad2e250dc4cc0405036821f2f66eec7a 100644 (file)
@@ -4,9 +4,9 @@ import subprocess as sp
 
 import pytest
 
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.adapt import Format
+from psycopg import pq
+from psycopg import sql
+from psycopg.adapt import Format
 
 
 @pytest.mark.parametrize("fmt_in", [Format.AUTO, Format.TEXT, Format.BINARY])
@@ -125,13 +125,13 @@ def test_cidr_load(conn, fmt_out, val):
 def test_lazy_load(dsn):
     script = f"""\
 import sys
-import psycopg3
+import psycopg
 
 # In 3.6 it seems already loaded (at least on Travis).
 if sys.version_info >= (3, 7):
     assert 'ipaddress' not in sys.modules
 
-conn = psycopg3.connect({dsn!r})
+conn = psycopg.connect({dsn!r})
 with conn.cursor() as cur:
     cur.execute("select '127.0.0.1'::inet")
     cur.fetchone()
index 892e352f0bafb09d515d4c478f58a13d2034f2a2..87f731e05fb257b867f1028c73da9fd48ab545a3 100644 (file)
@@ -1,5 +1,5 @@
-from psycopg3 import sql
-from psycopg3.adapt import Transformer, Format
+from psycopg import sql
+from psycopg.adapt import Transformer, Format
 
 
 def test_quote_none(conn):
index acce86eb875656b66f14a8c776ebd9eaa3102e56..db68c5df5f37603d32a5eb092083a7721ba11263 100644 (file)
@@ -3,10 +3,10 @@ from math import isnan, isinf, exp
 
 import pytest
 
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.adapt import Transformer, Format
-from psycopg3.types.numeric import FloatLoader
+from psycopg import pq
+from psycopg import sql
+from psycopg.adapt import Transformer, Format
+from psycopg.types.numeric import FloatLoader
 
 
 #
index def7d112a81c1bf9d28608ca9995930baf88a146..9ef9d93f8de1bd4b097910097658eb8bd3bf30b5 100644 (file)
@@ -4,11 +4,11 @@ from decimal import Decimal
 
 import pytest
 
-import psycopg3.errors
-from psycopg3 import pq
-from psycopg3.sql import Identifier
-from psycopg3.adapt import Format
-from psycopg3.types.range import Range, RangeInfo
+import psycopg.errors
+from psycopg import pq
+from psycopg.sql import Identifier
+from psycopg.adapt import Format
+from psycopg.types.range import Range, RangeInfo
 
 
 type2sub = {
@@ -176,7 +176,7 @@ def test_copy_in_empty(conn, min, max, bounds, format):
             f"copy copyrange (r) from stdin (format {format.name})"
         ) as copy:
             copy.write_row([r])
-    except psycopg3.errors.ProtocolViolation:
+    except psycopg.errors.ProtocolViolation:
         if not min and not max and format == pq.Format.BINARY:
             pytest.xfail(
                 "TODO: add annotation to dump array with no type info"
@@ -196,7 +196,7 @@ def test_copy_in_empty(conn, min, max, bounds, format):
 )
 @pytest.mark.parametrize("format", [pq.Format.TEXT, pq.Format.BINARY])
 def test_copy_in_empty_wrappers(conn, bounds, wrapper, format):
-    from psycopg3.types import range as range_module
+    from psycopg.types import range as range_module
 
     cur = conn.cursor()
     cur.execute("create table copyrange (id serial primary key, r daterange)")
index e9e0696c1fb356b1f4ade3dc3e96d889857d2ae6..33624b71edf907976414e9fbcaa87150f1ee386a 100644 (file)
@@ -1,10 +1,10 @@
 import pytest
 
-import psycopg3
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.adapt import Format
-from psycopg3 import Binary
+import psycopg
+from psycopg import pq
+from psycopg import sql
+from psycopg.adapt import Format
+from psycopg import Binary
 
 eur = "\u20ac"
 
@@ -36,14 +36,14 @@ def test_quote_1char(conn):
 def test_dump_zero(conn, fmt_in):
     cur = conn.cursor()
     s = "foo\x00bar"
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         cur.execute(f"select %{fmt_in}::text", (s,))
 
 
 def test_quote_zero(conn):
     cur = conn.cursor()
     s = "foo\x00bar"
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         cur.execute(sql.SQL("select {}").format(sql.Literal(s)))
 
 
@@ -148,7 +148,7 @@ def test_load_badenc(conn, typename, fmt_out):
     cur = conn.cursor(binary=fmt_out)
 
     conn.client_encoding = "latin1"
-    with pytest.raises(psycopg3.DataError):
+    with pytest.raises(psycopg.DataError):
         cur.execute(f"select chr(%s::int)::{typename}", (ord(eur),))
 
     stmt = sql.SQL("copy (select chr({}::int)) to stdout (format {})").format(
@@ -156,7 +156,7 @@ def test_load_badenc(conn, typename, fmt_out):
     )
     with cur.copy(stmt) as copy:
         copy.set_types([typename])
-        with pytest.raises(psycopg3.DataError):
+        with pytest.raises(psycopg.DataError):
             copy.read_row()
 
 
index 6fbea2697c00524aa6986a8426ea6d18e3950411..81db48ba8eb8e91be8ef829336d68b49cf028763 100644 (file)
@@ -4,9 +4,9 @@ import subprocess as sp
 
 import pytest
 
-from psycopg3 import pq
-from psycopg3 import sql
-from psycopg3.adapt import Format
+from psycopg import pq
+from psycopg import sql
+from psycopg.adapt import Format
 
 
 @pytest.mark.parametrize("fmt_in", [Format.AUTO, Format.TEXT, Format.BINARY])
@@ -38,11 +38,11 @@ def test_uuid_load(conn, fmt_out):
 def test_lazy_load(dsn):
     script = f"""\
 import sys
-import psycopg3
+import psycopg
 
 assert 'uuid' not in sys.modules
 
-conn = psycopg3.connect({dsn!r})
+conn = psycopg.connect({dsn!r})
 with conn.cursor() as cur:
     cur.execute("select repeat('1', 32)::uuid")
     cur.fetchone()
index bc86ecdb6cf925ed1d986f4fb1e84a53a8a3e7a0..b0d4c3e611fc48397eb22a93df73e86771cdb30e 100644 (file)
@@ -5,7 +5,7 @@ from __future__ import annotations
 from dataclasses import dataclass
 from typing import Any, Callable, Optional, Sequence, Tuple
 
-from psycopg3 import AnyCursor, Connection, Cursor, ServerCursor, connect
+from psycopg import AnyCursor, Connection, Cursor, ServerCursor, connect
 
 
 def int_row_factory(cursor: AnyCursor[int]) -> Callable[[Sequence[int]], int]:
index 09db22dc40c4b1113644889952c1f3168fb93e7f..02aa29b0705f67b2adbdfee788da44e5ef9b7d7d 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Script to build binary psycopg3-c package.
+# Script to build binary psycopg-c package.
 # Built packages will be available in the `dist` directory.
 
 # Copyright (C) 2020-2021 The Psycopg Team
@@ -12,13 +12,13 @@ set -x
 #
 # docker run --rm \
 #   -e PLAT=manylinux2014_x86_64 \
-#   -e PSYCOPG3_TEST_DSN="host=172.17.0.1 user=piro dbname=psycopg3_test" \
-#   -v `pwd`:/psycopg3 \
-#   quay.io/pypa/manylinux2014_x86_64 /psycopg3/tools/build_wheels.sh
+#   -e PSYCOPG_TEST_DSN="host=172.17.0.1 user=piro dbname=psycopg_test" \
+#   -v `pwd`:/psycopg \
+#   quay.io/pypa/manylinux2014_x86_64 /psycopg/tools/build_wheels.sh
 
 # The version of psycopg we are building
 version=$( \
-    (cat psycopg3/psycopg3/psycopg3/version.py && echo "print(__version__)") \
+    (cat psycopg/psycopg/psycopg/version.py && echo "print(__version__)") \
     | python)
 
 function repair_wheel {
@@ -26,7 +26,7 @@ function repair_wheel {
     if ! auditwheel show "$wheel"; then
         echo "Skipping non-platform wheel $wheel"
     else
-        auditwheel repair "$wheel" --plat "$PLAT" -w /psycopg3/dist/
+        auditwheel repair "$wheel" --plat "$PLAT" -w /psycopg/dist/
     fi
 }
 
@@ -42,18 +42,18 @@ export PATH="/usr/pgsql-13/bin/:$PATH"
 cp -avr /usr/pgsql-13/lib/* /usr/lib/
 
 # Patch a copy of the c package to name it -binary
-cp -r /psycopg3/psycopg3_c /psycopg3_binary
-mv /psycopg3_binary/{psycopg3_c,psycopg3_binary}/
-sed -i 's/psycopg3-c/psycopg3-binary/' /psycopg3_binary/setup.cfg
+cp -r /psycopg/psycopg_c /psycopg_binary
+mv /psycopg_binary/{psycopg_c,psycopg_binary}/
+sed -i 's/psycopg-c/psycopg-binary/' /psycopg_binary/setup.cfg
 sed -i "s/__impl__[[:space:]]*=.*/__impl__ = 'binary'/" \
-    /psycopg3_binary/psycopg3_binary/pq.pyx
-find /psycopg3_binary/ -name \*.pyx -or -name \*.pxd -or -name \*.py \
-    | xargs sed -i 's/\bpsycopg3_c\b/psycopg3_binary/'
+    /psycopg_binary/psycopg_binary/pq.pyx
+find /psycopg_binary/ -name \*.pyx -or -name \*.pxd -or -name \*.py \
+    | xargs sed -i 's/\bpsycopg_c\b/psycopg_binary/'
 
 # Compile wheels
 for PYBIN in /opt/python/*/bin; do
     if [[ $PYBIN =~ "cp35" ]]; then continue; fi
-    "${PYBIN}/pip" wheel /psycopg3_binary/ --no-deps -w /tmpwheels/
+    "${PYBIN}/pip" wheel /psycopg_binary/ --no-deps -w /tmpwheels/
 done
 
 # Bundle external shared libraries into the wheels
@@ -61,11 +61,11 @@ for whl in /tmpwheels/*.whl; do
     repair_wheel "$whl"
 done
 
-# Create a sdist package with the basic psycopg3 package in order to install
-# psycopg3[binary] with packages from a single dir.
-# While you are there, build the sdist for psycopg3-c too.
-"/opt/python/cp38-cp38/bin/python" /psycopg3/psycopg3/setup.py sdist --dist-dir /psycopg3/dist/
-"/opt/python/cp38-cp38/bin/python" /psycopg3/psycopg3_c/setup.py sdist --dist-dir /psycopg3/dist/
+# Create a sdist package with the basic psycopg package in order to install
+# psycopg[binary] with packages from a single dir.
+# While you are there, build the sdist for psycopg-c too.
+"/opt/python/cp38-cp38/bin/python" /psycopg/psycopg/setup.py sdist --dist-dir /psycopg/dist/
+"/opt/python/cp38-cp38/bin/python" /psycopg/psycopg_c/setup.py sdist --dist-dir /psycopg/dist/
 
 # Delete the libpq to make sure the package is independent.
 rm -v /usr/lib/libpq.*
@@ -74,6 +74,6 @@ rm -v /usr/pgsql-13/lib/libpq.*
 # Install packages and test
 for PYBIN in /opt/python/*/bin/; do
     if [[ $PYBIN =~ "cp35" ]]; then continue; fi
-    "${PYBIN}/pip" install psycopg3[binary,test]==$version -f /psycopg3/dist
-    PSYCOPG3_IMPL=binary "${PYBIN}/pytest" /psycopg3/tests -m "not slow"
+    "${PYBIN}/pip" install psycopg[binary,test]==$version -f /psycopg/dist
+    PSYCOPG_IMPL=binary "${PYBIN}/pytest" /psycopg/tests -m "not slow"
 done
index d0acef84e130c371778e73a686bc932c2268fb5d..bcf07b51fd14d6dd5197cebfa91eefde88410854 100755 (executable)
@@ -16,7 +16,7 @@ import subprocess as sp
 from urllib.request import urlopen
 from collections import defaultdict, namedtuple
 
-from psycopg3.errors import get_base_exception  # type: ignore
+from psycopg.errors import get_base_exception  # type: ignore
 
 logger = logging.getLogger()
 logging.basicConfig(
@@ -27,7 +27,7 @@ logging.basicConfig(
 def main():
     classes, errors = fetch_errors(["9.6", "10", "11", "12", "13"])
 
-    fn = os.path.dirname(__file__) + "/../psycopg3/psycopg3/errors.py"
+    fn = os.path.dirname(__file__) + "/../psycopg/psycopg/errors.py"
     update_file(fn, generate_module_data(classes, errors))
 
     logger.info("running black on the resulting module")
index 85349db2281d876039f8ea3c8b57767b190f4c70..ec591bc1a09209699155983ce8ae4a384b4fa2db 100755 (executable)
@@ -73,14 +73,14 @@ order by typname
 
 def update_python_oids() -> None:
     queries = [version_sql, py_types_sql, py_ranges_sql]
-    fn = ROOT / "psycopg3/psycopg3/oids.py"
+    fn = ROOT / "psycopg/psycopg/oids.py"
     update_file(fn, queries)
     sp.check_call(["black", "-q", fn])
 
 
 def update_cython_oids() -> None:
     queries = [version_sql, cython_oids_sql]
-    fn = ROOT / "psycopg3_c/psycopg3_c/_psycopg3/oids.pxd"
+    fn = ROOT / "psycopg/psycopg/_psycopg/oids.pxd"
     update_file(fn, queries)
 
 
diff --git a/tox.ini b/tox.ini
index 68a953ea89ac25fde41c93bc3274ed9ec1c8233a..fd227698c98b5e15410335ade72a14cc1f116388 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -20,7 +20,7 @@ skip_install = true
 [testenv:docs]
 commands = sphinx-build -W -T -b html docs docs/_build/html
 deps =
-    ./psycopg3
+    ./psycopg
     -r docs/requirements.txt
 skip_install = true
 
@@ -29,5 +29,5 @@ max-line-length = 85
 ignore = W503, E203
 extend-exclude = .venv
 per-file-ignores =
-    ./psycopg3/psycopg3/__init__.py: F401
-    ./psycopg3/psycopg3/types/__init__.py: F401
+    ./psycopg/psycopg/__init__.py: F401
+    ./psycopg/psycopg/types/__init__.py: F401