Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ ignore = W503, E203, E704
extend-exclude = .venv build
per-file-ignores =
# Autogenerated section
psycopg/psycopg/errors.py: E125, E128, E302
gaussdb/gaussdb/errors.py: E125, E128, E302

# Allow concatenated string literals from async_to_sync
psycopg_pool/psycopg_pool/pool.py: E501
gaussdb_pool/gaussdb_pool/pool.py: E501

# Pytest's importorskip() getting in the way
tests/types/test_numpy.py: E402
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/3rd-party-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
pip_sqlalchemy: sqlalchemy>=2

env:
PSYCOPG_IMPL: ${{ matrix.impl }}
DEPS: ./psycopg pytest pytest-xdist greenlet
GAUSSDB_IMPL: ${{ matrix.impl }}
DEPS: ./gaussdb pytest pytest-xdist greenlet

services:
postgresql:
Expand Down Expand Up @@ -78,10 +78,10 @@ jobs:
CREATE EXTENSION hstore;
HERE

- name: Include psycopg-c to the packages to install
- name: Include gaussdb-c to the packages to install
if: ${{ matrix.impl == 'c' }}
run: |
echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
echo "DEPS=$DEPS ./gaussdb_c" >> $GITHUB_ENV

- name: Install pycopg packages
run: pip install $DEPS
Expand All @@ -108,7 +108,7 @@ jobs:

- name: Run sqlalchemy tests
env:
URL: postgresql+psycopg://postgres:[email protected]/test
URL: postgresql+gaussdb://postgres:[email protected]/test
working-directory: sa_home/sa
run: pytest -n 2 -q --dburi $URL --backend-only --dropfirst --color=yes --dbdriver psycopg_async

Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
python-version: "3.12"

env:
DEPS: ./psycopg ./psycopg_pool
DEPS: ./gaussdb ./gaussdb_pool

services:
postgresql:
Expand Down Expand Up @@ -182,10 +182,10 @@ jobs:
SELECT version();
HERE

- name: Include psycopg-c to the packages to install
- name: Include gaussdb-c to the packages to install
if: ${{ matrix.impl == 'c' }}
run: |
echo "DEPS=$DEPS ./psycopg_c" >> $GITHUB_ENV
echo "DEPS=$DEPS ./gaussdb_c" >> $GITHUB_ENV

- name: Install pycopg packages
run: pip install $DEPS
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
wget -O /tmp/GaussDB_driver.zip https://dbs-download.obs.cn-north-1.myhuaweicloud.com/GaussDB/1730887196055/GaussDB_driver.zip
unzip /tmp/GaussDB_driver.zip -d /tmp/ && rm -rf /tmp/GaussDB_driver.zip
\cp /tmp/GaussDB_driver/Centralized/Hce2_X86_64/GaussDB-Kernel*64bit_Python.tar.gz /tmp/
tar -zxvf /tmp/GaussDB-Kernel*64bit_Python.tar.gz -C /tmp/ && rm -rf /tmp/GaussDB-Kernel*64bit_Python.tar.gz && rm -rf /tmp/psycopg2 && rm -rf /tmp/GaussDB_driver
tar -zxvf /tmp/GaussDB-Kernel*64bit_Python.tar.gz -C /tmp/ && rm -rf /tmp/GaussDB-Kernel*64bit_Python.tar.gz && rm -rf /tmp/_GaussDB && rm -rf /tmp/GaussDB_driver
echo /tmp/lib | sudo tee /etc/ld.so.conf.d/gauss-libpq.conf
sudo sed -i '1s|^|/tmp/lib\n|' /etc/ld.so.conf
sudo ldconfig
Expand All @@ -62,8 +62,9 @@ jobs:
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e "./psycopg[dev,test]"
pip install -e ./psycopg_pool
pip install ./tools/isort-gaussdb/
pip install -e "./gaussdb[dev,test]"
pip install -e ./gaussdb_pool


- name: Wait for openGauss to be ready
Expand All @@ -90,9 +91,9 @@ jobs:

- name: Run tests
env:
PYTHONPATH: ./psycopg:./psycopg_pool
PSYCOPG_IMPL: python
PSYCOPG_TEST_DSN: "host=127.0.0.1 port=5432 dbname=test user=root password=${{ secrets.OPENGAUSS_PASSWORD }} "
PYTHONPATH: ./gaussdb:./gaussdb_pool
GAUSSDB_IMPL: python
GAUSSDB_TEST_DSN: "host=127.0.0.1 port=5432 dbname=test user=root password=${{ secrets.OPENGAUSS_PASSWORD }} "
run: |
source venv/bin/activate
pytest -s -v
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build documentation
on:
# push:
# branches:
# # This should match the DOC3_BRANCH value in the psycopg-website Makefile
# # This should match the DOC3_BRANCH value in the gaussdb-website Makefile
# - master
pull_request:

Expand All @@ -18,6 +18,6 @@ jobs:
- name: Trigger docs build
uses: peter-evans/repository-dispatch@v3
with:
repository: psycopg/psycopg-website
event-type: psycopg3-commit
repository: gaussdb/gaussdb-website
event-type: gaussdb-commit
token: ${{ secrets.ACCESS_TOKEN }}
15 changes: 12 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:

- name: install packages to tests
run: |
pip install ./psycopg[dev,test]
pip install ./tools/isort-gaussdb/
pip install ./gaussdb[dev,test]
pip install ./gaussdb_pool
pip install types-polib
pip install pre-commit

Expand All @@ -41,7 +43,9 @@ jobs:

- name: Install packages for async_to_sync
run: |
pip install ./psycopg[dev,test]
pip install ./tools/isort-gaussdb/
pip install ./gaussdb[dev,test]
pip install ./gaussdb_pool
pip install types-polib

- name: Check for sync/async inconsistencies
Expand All @@ -51,7 +55,12 @@ jobs:
run: sudo apt-get install -y libgeos-dev

- name: Install Python packages to generate docs
run: pip install ./psycopg[docs] ./psycopg_pool
run: |
pip install furo
pip install ./tools/isort-gaussdb/
pip install ./gaussdb[dev,test]
pip install ./gaussdb_pool
pip install types-polib

- name: Check documentation
run: sphinx-build -W -T -b html docs docs/_build/html
42 changes: 21 additions & 21 deletions .github/workflows/packages-bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Build binary packages
# Note: Libpq is currently built from source on most platforms and the build
# artifacts are cached across pipeline runs.
#
# You can see the caches at https://github.com/psycopg/psycopg/actions/caches
# You can see the caches at https://github.com/gaussdb/gaussdb/actions/caches
#
# You can delete a cache using:
#
# curl -L -X DELETE
# -H "Accept: application/vnd.github+json"
# -H "Authorization: Bearer $GITHUB_TOKEN"
# -H "X-GitHub-Api-Version: 2022-11-28"
# "https://api.github.com/repos/psycopg/psycopg/actions/caches?key=libpq-manylinux-ppc64le-17.2-3.4.0"
# "https://api.github.com/repos/gaussdb/gaussdb/actions/caches?key=libpq-manylinux-ppc64le-17.2-3.4.0"
#
# ref: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-key

Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: psycopg_binary
package-dir: gaussdb_binary
env:
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_I686_IMAGE: manylinux2014
Expand All @@ -82,19 +82,19 @@ jobs:
CIBW_REPAIR_WHEEL_COMMAND: >-
./tools/ci/strip_wheel.sh {wheel}
&& auditwheel repair -w {dest_dir} {wheel}
CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
CIBW_TEST_REQUIRES: ./gaussdb[test] ./gaussdb_pool
CIBW_TEST_COMMAND: >-
pytest {project}/tests -m 'not slow and not flakey' --color yes
CIBW_ENVIRONMENT_PASS_LINUX: LIBPQ_VERSION OPENSSL_VERSION
CIBW_ENVIRONMENT: >-
PSYCOPG_IMPL=binary
PSYCOPG_TEST_DSN='host=172.17.0.1 user=postgres'
GAUSSDB_IMPL=binary
GAUSSDB_TEST_DSN='host=172.17.0.1 user=postgres'
PGPASSWORD=password
LIBPQ_BUILD_PREFIX=/host/tmp/libpq.build
PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH"
LD_LIBRARY_PATH="$LIBPQ_BUILD_PREFIX/lib:$LIBPQ_BUILD_PREFIX/lib64"
PSYCOPG_TEST_WANT_LIBPQ_BUILD=${{ env.LIBPQ_VERSION }}
PSYCOPG_TEST_WANT_LIBPQ_IMPORT=${{ env.LIBPQ_VERSION }}
GAUSSDB_TEST_WANT_LIBPQ_BUILD=${{ env.LIBPQ_VERSION }}
GAUSSDB_TEST_WANT_LIBPQ_IMPORT=${{ env.LIBPQ_VERSION }}

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -144,23 +144,23 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: psycopg_binary
package-dir: gaussdb_binary
env:
CIBW_BUILD: ${{matrix.pyver}}-macosx_${{matrix.arch}}
CIBW_ARCHS_MACOS: ${{matrix.arch}}
MACOSX_ARCHITECTURE: ${{matrix.arch}}
CIBW_BEFORE_ALL_MACOS: ./tools/ci/wheel_macos_before_all.sh
CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
CIBW_TEST_REQUIRES: ./gaussdb[test] ./gaussdb_pool
CIBW_TEST_COMMAND: >-
pytest {project}/tests -m 'not slow and not flakey' --color yes
CIBW_ENVIRONMENT: >-
PG_VERSION=17
PSYCOPG_IMPL=binary
PSYCOPG_TEST_DSN='dbname=postgres'
GAUSSDB_IMPL=binary
GAUSSDB_TEST_DSN='dbname=postgres'
LIBPQ_BUILD_PREFIX=/tmp/libpq.build
PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH"
PSYCOPG_TEST_WANT_LIBPQ_BUILD=">= ${{env.LIBPQ_VERSION}}"
PSYCOPG_TEST_WANT_LIBPQ_IMPORT=">= ${{env.LIBPQ_VERSION}}"
GAUSSDB_TEST_WANT_LIBPQ_BUILD=">= ${{env.LIBPQ_VERSION}}"
GAUSSDB_TEST_WANT_LIBPQ_IMPORT=">= ${{env.LIBPQ_VERSION}}"

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: psycopg_binary
package-dir: gaussdb_binary
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # cache vcpkg
CIBW_BUILD: ${{matrix.pyver}}-${{matrix.arch}}
Expand All @@ -222,14 +222,14 @@ jobs:
delvewheel repair -w {dest_dir}
--add-path="${{ steps.libdir.outputs.EXTRA_LIB_DIR }}"
--no-mangle "libiconv-2.dll;libwinpthread-1.dll" {wheel}
CIBW_TEST_REQUIRES: ./psycopg[test] ./psycopg_pool
CIBW_TEST_REQUIRES: ./gaussdb[test] ./gaussdb_pool
CIBW_TEST_COMMAND: >-
pytest {project}/tests -m "not slow and not flakey" --color yes
CIBW_ENVIRONMENT_WINDOWS: >-
PSYCOPG_IMPL=binary
PSYCOPG_TEST_DSN="host=127.0.0.1 user=postgres"
PSYCOPG_TEST_WANT_LIBPQ_BUILD=${{env.LIBPQ_VERSION}}
PSYCOPG_TEST_WANT_LIBPQ_IMPORT=${{env.LIBPQ_VERSION}}
GAUSSDB_IMPL=binary
GAUSSDB_TEST_DSN="host=127.0.0.1 user=postgres"
GAUSSDB_TEST_WANT_LIBPQ_BUILD=${{env.LIBPQ_VERSION}}
GAUSSDB_TEST_WANT_LIBPQ_IMPORT=${{env.LIBPQ_VERSION}}

- uses: actions/upload-artifact@v4
with:
Expand All @@ -249,7 +249,7 @@ jobs:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: psycopg-binary-artifact
name: gaussdb-binary-artifact
delete-merged: true

# }}}
10 changes: 5 additions & 5 deletions .github/workflows/packages-pool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
fail-fast: false
matrix:
include:
- {package: psycopg_pool, format: sdist}
- {package: psycopg_pool, format: wheel}
- {package: gaussdb_pool, format: sdist}
- {package: gaussdb_pool, format: wheel}

steps:
- uses: actions/checkout@v4
Expand All @@ -31,12 +31,12 @@ jobs:
run: python -m build -o dist --${{ matrix.format }} ${{ matrix.package }}

- name: Install the Python pool package and test requirements
run: pip install psycopg[test] dist/*
run: pip install gaussdb[test] dist/*

- name: Test the package
run: pytest -m 'pool and not slow and not flakey' --color yes
env:
PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
GAUSSDB_TEST_DSN: "host=127.0.0.1 user=postgres"
PGPASSWORD: password

- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -66,5 +66,5 @@ jobs:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: psycopg-pool-artifact
name: gaussdb-pool-artifact
delete-merged: true
20 changes: 10 additions & 10 deletions .github/workflows/packages-src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
fail-fast: false
matrix:
include:
- {package: psycopg, format: sdist, impl: python}
- {package: psycopg, format: wheel, impl: python}
- {package: psycopg_c, format: sdist, impl: c}
- {package: gaussdb, format: sdist, impl: python}
- {package: gaussdb, format: wheel, impl: python}
- {package: gaussdb_c, format: sdist, impl: c}

steps:
- uses: actions/checkout@v4
Expand All @@ -33,18 +33,18 @@ jobs:
run: python -m build -o dist --${{ matrix.format }} ${{ matrix.package }}

- name: Install the Python package and test requirements
run: pip install `ls dist/*`[test] ./psycopg_pool
if: ${{ matrix.package == 'psycopg' }}
run: pip install `ls dist/*`[test] ./gaussdb_pool
if: ${{ matrix.package == 'gaussdb' }}

- name: Install the C package and test requirements
run: pip install dist/* ./psycopg[test] ./psycopg_pool
if: ${{ matrix.package == 'psycopg_c' }}
run: pip install dist/* ./gaussdb[test] ./gaussdb_pool
if: ${{ matrix.package == 'gaussdb_c' }}

- name: Test the sdist package
run: pytest -m 'not slow and not flakey' --color yes
env:
PSYCOPG_IMPL: ${{ matrix.impl }}
PSYCOPG_TEST_DSN: "host=127.0.0.1 user=postgres"
GAUSSDB_IMPL: ${{ matrix.impl }}
GAUSSDB_TEST_DSN: "host=127.0.0.1 user=postgres"
PGPASSWORD: password

- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -73,5 +73,5 @@ jobs:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: psycopg-src-artifact
name: gaussdb-src-artifact
delete-merged: true
Loading
Loading