model: Add new classes to improve interface typing
I started working on Release a Bulk On-demand Archival feature roadmap item and got my head back into swh-scheduler
code to analyze how the feature could be implemented.
I noticed that many methods from the scheduler interface were missing typing information which makes the code hard to read.
So I took some time to add these missing typing info.
As I did not want to break other SWH packages using the related scheduler API (deposit, vault, web), I decided to
use TypedDict
classes instead of attr.s
ones. The migration from TypedDict
to attr.s
can still be done later.
As with other scheduler models, the newly introduced ones are based on the use of the attr
package.
It introduces some breaking API changes as methods modified in interface now return objects instead of dicts
so all SWH packages client of these methods should also be updated, this has been done in the following MRs:
- backend: Port code to updated swh-scheduler API swh-vault!203 (merged)
- launchpad, npm: Port code to updated swh-scheduler API swh-lister!526 (merged)
- pytest_plugin: Port code to updated swh-scheduler API swh-loader-core!524 (merged)
- api, tests: Port code to update swh-scheduler API swh-deposit!432 (merged)
- conftest, save_*: Port code to updated swh-scheduler API swh-web!1282 (merged)
The docker tests have also been executed with all the changes above by pushing docker!23 (closed) and they still pass.
Related to #2977 (closed).