psycopg / psycopg2

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

`psycopg2-binary` package is causing trouble for dependent packages #1642

Closed Flamefire closed 12 months ago

Flamefire commented 12 months ago

The change to add another, differently named, package for binary distribution causes problems for Python packages depending on psycopg2: What are they supposed to put into their requirements? (i.e. in setup.py)?

As per the documentation:

If you are the maintainer of a published package depending on psycopg2 you shouldn’t use psycopg2-binary as a module dependency.

According to this it should be psycopg2, but now for users running pip install foo it will try to download and build the source package which potentially fails to install due to unmet build requirements. They can manually run pip install psycopg2-binary but PIP would still resolve to download and build psycopg2 when they install the dependent package foo.

Is there a solution to this issue that either package suffices a potential requirement as resolved by pip? Or would you consider readding the binary wheels to psycopg2?

In any case can this be better documented for maintainers of dependent packages please?

See https://github.com/pepkit/pipestat/issues/106 for an example.

dvarrazzo commented 12 months ago

Hello,

Unfortunately the case of two distribution packages (psycopg2, psycopg2-binary) providing the same Python package (psycopg2) is not handled well by Python distribution metadata.

The problem has been resolved in psycopg 3. See docs about installing the binary package and handling dependencies.

The documentation for psycopg 2 is adequate: the pipestat devs might have read it and decided that it didn't apply to them, or might have not read it, in which case better docs wouldn't have helped.

My suggestion for them is to migrate to psycopg 3. Even if the problems that affected the first versions of the binary package are probably resolved, we are not considering re-adding the binary wheels to psycopg2.