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

refactor: simplify Wheel API #231

Merged
merged 4 commits into from
Feb 19, 2024

Conversation

baszalmstra
Copy link
Contributor

@baszalmstra baszalmstra commented Feb 18, 2024

This PR is in preparation of introducing cached wheels that are not zips. The Wheel struct has a lot of responsibilities (installing, metadata, lazy metadata, vitals), I wanted to simplify it so that it represents just a zipped .whl file.

I changed the API by moving a lot of the functionality associated with wheels out of Wheel and into their own functions.

  • Unpacking (now called install_wheel) is no longer an associated function. I did this because in the future Ill change the API to also be able to install cached wheels. I also moved this to its own module. It seemed appropriate.
  • get_vitals(). This function was extracting data from a .whl that was used in different places. The metadata was used by the packagedatabase and some other fields where used during installing. Neither usecases required all data so I split it up and moved the extraction to where it was actually used. get_metadata is still part of Wheel.
  • lazy_read_metadata. This function had nothing to do with Wheel. I moved it to its own function.
  • I removed all code that become unused because of this.

Copy link
Contributor

@tdejager tdejager left a comment

Choose a reason for hiding this comment

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

Looks a little better! I'm a fan of keeping the struct methods to a minimum so this is great :)

@tdejager tdejager merged commit 3d3590a into prefix-dev:main Feb 19, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants