Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13 #1695

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add support for Python 3.13 #1695

wants to merge 5 commits into from

Conversation

befeleme
Copy link

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
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
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
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.

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.

None yet

3 participants