I’m proposing this to the packaging community, with the hopes of getting thoughts and feedback. I’m interested to hear what you all think!
Background
The egg= fragment is one of two ways to specify the name of a package in a requirement specifier that doesn’t “natively” contain the package name (e.g. a URL, where the base component of the URL may not match the project’s name).
For example, here’s how you can tell pip that a URL requirement installs package foo:
git+https://github.com/some-org/some-repo.git@some-rev#egg=foo
This is equivalent, as far as I can tell, to the preferred requirement syntax:
foo @ git+https://github.com/some-org/some-repo.git@some-rev
Motivation
The egg= fragment is only weakly specified, and currently enables some surprising behavior:
-
The value of the
eggfragment is parsed as a requirement in its own right, meaning that the following happily parses:git+https://example.com/foo.git@rev#egg=foo[extra1,extra2]==1.2.3This is surprising, since the version constraint has no actual meaning here and the extras (
extra1,extra2) actually do end up getting installed. -
It isn’t immediately clear what a requirement like this does:
foo @ git+https://example.com/repo.git@rev#egg=barIt would be reasonable to expect it to install either
fooorbar(or both?), but it’s not specified which is actually preferred. Experimentally, recent versions ofpipinstallfoorather thanbar.
Proposed solution
Deprecate egg= fragment support entirely, and eventually remove it from pip and related tools.
If I’m correct (and I might not be!), then egg= is entirely vestigial in the current packaging ecosystem: it’s functionally equivalent to the less ambiguous and easier to parse name @ url syntax, is (currently) poorly specified, and references a long obsoleted packaging format (Eggs).
Further context
I currently have a PR open (https://github.com/pypa/pip/pull/11617) on pip to refine pip’s existing behavior around egg= fragments: the current surprising behavior around extras is being deprecated, with the current plan being to remove it after two full releases.
