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

Add new option: pip wheel --save-wheel-names #6377

Merged
merged 3 commits into from
Oct 19, 2019

Conversation

PatrikKopkan
Copy link

PR for #6340

src/pip/_internal/wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/wheel.py Outdated Show resolved Hide resolved
news/6340.feature Outdated Show resolved Hide resolved
news/6340.feature Outdated Show resolved Hide resolved
news/6340.feature Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
tests/functional/test_wheel.py Outdated Show resolved Hide resolved
tests/functional/test_wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
@hroncok
Copy link
Contributor

hroncok commented Apr 11, 2019

Also, i consider the name of this PR not very descriptive about what it does. Namely, it should contain the name of the added option.

@pradyunsg
Copy link
Member

Thanks @hroncok for reviewing this!

@PatrikKopkan PatrikKopkan changed the title new option for wheel new option for wheel --save-wheel-names Apr 15, 2019
@PatrikKopkan
Copy link
Author

I think that functionality is done. May someone from pypa tell me what should be next step? By the way it seems that the failed CI test is not my fault.

Build started
git clone -q --depth=50 https://github.com/pypa/pip.git C:\projects\pip
fatal: unable to access 'https://github.com/pypa/pip.git/': Could not resolve host: github.com
Command exited with code 128

@PatrikKopkan
Copy link
Author

hi, would you have time to look at this ? @pradyunsg

@hroncok
Copy link
Contributor

hroncok commented Jun 5, 2019

@pradyunsg Hey. What can we do to move this forward? I think this looks good from our POV.

@hroncok
Copy link
Contributor

hroncok commented Jun 19, 2019

@pradyunsg Please?

Copy link
Member

@cjerdonek cjerdonek left a comment

Choose a reason for hiding this comment

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

I added a few review comments.

news/6340.feature Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
@pradyunsg
Copy link
Member

@pradyunsg Please?

Whoops! I've missed these notifications -- I'll take a look at this today evening.

@PatrikKopkan PatrikKopkan force-pushed the master branch 2 times, most recently from edfa759 to f6924d2 Compare June 20, 2019 16:10
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.

Thanks for this PR (and your patience) @PatrikKopkan! :) (and @hroncok for pinging me on this)

This PR seems to be failing on Windows (I have a suggestion inline to fix that) and the linter isn't super happy so please satisfy the linter. :P

This seems to be fairly complete functionally, and I don't have any major concerns there. I have made some inline comments about the details around the implementation / testing.


Please feel free to skip the comments starting with nit: if you disagree with them. I'm nitpicking there, so please don't mind me. I'd hate for those to be something that causes friction. :)

src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/wheel.py Outdated Show resolved Hide resolved
tests/functional/test_wheel.py Show resolved Hide resolved
tests/unit/test_wheel.py Outdated Show resolved Hide resolved
news/6340.feature Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/commands/wheel.py Outdated Show resolved Hide resolved
tests/functional/test_wheel.py Outdated Show resolved Hide resolved
src/pip/_internal/wheel.py Outdated Show resolved Hide resolved
@pradyunsg pradyunsg added C: wheel The wheel format and 'pip wheel' command S: awaiting response Waiting for a response/more information type: feature request Request for a new feature labels Jun 21, 2019
@pradyunsg pradyunsg dismissed cjerdonek’s stale review June 21, 2019 07:11

Review comments addressed.

class TestWheelCommand(object):
@patch('pip._internal.wheel.WheelBuilder')
@patch('pip._internal.commands.wheel.RequirementSet')
def test_save_wheelnames(self, mocked_rs, mocked_wb):
Copy link
Member

@cjerdonek cjerdonek Jun 21, 2019

Choose a reason for hiding this comment

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

This test seems like it's going overboard with the mocking, etc, and as a result the test is a lot more complicated than it needs to be, IMO. Ideally, no calls to mock or patch should be needed. I would suggest changing save_wheelnames() to accept path_to_wheelnames and wheel_filenames and use the tmpdir fixture. Then instead of mocking open(), just let save_wheelnames() write a normal file, and check the file's contents at the end of the test. As for the RequirementSet object, I would see if you can pick a signature for save_wheelnames() that doesn't require mocking there, either. The body of the function only uses requirement_set.requirements.values(), so if necessary you could have the function accept just the values. Or if it's easy to construct a requirement_set.requirements object, you could have it accept requirements. My intention in suggesting a separate function was to have a function that is easy to test while also testing most of the file-writing logic.

Copy link
Author

Choose a reason for hiding this comment

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

Feedback of inexperienced contributor:
I admit that I am not familiar with philosophy of tests. My understanding of unit tests is that should check only tested function and should not rely on function calls of others function. When I saw there are directories dedicated to split the types of test(functional, unit) it misled me that the test should be done this way.

Copy link
Member

@pradyunsg pradyunsg Jun 21, 2019

Choose a reason for hiding this comment

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

Feedback of inexperienced contributor:

@PatrikKopkan The feedback helps. :)

The approach @cjerdonek describes is usually simpler to test on since all the function's "true" dependencies are surfaced and thus the need for mocking is reduced, while making it clearer at the call site what is actually being used.

Do you think that having some prose on this approach to testing would help new contributors understand this better?

Copy link
Author

Choose a reason for hiding this comment

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

It might. Either way thanks for guiding me

@pradyunsg pradyunsg changed the title new option for wheel --save-wheel-names Add new option: pip wheel --save-wheel-names Jun 21, 2019
@pypa-bot
Copy link

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will eligible for code review and hopefully merging!

@PatrikKopkan
Copy link
Author

I think it is ready for rereview.

@pradyunsg
Copy link
Member

ISTM that the history of this PR isn't correct (eg 89f5adc is included but really shouldn't be). @PatrikKopkan could you look into that?

@PatrikKopkan
Copy link
Author

@pradyunsg, Oh sorry

@BrownTruck
Copy link
Contributor

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will be eligible for code review and hopefully merging!

@BrownTruck BrownTruck added the needs rebase or merge PR has conflicts with current master label Sep 29, 2019
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Sep 30, 2019
@pypa-bot
Copy link

Hello!

I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the master branch into this pull request or rebase this pull request against master then it will eligible for code review and hopefully merging!

@pypa-bot pypa-bot added the needs rebase or merge PR has conflicts with current master label Oct 18, 2019
@pypa-bot pypa-bot removed the needs rebase or merge PR has conflicts with current master label Oct 18, 2019
@PatrikKopkan
Copy link
Author

@pradyunsg , thank you for help with merge conflict, is there something I could do?

@pradyunsg pradyunsg merged commit bcad1b1 into pypa:master Oct 19, 2019
@pradyunsg
Copy link
Member

Hurrah! Thanks for following up on this @PatrikKopkan! ^>^

LGTM, and merged. :)

@chrahunt
Copy link
Member

chrahunt commented Nov 4, 2019

Is this sufficient to satisfy the original use case

output_dir="$(mktemp -d)"
pip wheel --wheel-dir "$output_dir" ...
find "$output_dir" -type f -print0 | xargs -0 pip install

If so that would be my preference, since it has a couple benefits over the new argument as mentioned in #6340 (comment). The code prior to this change was already a bit tangled, so any concerns we can avoid adding benefit the general improvements we're doing in this area (see #7285 (comment) for an example).

@PatrikKopkan
Copy link
Author

Is this sufficient to satisfy the original use case

output_dir="$(mktemp -d)"
pip wheel --wheel-dir "$output_dir" ...
find "$output_dir" -type f -print0 | xargs -0 pip install

If so that would be my preference, since it has a couple benefits over the new argument as mentioned in #6340 (comment). The code prior to this change was already a bit tangled, so any concerns we can avoid adding benefit the general improvements we're doing in this area (see #7285 (comment) for an example).

Yes, it does. I originally thought that option would be better but arguments made me realize that it is not good as I thought.

chrahunt added a commit to chrahunt/pip that referenced this pull request Dec 1, 2019
This reverts commit bcad1b1, reversing
changes made to f864903.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
chrahunt added a commit to chrahunt/pip that referenced this pull request Dec 2, 2019
This reverts commit bcad1b1, reversing
changes made to f864903.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
chrahunt added a commit to chrahunt/pip that referenced this pull request Dec 3, 2019
This reverts commit bcad1b1, reversing
changes made to f864903.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
chrahunt added a commit that referenced this pull request Dec 12, 2019
This reverts commit bcad1b1, reversing
changes made to f864903.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Dec 14, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Dec 14, 2019
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 C: wheel The wheel format and 'pip wheel' command S: awaiting response Waiting for a response/more information type: feature request Request for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants