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

Use better temporary files mechanism #7904

Closed
wants to merge 2 commits into from
Closed

Use better temporary files mechanism #7904

wants to merge 2 commits into from

Conversation

siAyush
Copy link

@siAyush siAyush commented Mar 26, 2020

updated wheel.py

@pradyunsg pradyunsg changed the title Use better temporary files mechanism in install_unpacked_wheel #7699 Use better temporary files mechanism in install_unpacked_wheel Mar 26, 2020
@pradyunsg
Copy link
Member

pradyunsg commented Mar 26, 2020

@siAyush Please don't reference issues in the title of another PR/issue, or in commits; since that can result in unnecessary noise created by GitHub's cross-linking.

@siAyush
Copy link
Author

siAyush commented Mar 26, 2020

Thanks, @pradyunsg for correcting me, can you please check this PR.

@siAyush siAyush closed this Mar 26, 2020
@siAyush siAyush changed the title Use better temporary files mechanism in install_unpacked_wheel Use better temporary files mechanism Mar 26, 2020
@pradyunsg
Copy link
Member

@siAyush you've closed the PR. Was that intentional? If so, if you could tell us why, that'd be great!

@siAyush siAyush reopened this Mar 26, 2020
@siAyush
Copy link
Author

siAyush commented Mar 26, 2020

sorry @pradyunsg its happened by mistake actually I lost the internet connection.

@pradyunsg
Copy link
Member

Hehe, no worries. This looks good to me.

/cc @pfmoore for inputs here, in case he has any.

Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

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

This needs a rewrite, as it's stopped using open_for_csv for the output file, and the whole point of open_for_csv is that it ensures the right open parameters for a file that's being passed to the csv module.

I'm a strong -1 on any approach that doesn't use open_for_csv - it's very easy to get tricky line ending problems if you get the open parameters wrong, it's an annoying and fiddly cross-platform compatibility issue, and not reusing the function we have that's explicitly designed to get it right seems to me to be a mistake.

I'm not 100% sure there's a need for this PR in any case - certainly adjacent_tmp_file is a more robust approach, but have we had any actual issues caused by our current approach, or is this simply being done for theoretical reasons?

Sorry for the negative review, but there's more subtlety involved here than is obvious at first glance. I'm not sure I'd have classed this as a "good first issue" because of that. However, thanks @siAyush for picking it up - if you need any additional help or clarification, please ping me.

@siAyush
Copy link
Author

siAyush commented Mar 26, 2020

thanks, @pradyunsg, and @pfmoore (for the reviews) one if my code is right why the test is failing.

@pfmoore
Copy link
Member

pfmoore commented Mar 26, 2020

The test is failing with a lint (code style) eror. You can see the specific message by clicking on "Details" next to the failing test and finding the line with the red "X" next to it ("Test with tox"). Click on the line to expand it and you'll see the full test log.

The error here is

src/pip/_internal/utils/filesystem.py:90:80: E501 line too long (83 > 79 characters)

@deveshks
Copy link
Contributor

You can also ensure consistent coding style by running tox -e lint before pushing your commit, as outlined in https://pip.pypa.io/en/latest/development/getting-started/#running-linters

@siAyush
Copy link
Author

siAyush commented Mar 27, 2020

So I was thinking if previous approach is right. And don't need any modifications as per @pfmoore.
So should I close this PR?

@siAyush
Copy link
Author

siAyush commented Mar 27, 2020

Thanks, @deveshks for help.

@sbidoul
Copy link
Member

sbidoul commented Mar 27, 2020

@pfmoore FTR I opened #7699 following a suggestion by @chrahunt in #7612. This seemed simple enough at the time to warrant the good first issue label (which I have now removed). Apologies if that created trouble to anyone.

@pfmoore
Copy link
Member

pfmoore commented Mar 27, 2020

@sbidoul Not at all! I think the idea is sound, but the details are tricky because of the annoying subtleties of handling CSV files. Maybe it shouldn't have been flagged as a "good first issue", but even that depends on whether you want to target someone who knows Python well but is new to pip, or people who are relatively new to Python.

@siAyush I think that it might be possible to make the approach you have here work, but it would need a more extensive change than you currently have, as you might need to generalise the underlying code further. That may be more than you're comfortable doing, in which case by all means say so and we can close this PR and leave the original issue for someone else to pick up. But if you want to continue working on this, and feel comfortable doing so, that's absolutely fine - it's a useful improvement so we'd be glad to have your contribution.

@siAyush
Copy link
Author

siAyush commented Mar 27, 2020

Thanks, @pradyunsg @pfmoore @sbidoul for guiding me and pointing out my mistakes and helping me. I think pip has the best maintainers.

@siAyush siAyush closed this Mar 27, 2020
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 5, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants