question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

client refactor: consider API changes

See original GitHub issue

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:

from tuf.client import updater
updater = updater.Updater() # that looks stupid and is a name clash

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

from tuf import client
updater = client.Updater()

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joshuaglcommented, Mar 18, 2021
  1. I’m 💯 for the namespace shortening.
  2. I do want us to think about the mirrors, it’s a popular topic #1307 and #1143.
  3. I like both of these suggestions, we also have https://github.com/theupdateframework/tuf/issues/1135 has some additional thoughts on client API
0reactions
jkucommented, Sep 1, 2021

I’m closing as individual ideas here now have issues of their own

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refactor a RESTful API Code Base to Support Multiple Versions
Do you really need a new version? The first consideration in refactoring an existing REST API to support multiple versions is whether the...
Read more >
How To Refactor A Public Interface… | by Fagner Brack
The first step is NOT refactoring. The API is from a public library, which means changing the interface introduces an incompatible breaking change....
Read more >
How do APIs evolve? A story of refactoring - Computer Science
A refactoring that changes the interface of an object must change all its clients to use the new interface. When a class library...
Read more >
Refactoring an entire API Ecosystem
If /v2/users existed and the GET was fine but the POST needed to change, they'd make a POST /v3/users and let everyone keep...
Read more >
The Role of Refactorings in API Evolution - Danny Dig
A refactoring that changes the interface of an object must change all its clients to use the new in- terface. When a class...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found