Skip to content

Conversation

@befeleme
Copy link
Contributor

See individual commits.
I don't have all the bits to run tests, but I used these changes to build psycopg2 in Fedora and tests with Python 3.13 passed.
It would probably be good to add 3.13 to CI, but I'm not sure about the desired version matrix, so haven't done any changes there.
Related to #1692.

Since 3.13.0a1 it has been renamed to PyInterpreterStateGet()
Source: python/cpython#106321
The textual representation of addresses has changed, adapt the code to
expect different values on Python 3.13+.
See: python/cpython@f22bf8e3cf899896cf587099d292
@dvarrazzo
Copy link
Member

Thank you very much for the MR!

It would actually be good to add 3.13 to the test grid.

According to the python action docs, the version supported are in the versions-manifest.json, and it seems that 3.13.0-alpha.6 could be a valid one.

Could you please try to add it to the grid? Just for Linux is fine. You can use any Postgres version you prefer: copying the same used in Python 3.11, or stretching the postgres range (you might see that there's a version missing because there are currently 6 tested Python version with 7 postgres versions, so we can close the gap and test them 1:1).

@befeleme
Copy link
Contributor Author

I added 3.13 to tox.ini and github CI config file.

@dvarrazzo
Copy link
Member

Thank you for this!

There are a few other places to touch up: the classifiers in setup.py

psycopg2/setup.py

Lines 47 to 61 in a971c11

# note: if you are changing the list of supported Python version please fix
# the docs in install.rst and the /features/ page on the website.
classifiers = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3 :: Only

which reminds to update install.rst too.

I can deal with the website once merged.

Thank you very much!

@dvarrazzo
Copy link
Member

I added 3.13 to tox.ini and github CI config file.

The tests don't seem to pass. There is a mismatch between tox and github afaics: https://github.com/psycopg/psycopg2/actions/runs/8828621201

@befeleme
Copy link
Contributor Author

Could you rerun the tests? I redefined Python version in the config files to 3.13 & added the classifiers.

@dvarrazzo
Copy link
Member

Hmmm... there's still a mismatch between tox and github.

I think something similar was solved in the past, for instance see this commment: 5fb1305

However, TBH, I am happy to drop support for tox. In the past it was useful, but now it's just a pain in the proverbial.

I think the Install tox step can be dropped, the Run tests step can be replaced by run: make check, the [tox] and [testenv] stanzas can be dropped from tox.ini.

Do you want to try with these changes?

@befeleme
Copy link
Contributor Author

Ok, another, hopefully the last attempt - I tested it on my fork and all should pass. I don't feel brave enough to reconfigure the whole CI, so I'll leave it to your consideration.

@dvarrazzo
Copy link
Member

That's ok, I appreciate your help. I'll look into doing some cleanup to the pipeline if tox gets in the way.

@rouilj
Copy link

rouilj commented May 14, 2024

Any idea when this will be available on pypi?

I have a beta release of the Roundup Issue Tracker in a couple of weeks and a 2.4.0 release
in mid July. I would like to test the postgres database with psycopg2 and 3.13beta1 before
then in case I have to make any changes.

Thanks.

@dvarrazzo
Copy link
Member

It will be available on PyPI only after final release of 3.13.

@rouilj
Copy link

rouilj commented May 14, 2024

Ah sorry. Thought you did alpha/beta releases on pypi. Oh well. I guess PostgreSQL testing for 3.13 will have to
wait until after my release. Have a great day.

@dvarrazzo
Copy link
Member

Merging this branch, thank you for your contribution.

We will need to set up build, and I already know that there is some bitrot in the build infrastructure.

@aftermatch1320
Copy link

what's the fix for this ?
I'm still getting

ImportError: Error relocating /app/venv/lib/python3.13/site-packages/psycopg2/_psycopg.cpython-313-x86_64-linux-musl.so: _PyInterpreterState_Get: symbol not found
During handling of the above exception, another exception occurred:

@dvarrazzo
Copy link
Member

@aftermatch1320 even after we will have merged this branch, binary files for Python 3.13 will not be available until Appveyor will have provided Windows runner. This usually takes a few week after the final release of a new major version.

If you want to use psycopg on Python 3.13 on windows right now you can use psycopg 3 instead.

@befeleme befeleme deleted the py3.13 branch January 9, 2025 08:30
jerrinot added a commit to questdb/questdb that referenced this pull request Mar 6, 2025
…ibility

asyncpg release notes: https://github.com/MagicStack/asyncpg/releases/tag/v0.30.0
psycopg2 python 3.13 fix: psycopg/psycopg2#1695

also, explicitly set memory limits in PHP runner since it was failing on macos
with default limits
alexanderankin added a commit to testcontainers/testcontainers-python that referenced this pull request Sep 9, 2025
## Description

`testcontainers-python` is not compatible with python 3.13 because of
several packages.

## Related issues

Fixes #870

## Packages update

- bump cffi: python-cffi/cffi#24
- bump psycopg2: psycopg/psycopg2#1695
- bump trio: python-trio/trio#2955
- bump pytest: pytest-dev/pytest#12334
- bump pymilvus: milvus-io/pymilvus#2684
- bump twine: pypa/twine#1184
- bump cryptography: pyca/cryptography#11491
- bump greenlet:
python-greenlet/greenlet@9497948
(python-greenlet/greenlet#392)
- bump grpcio: grpc/grpc#36201
- bump httpx: encode/httpx#3460
- bump ibm-db: ibmdb/python-ibmdb#971
- bump orjson: https://github.com/ijl/orjson/releases/tag/3.10.15
- bump pandas: https://github.com/pandas-dev/pandas/releases/tag/v2.2.3

> ⚠️ `cryptography` is not compatible with python `3.9.0` and
`3.9.1` to be able to update to the version supporting Python 3.13 we
have to exclude those version, meaning the minimum version is now 3.9.2
included.

---------

Signed-off-by: axel7083 <[email protected]>
Co-authored-by: David Ankin <[email protected]>
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.

4 participants