public inbox for [email protected]
help / color / mirror / Atom feedDoes psycopg2-binary provide the psycopg2 package?
2+ messages / 2 participants
[nested] [flat]
* Does psycopg2-binary provide the psycopg2 package?
@ 2023-05-22 16:05 Kerrick Staley <[email protected]>
2023-05-23 11:18 ` Re: Does psycopg2-binary provide the psycopg2 package? Daniele Varrazzo <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Kerrick Staley @ 2023-05-22 16:05 UTC (permalink / raw)
To: psycopg
If I install psycopg2-binary, and then I try to install a package that
depends on psycopg2, will pip "know" that psycopg2-binary satisfies the
psycopg2 requirement and avoid installing psycopg2?
Empirically the answer seems to be "no". I installed psycopg2-binary, then
ran `python3 -m pip install -e .` in a directory with this setup.py file
<https://gist.github.com/kerrick-js/b0962b74853cc297cf2186d251763262;, and
it tried to install psycopg2.
Is there a way that, in my setup.py file, I can depend on either psycopg2
or psycopg2-binary, whichever is available?
Thanks,
Kerrick
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Does psycopg2-binary provide the psycopg2 package?
2023-05-22 16:05 Does psycopg2-binary provide the psycopg2 package? Kerrick Staley <[email protected]>
@ 2023-05-23 11:18 ` Daniele Varrazzo <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Daniele Varrazzo @ 2023-05-23 11:18 UTC (permalink / raw)
To: Kerrick Staley <[email protected]>; +Cc: psycopg
On Tue, 23 May 2023 at 08:52, Kerrick Staley <[email protected]> wrote:
>
> If I install psycopg2-binary, and then I try to install a package that depends on psycopg2, will pip "know" that psycopg2-binary satisfies the psycopg2 requirement and avoid installing psycopg2?
>
> Empirically the answer seems to be "no". I installed psycopg2-binary, then ran `python3 -m pip install -e .` in a directory with this setup.py file, and it tried to install psycopg2.
>
> Is there a way that, in my setup.py file, I can depend on either psycopg2 or psycopg2-binary, whichever is available?
I don't think there is. You cannot make a package depending on either
one or the other. Python packaging metadata doesn't offer this
flexibility.
In psycopg 3 the only package to depend on is `psycopg`. The
pre-compiled C module (the `psycopg-binary` package on pypi) can be
added as an add-on and it is not necessary for a library to depend on
it. It can be an application requirement instead.
In my projects I use `psycopg` as an abstract dependency (in the
`setup.cfg` of the packages that need psycopg) and
`psycopg-binary==3.x.x` as a concrete dependency (in a
`requirements.txt` file generated by `pip-tools` using `psycopg-binary
in the `requirements.in`)
More details about psycopg 3 versions management are available at
https://www.psycopg.org/psycopg3/docs/basic/install.html#handling-dependencies
-- Daniele
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2023-05-23 11:18 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 16:05 Does psycopg2-binary provide the psycopg2 package? Kerrick Staley <[email protected]>
2023-05-23 11:18 ` Daniele Varrazzo <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox