Page MenuHomeSoftware Heritage

api: rename several API related classes
ClosedPublic

Authored by douardda on Jul 1 2019, 12:17 PM.

Details

Summary

to get rid of the SWH prefix and five more consistent names, especially
the swh.api.asynchonous.SWHRemoteAPI class which is very confusing.

Deprecate old class names using the Deprecate python module.

Also (second revision) update tests accordingly.

Diff Detail

Repository
rDCORE Foundations and core functionalities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont added inline comments.
swh/core/api/asynchronous.py
52

Can we please drop the SWH prefix?

I try to remove that bit by bit everywhere i can.
The module already specifies we are within the swh environment, so no need to be extra redundant.

swh/core/api/asynchronous.py
52

ok but then I need to drop it also in the sync version of the code...

Rename several API classes

The first git revision does the renamings in the code:

  • sync:
    • SWHServerAPIApp => RPCServerApp
    • MetaSWHRemoteAPI => MetaRPCClient
    • SWHRemoteAPI => RPCClient
  • async:
    • SWHRemoteAPI => RPCServerApp (!)

The second revision updates the tests accordingly

Tests pass OK before and after this second revision.

douardda retitled this revision from api/async: rename SWHRemoteAPI as SWHServerAPIApp to api: rename several API related classes.Jul 1 2019, 3:06 PM
douardda edited the summary of this revision. (Show Details)

I don't think we should add a dependency just for that. Raising a warning directly (like swh-storage already does) would work

I don't think we should add a dependency just for that. Raising a warning directly (like swh-storage already does) would work

I think we should have such a facility in swh.core and use it everywhere consistently. Using plain DeprecationWarning is a pain in the neck, does not encourage you to declare which version adds the deprecation, and so on. This goes towards a more declarative deprecation handling, which is better.

This revision is now accepted and ready to land.Jul 1 2019, 4:23 PM
douardda edited the summary of this revision. (Show Details)

typo in commit msg

This revision was automatically updated to reflect the committed changes.