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
Backward compatible renaming of "slave"-named objects in master-part #1943
Conversation
Comments regarding this way of doing backward-compatible renaming in "renaming" project are welcome. |
Current coverage is
|
I would go for a decorator on the old name I think the best is to warn from the config. If in the config we see that the user used deprecated names, then we warn. It means that the deprecated decorator will return a function which sets a __used_deprecated_interface attribute after instanciating the new class. Like I said in the other PR, its much easier for review if you look at the tests rather than the implementation. With tests we know clearly how the code is supposed to behave, and then we can more easily reason on it. Lets continue to discuss (and test) on this PR, and we will rebase the pycharm generated refactor later |
@djmitche I switched to
Code like above can be placed to Plus out of the box place of where warning was issued is registered, and warning should be issued only once (if so configured in @tardyp I wrote tests for wrapper functions: https://github.com/rutsky/buildbot/blob/worker_API_rename_POC2/master/buildbot/test/unit/test_worker_transition.py @tardyp I don't get it, how you suggest to use For creating aliases I suggest to use something like
instead of
to reduce number of places where "slave" string is used; plus, in most cases "worker"->"slave" rename can be done automatically and I implement it in |
The warnings change sounds great! Note that trial has some support for asserting that warnings were issued, if that helps in testing. |
Changes today:
|
Today's changes:
|
Today's changes:
Now master tests don't show bunch of |
This sounds great! Are there any particular questions you'd like me to
ponder? Anything else you need from me?
Dustin
|
@djmitche not now, yet. It's more like I'm reporting my progress here. I will prepare questions for the next meeting. There are bunch of them — I wrote them in the code as |
1e32d67
to
0737353
Compare
Rename "slavenames" attribute. Rename "slavenames" constructor keyword argument. Change getConfigDict() result.
…ument and in getConfigDict() result
Recent changes:
Only one "big" part is left: docs update. @djmitche, @tardyp, from this point review of this PR can be started.
Other review instructions (e.g. how to review fallback/compatibility for old names implementation) I will provide later. |
Further development will be done in |
This is not POC anymore, but WIP branch of renaming "slave"-named objects in master-part of Buildbot
This is same PR as I done in my repo (rutsky#1), but cherry-picked against current Buildbot master branch.
This is Proof-of-Concept of backward-compatible renaming of "slave"-named classes/methods/attributes to "worker" for the "renaming" project (Trac ticket, my application letter with details and related discussion).
This POC renames some interfaces/methods/attributes according to cases described below.
Some code uses renamed interfaces/methods and most code (in tests) uses old interface.
All tests are passing, and you can see a lot of
Use of obsolete name
warnings, so this approach looks promising.Some thought and notes about this POC code.
Following cases of old API usage that have
slave
in it should be considered:Warning can be issued if module (in
sys.modules
) will be replaced with wrapper class with overloaded__getattr__
— this is a terrible and not reliable hack. I don't think it's feasible to use it.No chance?
No chance?
https://github.com/rutsky/buildbot/pull/1/files#diff-fe204dcb39a98c86b49ad9abbce9921bR152
Easy, but not yet implemented.
https://github.com/rutsky/buildbot/pull/1/files#diff-c72eed05317a89a2f636d49f3f323341R333
https://github.com/rutsky/buildbot/pull/1/files#diff-5629977527acc490d9536a5a154865b1R144
https://github.com/rutsky/buildbot/pull/1/files#diff-c72eed05317a89a2f636d49f3f323341R132
Not considered yet. Looks like simplest approach to rename current, e.g.
buildbot.buildslave
tobuildbot.worker
and add dummy module (and all submodules)buildbot.buildslave
:Handled in attributes code. But when old API will be completely removed these cases may lead to problems.
I believe
renderables
can be not backward compatible renamed, since UI is changed completely.Keyword arguments may be handled like this:
Few more (TODO) notes:
Dustin suggested to take a look at Twisted utilities for deprecation warnings, or
warnings
Python module.pickle
, iterations over__dict__
, iterations over supported interfaces? This may create problems.Dustin said, that pickle-serialized stuff is dropped in nine.
Luckily there is no:
zope.interface.Attribute
.