Skip to content
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

Conversation

NoahGorny
Copy link
Contributor

Closes #9176

@NoahGorny NoahGorny force-pushed the warn-direct-url-is-not-recorded-setup-py-install branch from 05b0639 to 25e2af9 Compare December 4, 2020 13:23
@NoahGorny NoahGorny force-pushed the warn-direct-url-is-not-recorded-setup-py-install branch from 25e2af9 to 2484bd3 Compare January 22, 2021 21:39
@NoahGorny
Copy link
Contributor Author

@uranusjr I rebased this to latest master, but I think this can be merged

@uranusjr
Copy link
Member

I'm waiting for a second opinion if possible.

@pfmoore
Copy link
Member

pfmoore commented Jan 22, 2021

Let's leave it until after the release this weekend, in that case.

@sbidoul
Copy link
Member

sbidoul commented Jan 24, 2021

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 REQUESTED that is not generated in this case.

Also, the setup.py install code path will be called out systematically when #9422 and #8560 are complete, so we might want to rather make it a more generic warning that some features may not work perfectly when the legacy setup.py install is used.

Regarding freeze, we could detect legacy installed distributions when running pip freeze and warn about those there ?

@uranusjr
Copy link
Member

Regarding freeze, we could detect legacy installed distributions when running pip freeze and warn about those there?

Is it possible/easy to detect an setup.py install-ed distribution apart from a wheel-installed one? Does the format guaranteed to be a .egg-info, for example?

@sbidoul
Copy link
Member

sbidoul commented Jan 25, 2021

Or can we assume the presence of .dist-info means the installation is standards-based ?

Copy link
Member

@pradyunsg pradyunsg left a 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.

@NoahGorny NoahGorny force-pushed the warn-direct-url-is-not-recorded-setup-py-install branch from 2484bd3 to 64c0b8f Compare March 3, 2021 21:54
@NoahGorny
Copy link
Contributor Author

We should probably add a test to ensure that this warning is printed.

Addded 😄

)

req.source_dir = os.curdir
req.install([])
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @pradyunsg

Copy link
Member

@pradyunsg pradyunsg Sep 21, 2021

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

Copy link
Member

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.

@github-actions github-actions bot added the needs rebase or merge PR has conflicts with current master label Aug 15, 2021
@NoahGorny NoahGorny force-pushed the warn-direct-url-is-not-recorded-setup-py-install branch from 64c0b8f to d841b46 Compare September 16, 2021 20:03
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Sep 16, 2021
@uranusjr uranusjr added this to the 21.3 milestone Sep 20, 2021
logger.warning(
"Direct URL of package '%s' will not be recorded when "
"using legacy 'setup.py install'.\n"
"Consider installing the 'wheel' package.",
Copy link
Member

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.link.is_vcs:
if self.original_link:

To better match the condition used to create direct_url.json ?

@pradyunsg pradyunsg added the S: awaiting response Waiting for a response/more information label Sep 21, 2021
@pradyunsg pradyunsg removed this from the 21.3 milestone Oct 2, 2021
@pradyunsg pradyunsg added C: vcs pip's interaction with version control systems like git, svn and bzr type: enhancement Improvements to functionality labels Oct 2, 2021
@pradyunsg pradyunsg dismissed their stale review October 2, 2021 11:41

Addressed earlier.

@pradyunsg
Copy link
Member

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. :)

@github-actions github-actions bot added the needs rebase or merge PR has conflicts with current master label Aug 10, 2022
@pradyunsg
Copy link
Member

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)!

@pradyunsg pradyunsg closed this Sep 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: vcs pip's interaction with version control systems like git, svn and bzr needs rebase or merge PR has conflicts with current master S: awaiting response Waiting for a response/more information type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn that direct URL will not be recorded when running setup.py install
7 participants