Ideally this problem should be solved with the Provides-Dist metadata.[1] The exact semantic to the flag is unfortunately not discussed much currently, and no installer implementations that I know of (including pip) support it at all.

This also recently came up in pip’s issue tracker,[2] and I guess this is as good a time as any to start the conversation if someone is willing to help drive that discussion forward.

[1]: https://packaging.python.org/specifications/core-metadata/#provides-dist-multiple-use
[2]: https://github.com/pypa/pip/issues/8669

--
Tzu-ping Chung (@uranusjr)
uranusjr@gmail.com
https://uranusjr.com



On 03/8, 2020, at 05:59, Daniele Varrazzo <daniele.varrazzo@gmail.com> wrote:

On Sun, 2 Aug 2020 at 21:34, Bert JW Regeer <xistence@0x58.com> wrote:

By splitting it into two different packages you end up with the same situation that currently plagues psycopg2/psycopg2-binary whereby if you depend on psycopg2 you can't easily swap in psycopg2-binary and vice-versa as the two don't satisfy the same dependency.

The psycopg2 wheel or not wheel is the situation you describe, and
it's really suboptimal from the point of declaring dependencies:
beginners would like to use psycopg2-binary, but projects are advised
to depend on psycopg2, so they either don't get the wheel benefit or
they end up in a tangle of dependencies, two distributions installing
the same files, bad stuff. Offering the C distribution as an opt-in
extension would allow projects to depend only on the pure python
psycopg3, which would be also the right choice for beginners, and
allowing the grown-ups with a compiler to go faster by installing
psycopg3-c too, which wouldn't conflict with the basic package.


Number 3 is kind of what sqlalchemy does, and then provide wheels for a huge variety of platforms to allow people to install the package without needing a compiler themselves.

The difference in performance of the C extension is important enough
(15-20x - https://www.varrazzo.com/blog/2020/05/19/a-trip-into-optimisation/)
to arguably make or break a deal. If someone wanted the C extension
because they need the performance I wouldn't want its installation to
fail silently.


-- Daniele
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-leave@python.org
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at https://mail.python.org/archives/list/distutils-sig@python.org/message/MQNGT25XY3V7UDTKXVOEQ3XABLTEK4DS/