psycopg / psycopg2

PostgreSQL database adapter for the Python programming language
https://www.psycopg.org/
Other
3.31k stars 503 forks source link

Add support for Python 3.13 #1695

Closed befeleme closed 1 month ago

befeleme commented 4 months ago

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.

dvarrazzo commented 4 months ago

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 commented 4 months ago

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

dvarrazzo commented 4 months ago

Thank you for this!

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

https://github.com/psycopg/psycopg2/blob/a971c11d5038333f08821ef452ce1237a22cdb0e/setup.py#L47-L61

which reminds to update install.rst too.

I can deal with the website once merged.

Thank you very much!

dvarrazzo commented 4 months ago

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 commented 4 months ago

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

dvarrazzo commented 4 months ago

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

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

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 commented 4 months ago

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 commented 4 months ago

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

rouilj commented 4 months ago

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 commented 4 months ago

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

rouilj commented 4 months ago

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 commented 1 month ago

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.