diff --git a/README.rst b/README.rst index 79b830d53..50d10b0b5 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,45 @@ gaussdb -- GaussDB database adapter for Python =================================================== -**gaussdb** is a modern implementation of a GaussDB adapter for Python, based on a fork of `psycopg` with enhancements and renaming. +.. image:: https://img.shields.io/pypi/v/gaussdb.svg + :target: https://pypi.org/project/gaussdb/ + :alt: PyPI version + +.. image:: https://img.shields.io/pypi/l/gaussdb.svg + :target: https://github.com/HuaweiCloudDeveloper/gaussdb-python/blob/master/LICENSE.txt + :alt: License: LGPL v3 + +**gaussdb** provides a modern Python interface for GaussDB, derived from a fork of `psycopg `_ . +It includes functional improvements and project renaming, retaining compatibility with the original codebase licensed under the **GNU Lesser General Public License v3.0**. + +Modifications made by HuaweiCloudDeveloper: + +- Package name changed from `psycopg` to `gaussdb` +- Introduced support for both pure-Python and libpq implementations via PSYCOPG_IMPL +- Added GaussDB-specific behavior adjustments to handle differences from PostgreSQL +- Added SSL connection examples and dedicated SSL demonstration code +- Added installation tools for GaussDB client drivers in the tools/ directory +- Introduced compatibility handling for GaussDB’s Oracle-mode SQL behavior +- Added pre-commit hooks and stricter lint/tooling configuration +- Expanded example scripts to cover GaussDB usage scenarios +- Modularized the project into multiple packages (gaussdb, gaussdb_pool, isort-gaussdb) beyond psycopg’s structure + +License +------- + +This project is a **fork** of `psycopg`, originally developed by the Psycopg Team. + +- **Original work**: Copyright © 2020 The Psycopg Team +- **License**: GNU Lesser General Public License v3.0 (LGPL v3) + +**gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**. + +See the full license text in the :download:`LICENSE.txt` file. + +.. note:: + + **Important**: When redistributing this package (including on PyPI), you **must** include the ``LICENSE.txt`` file. + .. _Hacking: diff --git a/docs/README.rst b/docs/README.rst index 8729f3860..f99c30151 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -3,6 +3,14 @@ GaussDB documentation build =========================== +.. note:: + + **License**: This documentation is part of the **gaussdb** project and is licensed under the + `GNU Lesser General Public License v3.0 (LGPL v3)`_. + +.. _GNU Lesser General Public License v3.0 (LGPL v3): https://www.gnu.org/licenses/lgpl-3.0.en.html + + Quick start:: make env diff --git a/docs/conf.py b/docs/conf.py index b3a2fc51e..c4cb84e2d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -26,8 +26,8 @@ # -- Project information ----------------------------------------------------- project = "gaussdb" -copyright = "2020, Daniele Varrazzo and The Psycopg Team" -author = "Daniele Varrazzo" +copyright = "2020, The Psycopg Team, 2025 Huawei Cloud Developer Team" +author = "Huawei Cloud Developer Team (based on Psycopg Team)" release = gaussdb.__version__ diff --git a/gaussdb/README.rst b/gaussdb/README.rst index 6bd5fad17..18a07fcb1 100644 --- a/gaussdb/README.rst +++ b/gaussdb/README.rst @@ -1,8 +1,6 @@ gaussdb: GaussDB database adapter for Python ================================================= -gaussdb is a modern implementation of a GaussDB adapter for Python. - This distribution contains the pure Python package ``gaussdb``. .. Note:: @@ -34,4 +32,25 @@ Hacking For development information check out `the project readme`. -Copyright (C) 2020 The Psycopg Team +| + +License +------- + +This project is a **fork** of `psycopg `_, originally developed by the Psycopg Team. + +- **Original work**: Copyright © 2020 The Psycopg Team +- **Modifications**: Copyright © 2025 Huawei Cloud Developer Team +- **License**: GNU Lesser General Public License v3.0 (`LGPL v3 `_) + +**gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**. + +See the full license text in the :download:`LICENSE.txt` file. + +.. note:: + + **Important**: When redistributing this package (including on PyPI), you **must** include the ``LICENSE.txt`` file. + +| + +.. _psycopg: https://www.psycopg.org/ diff --git a/gaussdb/gaussdb/__init__.py b/gaussdb/gaussdb/__init__.py index c1e02f474..2f6aff69c 100644 --- a/gaussdb/gaussdb/__init__.py +++ b/gaussdb/gaussdb/__init__.py @@ -1,8 +1,26 @@ """ gaussdb -- GaussDB database adapter for Python + +This file is part of gaussdb. + +gaussdb is a fork of psycopg[](https://www.psycopg.org/), originally +developed by the Psycopg Team and licensed under the GNU Lesser +General Public License v3.0 (LGPL v3). + +The original psycopg source code is copyright © 2001–2023 by the Psycopg Team. + +This modified version is distributed under the same LGPL v3 license. +See the LICENSE file for the full license text. """ # Copyright (C) 2020 The Psycopg Team +# Modifications made by HuaweiCloudDeveloper (2025): +# - Renamed package from 'psycopg' to 'gaussdb' +# - Updated all internal imports (psycopg → gaussdb) +# - Modified __init__.py to expose gaussdb.connect, etc. +# - Adjusted documentation strings and error messages for GaussDB branding +# - Added GaussDB-specific connection parameters (e.g., sslmode, gssencmode) +# - Patched SQL parsing for GaussDB-specific syntax support import logging diff --git a/gaussdb_pool/README.rst b/gaussdb_pool/README.rst index a0fcfc15f..2a364cf8a 100644 --- a/gaussdb_pool/README.rst +++ b/gaussdb_pool/README.rst @@ -14,5 +14,25 @@ You can also install this package using:: Please read `the project readme` and `the installation documentation` for more details. +| -Copyright (C) 2020 The Psycopg Team +License +------- + +This project is a **fork** of `psycopg `_, originally developed by the Psycopg Team. + +- **Original work**: Copyright © 2020 The Psycopg Team +- **Modifications**: Copyright © 2025 Huawei Cloud Developer Team +- **License**: GNU Lesser General Public License v3.0 (`LGPL v3 `_) + +**gaussdb_pool** inherits the same license. All modifications are distributed under the **LGPL v3**. + +See the full license text in the :download:`LICENSE.txt` file. + +.. note:: + + **Important**: When redistributing this package (including on PyPI), you **must** include the ``LICENSE.txt`` file. + +| + +.. _psycopg: https://www.psycopg.org/ diff --git a/pyproject.toml b/pyproject.toml index 268d2eb13..a740b9977 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,10 @@ requires = ["setuptools>=49.2.0", "wheel>=0.37"] build-backend = "setuptools.build_meta" +[project] +name = "gaussdb" +license = { file = "LICENSE.txt" } + [tool.pytest.ini_options] addopts = "-ra" filterwarnings = [ @@ -63,3 +67,6 @@ profile = "black" length_sort = true multi_line_output = 9 sort_order = "gaussdb" # requires the isort-gaussdb module + +[tool.setuptools] +license-files = ["LICENSE.txt"] \ No newline at end of file diff --git a/tests/README.rst b/tests/README.rst index cc6bac28e..72001275e 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -1,6 +1,34 @@ gaussdb test suite =================== +.. image:: https://img.shields.io/pypi/v/gaussdb.svg + :target: https://pypi.org/project/gaussdb/ + :alt: PyPI version + +.. image:: https://img.shields.io/pypi/l/gaussdb.svg + :target: https://github.com/HuaweiCloudDeveloper/gaussdb-python/blob/master/LICENSE.txt + :alt: License: LGPL v3 + +**gaussdb** provides a modern Python interface for GaussDB, derived from a fork of `psycopg `_ . +It includes functional improvements and project renaming, retaining compatibility with the original codebase licensed under the **GNU Lesser General Public License v3.0**. + +License +------- + +This project is a **fork** of `psycopg`, originally developed by the Psycopg Team. + +- **Original work**: Copyright © 2020 The Psycopg Team +- **License**: GNU Lesser General Public License v3.0 (LGPL v3) + +**gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**. + +See the full license text in the :download:`LICENSE.txt` file. + +.. note:: + + **Important**: When redistributing this package (including on PyPI), you **must** include the ``LICENSE.txt`` file. + + Quick version ------------- diff --git a/tests/types/test_numeric.py b/tests/types/test_numeric.py index 148df564f..a6ee80ef2 100644 --- a/tests/types/test_numeric.py +++ b/tests/types/test_numeric.py @@ -271,30 +271,31 @@ def test_dump_float_approx(conn, val, expr): ) @pytest.mark.parametrize("fmt_out", pq.Format) def test_load_float(conn, val, pgtype, want, fmt_out): - cur = conn.cursor(binary=fmt_out) - cur.execute(f"select %s::{pgtype}", (val,)) - assert cur.pgresult.fformat(0) == fmt_out - assert cur.pgresult.ftype(0) == conn.adapters.types[pgtype].oid - result = cur.fetchone()[0] - - def check(result, want): - assert type(result) is type(want) - if isnan(want): - assert isnan(result) - elif isinf(want): - assert isinf(result) - assert (result < 0) is (want < 0) - else: - assert result == want + with conn.cursor(binary=fmt_out) as cur: + cur.execute(f"select %s::{pgtype}", (val,)) + assert cur.pgresult.fformat(0) == fmt_out + assert cur.pgresult.ftype(0) == conn.adapters.types[pgtype].oid + result = cur.fetchone()[0] + + def check(result, want): + assert type(result) is type(want) + if isnan(want): + assert isnan(result) + elif isinf(want): + assert isinf(result) + assert (result < 0) is (want < 0) + else: + assert result == want - check(result, want) + check(result, want) - cur.execute(f"select array[%s::{pgtype}]", (val,)) - assert cur.pgresult.fformat(0) == fmt_out - assert cur.pgresult.ftype(0) == conn.adapters.types[pgtype].array_oid - result = cur.fetchone()[0] - assert isinstance(result, list) - check(result[0], want) + cur.execute(f"select array[%s::{pgtype}]", (val,)) + assert cur.pgresult.fformat(0) == fmt_out + assert cur.pgresult.ftype(0) == conn.adapters.types[pgtype].array_oid + result = cur.fetchone()[0] + assert isinstance(result, list) + check(result[0], want) + conn.close() @pytest.mark.parametrize( diff --git a/tools/isort-gaussdb/README.rst b/tools/isort-gaussdb/README.rst index 98d0cc496..07392eff9 100644 --- a/tools/isort-gaussdb/README.rst +++ b/tools/isort-gaussdb/README.rst @@ -27,3 +27,26 @@ this plug-in is totally useless and the same can be done using isort features. .. _isort: https://pycqa.github.io/isort/ .. _gaussdb: https://www.huaweicloud.com/product/gaussdb.html + +| + +License +------- + +This project is a **fork** of `psycopg `_, originally developed by the Psycopg Team. + +- **Original work**: Copyright © 2020 The Psycopg Team +- **Modifications**: Copyright © 2025 Huawei Cloud Developer Team +- **License**: GNU Lesser General Public License v3.0 (`LGPL v3 `_) + +**isort-gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**. + +See the full license text in the :download:`LICENSE.txt` file. + +.. note:: + + **Important**: When redistributing this package (including on PyPI), you **must** include the ``LICENSE.txt`` file. + +| + +.. _psycopg: https://www.psycopg.org/