-
Notifications
You must be signed in to change notification settings - Fork 275
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
client refactor: consider API changes #1317
Comments
|
I'm not sure if we should design for not-yet-accepted TAPs (we probably shouldn't), but there might be a way to combine the mirrors functionality with the client configuration in TAP 13 (#1103) and possibly also TAP 4 into a more general 'configurations' API, where the client could set these options before using |
Another thing I've not mentioned: currently it's not possible to download without writing to a file. Usually that's fine but the pip index files might be a use case that would benefit from doing that: the code currently opens and read()s the file immediately after download succeeds... |
So number 1 is handled in #1397 in coming days, item 2 was solved by not supporting mirrors. I have some more specific ideas about item 3:
Non-caching updater could look like class Updater:
def __init__(...)
def refresh()
def find_target_file(name:str ) -> TargetFile
# here caller can use TargetFile.verify_length_and_hashes(file_obj) if they want to check a local file
def download_target(target: TargetFile, local_path: str) The CachingUpdater would add: def is_target_cached(target: TargetFile) -> bool
def download_target(target: TargetFile) -> str Note that this assumes TargetFile actually included the target name. If it does not then several methods here still need another argument -- but I think we should consider if TargetFile (and possibly MetaFile) should actually include the name None of this needs to happen before merging to develop: they should not lead to major code movements or rewrites |
Fixed by #1408 wherein the new client implementation we drop mirrors support.
Fixed by #1514
What are Besides the last point, I mentioned above, am I correct that as TODO items required to solve this issue are: |
pages like this https://pypi.org/simple/sampleproject/. In TUF terminology this html is a target file.
Yeah, a new issue would be fine: this meta-issue could then be closed as all items are in actual issues. This might make sense for two reasons:
The first one of those is an internal detail of the Updater so not an API change at all. |
I'm closing as individual ideas here now have issues of their own |
We should consider if we want to additions/changes to the API -- this would be a good time for them.
Possibilities:
1. Namespace shortening: currently using the client looks like this:
This is a small thing maybe but having both client and updater module does not seem useful: I think we could just as well have
This should be possible by having a
client/__init__.py
that exports Updater (and FetcherInterface).2. Mirrors: this is arguably the most complex part of the client API, probably mostly unused and is kind of hidden: I wonder if we can/should make it better? pip does need the mirrors config but even that use is not what mirrors config was designed for: pip potentially changes the config before every single new target download, switching the mirror list based on whether it's downloading index files or distribution files...
#1307, #1143
3. the actual updater API do we want to improve the get_one_valid_targetinfo + updated_targets + download_target call sequence in any way?
* Possibly provide a helper that does the obvious thing (given a target name, just make sure it is downloaded)
* should the actual local paths be returned? It feels odd that client has to build the paths when updater already had them
The text was updated successfully, but these errors were encountered: