Skip to content

fix(deps): pin psycopg[c] back to 3.3.4 - #10399

Open
asheshv wants to merge 1 commit into
pgadmin-org:masterfrom
asheshv:fix/psycopg-c-pin-3.3.4
Open

fix(deps): pin psycopg[c] back to 3.3.4#10399
asheshv wants to merge 1 commit into
pgadmin-org:masterfrom
asheshv:fix/psycopg-c-pin-3.3.4

Conversation

@asheshv

@asheshv asheshv commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Problem

The macOS x64 packaging job fails installing requirements.txt:

Collecting psycopg-c==3.3.5 (from psycopg[c]==3.3.5->-r .../requirements.txt (line 56))
  Preparing metadata (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  │ exit code: -10
  ╰─> [2 lines of output]
      .../setuptools/config/pyprojecttoml.py:72: _ExperimentalConfiguration: [tool.setuptools.ext-modules] in pyproject.toml is still experimental and likely to change in future releases.

Exit code -10 is SIGBUS. The only output before the crash is setuptools' own experimental-config warning, so it dies while setuptools reads the project config — well before pg_config is invoked.

Cause

psycopg-c publishes no wheels, so every platform compiles it from the sdist. The only build-tooling change between 3.3.4 and 3.3.5 is the strictly pinned build requirement:

psycopg-c build requirement
3.3.0 – 3.3.4 setuptools == 80.3.1
3.3.5 setuptools == 83.0.0

Because the pin is an equality, PIP_CONSTRAINT cannot override the version inside the isolated build environment. Keeping 3.3.5 would mean either --no-build-isolation with a pre-seeded setuptools — forking the macOS build procedure from Linux's, with a silent drift risk whenever requirements.txt changes — or an upstream fix. Linux builds 3.3.5 without trouble, so this looks specific to the relocatable-python framework the macOS bundle is built against.

Change

Pin psycopg[c] to 3.3.4 for python_version >= '3.10'. The Python 3.9 pin (3.2.13) is untouched.

The encoding.py rewrite that shipped alongside the 3.3.5 bump in #10370 needs no change: it reads the derived py_codecs/pg_codecs dicts, which are plain dicts in both versions.

One test expectation was 3.3.5-specific. psycopg 3.3.5 added an ISO88591 alias to its encoding table, so inverting py_codecs resolves iso8859-1 to ISO88591; on 3.3.4 only LATIN1 exists, so get_encoding('LATIN1') returns ['LATIN1', 'iso8859-1'] instead of ['ISO88591', 'iso8859-1']. Both are valid PostgreSQL names for the same encoding, so the scenario now accepts either.

Testing

  • python regression/runtests.py --pkg utils.driver.psycopg3 — 7/7 pass with psycopg 3.3.4.
  • Same suite re-run with psycopg 3.3.5 installed — 7/7 pass, so the test stays valid across both.
  • pycodestyle clean on the modified test.

Not verified: that 3.3.4 actually builds on the failing macOS x64 host. That change is reasoned from the sdist diff above; it needs confirmation from a Jenkins run.

Follow-up

Worth reporting the SIGBUS upstream (setuptools 83.0.0 inside a relocated Python.framework) so the pin can be lifted. A quick reproducer on the x64 build host:

$PY/python3 -c "from distutils.command.build_ext import build_ext; print('ok')"
$PY/pip3 install "setuptools==83.0.0" && $PY/python3 -c "import setuptools; print(setuptools.__version__)"
$PY/pip3 install -v --no-binary :all: --no-deps psycopg-c==3.3.5

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with psycopg versions that report equivalent character encodings under different aliases.
    • Pinned the psycopg dependency to version 3.3.4 for Python 3.10 and newer.

The macOS x64 packaging job fails while installing requirements.txt:

    Preparing metadata (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error
    exit code: -10

Exit code -10 is SIGBUS. The only output before the crash is
setuptools' own `[tool.setuptools.ext-modules] in pyproject.toml is
still experimental` warning, so it dies while setuptools reads the
project config, well before pg_config is ever invoked.

psycopg-c ships no wheels, so every platform compiles it from the
sdist. The only build-tooling change between 3.3.4 and 3.3.5 is the
strictly pinned build requirement:

    3.3.0 - 3.3.4    setuptools == 80.3.1
    3.3.5            setuptools == 83.0.0

Because that pin is an equality, PIP_CONSTRAINT cannot override the
version inside the isolated build environment - the only ways to keep
3.3.5 are --no-build-isolation with a pre-seeded setuptools (which
would fork the macOS build procedure from Linux's) or an upstream
fix. Linux builds 3.3.5 fine, so this looks specific to the
relocatable-python framework the macOS bundle is built against.

Pin to 3.3.4 to unblock the build. The encoding.py rewrite that
shipped alongside the 3.3.5 bump stays untouched: it reads the
derived py_codecs/pg_codecs dicts, which are plain dicts in both
versions.

One test expectation was 3.3.5-specific. psycopg 3.3.5 added an
ISO88591 alias to its encoding table, so inverting py_codecs resolves
iso8859-1 to ISO88591; on 3.3.4 only LATIN1 exists, so
get_encoding('LATIN1') returns ['LATIN1', 'iso8859-1'] instead of
['ISO88591', 'iso8859-1']. Both are valid PostgreSQL names for the
same encoding, so the scenario now accepts either and the test passes
on 3.3.4 and 3.3.5 alike.
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 4bae3556-e2e0-4abd-bbf3-fb61be5e872e

📥 Commits

Reviewing files that changed from the base of the PR and between 9d0a61a and a4b7548.

📒 Files selected for processing (2)
  • requirements.txt
  • web/pgadmin/utils/driver/psycopg3/tests/test_encoding.py

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The psycopg dependency pin changed from 3.3.5 to 3.3.4. Encoding tests now support alternate PostgreSQL aliases and validate the encoding result once.

Changes

Psycopg encoding compatibility

Layer / File(s) Summary
Dependency and encoding test alignment
requirements.txt, web/pgadmin/utils/driver/psycopg3/tests/test_encoding.py
The psycopg pin changed to 3.3.4. Encoding tests accept ISO88591 or LATIN1 and require the iso8859-1 codec.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to a4b75

This change pins psycopg to 3.3.4 for Python 3.10+ and accepts the compatible PostgreSQL encoding aliases while retaining codec validation. The supplied regression results show no remaining merge-blocking risk.

Suggested reviewers: dpage

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: pinning the psycopg[c] dependency back to version 3.3.4. This matches the main change in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant