-
Notifications
You must be signed in to change notification settings - Fork 933
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
No migration path for Worksheet.update() #1360
Comments
Hi! Thanks for the issue :) As I understand your problem, you want to change your code before v6.0.0 releases so that it will work with the new version. Valiant! Before I get into the meat, I will tell you: you don't have to change anything. It is not very clear, as the warning says
but in v6 you can still use v5 signature def update(
self,
range_name, # required
values=None, # optional
**kwargs
): v6 signature def update(
self,
values: Iterable[Iterable[Any]], # required
range_name: Optional[str] = None, # optional
... In v5, In v6, ChangesThis issue being created tells me that the situation is unclear. We can solve it in a couple of ways
In fact, in #1336 I added code that swaps the arguments if they "seem" the wrong way round: Lines 1215 to 1222 in 7974168
Thus, another option is:
So, apologies for my waffle, but, in the end: you can continue without changing your code. We can either make the warning clearer (already done once... #1310) OR we can remove the warning (potentially dangerous if the above "catch" doesn't work in some edge cases). Finally, I am afraid whatever you do you cannot disable the warning message that p.s., |
p.p.s.,
neither do we that is why we removed it in v6.0.0 haha |
Ah, sorry I assumed |
yes, the 6.0.0 API looks great. The migration guide in the readme is confusing, it should be changed from - file.sheet1.update(["54"], "B2")
+ file.sheet1.update(range_name="I7", values=[["54"]]) to - file.sheet1.update("B2", ["54"])
+ file.sheet1.update([["54"]], range_name="B2")
+ file.sheet1.update(values=[["54"]], range_name="B2") |
But I don't think besides that I would bother changing the code that much. If I had started updating a few days later I would have landed on 6.0.0 and I don't think I would be seeing any of this, so I just got unlucky. |
Yes, agreed. With #1362 I have changed the readme to the following """ Change
|
Reasonable, yes. We started the v6.0.0 release a long time ago, and have made many v5 releases since then, so it has had to be on a different branch. |
@NickCrews thanks for your input! :)
|
I see make sense. I was expecting the model of branching I was familiar with: you cut off the |
That's how it was layed out when I joined :). Your thoughts interest me though. Do you mean something that looks like this? Where |
That's a very good point, and I thought about it recently with the comming 6.0.0 release. I wish to change our branching system to what is described here in the link above.
yes it is, that is one way to go and it works fine, only problem is: you make 2 PRs so one can pass on
you could but that requires some bot to do what we call the waterfall that when you make a PR it creates for you a second PR toward master and both must pass so the bot allows you to merge. that brings you more complexity with conflict though... I would go for the first one I think, we should discuss it and make proposals and ballance pros/cons I think. |
Yeah that is what I mean. We always targeted Even simpler, and avoids merge conflicts/forgetting to backport, but not always worth it, is to avoid branches altogether and keep things as runtime branches. Two different implementations present at the same time, but abstracted over so the transition is painless: # app.py
from .my_types import Self # my_types.py
try:
# python 3.11+
from typing import Self as Self
except ImportError:
# python <3.11
from typing_extensions import Self as Self This is another argument for very rapid releases: If you release a major version every month instead of every 6, then there aren't as many concurrent incompatible things you need to support at the same time, and the above becomes much more tenable, but users still have the granularity to pick up only a few breaking changes/features at a time. |
what does a user do if they want to make a PR to fix, say 5.12.3, but the 5.12.3 branch doesn't exist yet? I think all commits should be done to anyway I am interested in new branching system :) |
I think that would be you target the PR to the |
I just updated to the newest version and am now getting the DeprecationWarning added in #1209
Before I was using the API of
worksheet.update(data)
to update every cell. However, if I now tryworksheet.update(range_name=":", values=data)
, I getgspread.exceptions.APIError: {'code': 400, 'message': "Unable to parse range: 'Sheet1'!:", 'status': 'INVALID_ARGUMENT'}
.How do I migrate to maintain the past behavior? Before 6.0.0 is release can we make the API be
def format(self, values: list[list], *, range_name=...)
AKA
values
is required and can either be positional or kwarg, but the rest of the args are keyword only? If range_name is omitted, then it is assumed to be the entire worksheet?I can submit PRs if you want, though I will be slower than you will be as I don't quite understand your use of the
@accepted_kwargs
decorator.The text was updated successfully, but these errors were encountered: