-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
req: Add warning of not recording VCS info with legacy 'setup.py install' #9208
req: Add warning of not recording VCS info with legacy 'setup.py install' #9208
Conversation
05b0639
to
25e2af9
Compare
25e2af9
to
2484bd3
Compare
@uranusjr I rebased this to latest master, but I think this can be merged |
I'm waiting for a second opinion if possible. |
Let's leave it until after the release this weekend, in that case. |
I'm not 100% convinced this the right place to warn users about this, as this will show a warning for users that may not care about pip freeze at all. There is also Also, the Regarding freeze, we could detect legacy installed distributions when running pip freeze and warn about those there ? |
Is it possible/easy to detect an |
Or can we assume the presence of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably add a test to ensure that this warning is printed.
2484bd3
to
64c0b8f
Compare
Addded 😄 |
) | ||
|
||
req.source_dir = os.curdir | ||
req.install([]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhhh, don't do this in a unit test... This has side effects that affect the interpreter it's running in. Specifically, it'll install the package when you run the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the correct way to do it? This is how it was done in test_req_file.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lemme know what you think @pradyunsg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @pradyunsg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping! This got buried in my notifications. :(
Write an integration test that exercises this code path. Here's an example, that you'll likely need to change the name of the package for. Feel free to add the source code for a minimal reproducer package in tests/data/packages
or use a script.pip("install", "...")
for getting something minimal from the internet.
def test_install_vcs_something_something_triggers_a_warning(
script,
data,
):
to_install = data.packages.joinpath("a-thing-that-triggers-this")
result = script.pip_install_local(
to_install,
allow_stderr_warning=True,
)
msg = "Direct URL of package 'a-thing-that-triggers-this' will not be recorded when using"
assert msg in result.stderr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See test_basic_install_editable_from_svn
for an example of a local-only VCS test.
64c0b8f
to
d841b46
Compare
logger.warning( | ||
"Direct URL of package '%s' will not be recorded when " | ||
"using legacy 'setup.py install'.\n" | ||
"Consider installing the 'wheel' package.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing the wheel package may not be sufficient, as there are other reason for falling back to setup.py install
(such as using --no-binary
or --{install,global}-options
. So we may want to drop this recommendation line.
gone_in=None, | ||
issue=8368, | ||
) | ||
if self.link.is_vcs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.link.is_vcs: | |
if self.original_link: |
To better match the condition used to create direct_url.json ?
To communicate with sufficient clarity: I do not intend to block the 21.3 release on this PR, since this doesn't seem to be a show-stopper issue; even though this would be a nice-to-have improvement! To that end, I've gone ahead and dropped this from the release milestone. :) |
Going to go ahead and close this, since it has merge conflicts that haven't been resolved in a while. Please feel welcome to file a new PR or to reopen and update this one (assuming that's what the existing discussions point toward)! |
Closes #9176