-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Decouple finding, processing, and saving files when installing wheels #8545
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We will already create the parent directories for any files that we want to install, so making sure the destination exists should not be required.
This simplifies the relationship between the loop body and the "get files" section at the top of the loop, making it easier to refactor.
Separating the concerns of "get files to process" and "operate on the files" enforces that there are no dependencies between these parts of `clobber` and will let us extract the "get files to process" out of `clobber` and customize it for each use case.
That just made the previous diff cleaner.
This makes the interface between the file-generating function and the rest of clobber easier to understand, and will act as a type we can pass around and wrap to reduce the caller-specific processing we currently do.
Separating generating the files from operating on them will let us be more explicit about what features of extracted files we depend on, and clean up some of our logic by making them less caller-specific.
This will let us refactor the existing logic as a composition of behaviors, so later changes to read from a zip file directly will be less impactful.
No caller actually checks for None, so just return False.
This makes `clobber` much simpler, and aligns the interface of root_scheme files and data_scheme files, so we can process them in the same way.
This reduces coupling between is_entrypoint_wrapper and the file generation step, and we'll be able to reuse it for processing on files.
Since this is the only place this parameter is used, we can inline the filtering directly.
This lets us get rid of our custom list comprehension in favor of the lazy filter builtin.
This refactoring makes it so that the individual contributors to the files we need to handle can be broken into their own separate functions, similar to the approach we took for console scripts.
35c701a
to
ad0f7b9
Compare
Superseded by #8562. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to install files directly from a wheel, we are required to read the files and file attributes from the zip and write them to disk. Previously, our logic related to saving files was mixed up in our logic for filtering files and editing installed files. All of this was packed into
clobber
, which was called from 2 places with varying arguments.Now
clobber
is gone. The responsibility for finding files has been extracted intofiles_to_process
and simplified. Filtering files and editing files has been moved to the 1 place we actually needed to do it, and saving files has been isolated into its own method.In a later PR we can adapt
files_to_process
to read from the wheel zip andFile.save
to extract file attributes and data from the wheel zip, which should be the last two blockers for this capability.Progresses #6030.