Conversation
Fixes microsoft#448 Remove the `pendulum` dependency and replace it with equivalent BCL/abstractions methods. * **Add `parseTimeDeltaFromIsoFormat` function**: - Implement a static function `parseTimeDeltaFromIsoFormat` in `packages/abstractions/kiota_abstractions/utils.py` to parse ISO 8601 duration strings. - Add import for `re` module. * **Replace `pendulum` calls**: - Replace `pendulum.parse` calls with equivalent BCL/abstractions methods in `packages/serialization/form/kiota_serialization_form/form_parse_node.py`. - Replace `pendulum.parse` calls with equivalent BCL/abstractions methods in `packages/serialization/json/kiota_serialization_json/json_parse_node.py`. * **Remove `pendulum` dependency**: - Remove `pendulum` dependency from `packages/serialization/form/pyproject.toml`. - Remove `pendulum` dependency from `packages/serialization/json/pyproject.toml`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/kiota-python/issues/448?shareId=XXXX-XXXX-XXXX-XXXX).
|
To be totally clear, I'm not a python developer this is all copilot 😄 |
baywet
left a comment
There was a problem hiding this comment.
great first draft!
I think a couple of things are missing besides my comments:
- text package
- unit tests updates
This comment was marked as outdated.
This comment was marked as outdated.
|
Conflicts have been resolved. A maintainer will take a look shortly. |
|
@baywet is there a command to apply the wanted code formatting? I see it's failing at that. |
|
@svrooij should be something like |
|
@svrooij a few files were forgotten about:
|
|
@svrooij there are additional CI issues, would you mind having a look at it please? |
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
|
This is related to #453 being able to run the tests locally would greatly reduce the developer feedback flow. |
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
|
@svrooij there are still tests failing for form and json, would you mind having a look whenever you have some time please? |
|
The tests are failing because In particular, the tests specify but on older python, the fractional second part is only allowed to have either 3 or 6 digits, and we specify 7. An option would be, if we are on an older python and there is a fractional part (" |
|
thanks for chiming in @danieleds !! to achieve this, would you add a condition like this one in the code? |
|
@baywet would love to, but I don't think I have push permissions on this branch |
|
To be clear, I was only asking about how you'd do it, so @svrooij has all the elements. |
|
Oh I see. Yes, that's exactly what I had in mind. Something like, in form_parse_node.py and similar files: if sys.version_info[:3] <= (3,10):
fixed_time = re.sub(r'(\d[.,])(\d+)', lambda x: x.group(1) + x.group(2).ljust(6,'0')[:6], self._node)
return time.fromisoformat(fixed_time)
else:
return time.fromisoformat(self._node)(untested) |
Thanks @danieleds for your input. 8aaeff1#diff-8acdec4a0f6630bb416ac06117c85639c6656c1f65ef249c859dad74bc82c0ccR82-R98 |
|
@svrooij I did have a question: when I approve the CI and it fails, do you receive notifications on your end or not? I don't want to double down in case you're already receiving those :) |
|
@baywet I only get notifications from reactions (yours and sonarqube) |
|
@svrooij Thanks for confirming. That's what I suspected since I get the notifications when the CI fails. So I'll keep notifying you here if that works for you. And yes, the CI failed again :) |
|
Going to download a python 3.9 dev container and run the tests there. |
|
@svrooij looks like in the regex we also need to replace the " Also I realized my python version check was slightly wrong, I suggest using the following instead: |
|
something like this fixed_time = re.sub(r'(\d)([.,])(\d+)', lambda x: x.group(1) + "." + x.group(3).ljust(6,'0')[:6], self._node) |
|
@baywet It seems I do get the notification about failures inside github but not in my mail. Probably disabled that a long time ago. |
|
Still seeing issues with unit tests. Could it be that Z is not supported for date time parsing in older versions? |
ah ok! I'll stop posting here then to avoid spamming you |
|
@danieleds and strip of the |
|
@svrooij yes I think that's the issue. Instead of stripping the "Z", you may consider replacing it with "+00:00" so that we retain the timezone information |
|
|
It really helps that I'm now able to run all the tests locally in Python 3.9, only 1 error left and that is because an assertion tried to parse a datetime string with a z to compare And sorry for spamming. |
baywet
left a comment
There was a problem hiding this comment.
CI passes!! 🚀🚀🚀🚀
Thanks for the work here @svrooij and @danieleds !



Fixes #448
Remove the
pendulumdependency and replace it with equivalent BCL/abstractions methods.Add
parseTimeDeltaFromIsoFormatfunction:parseTimeDeltaFromIsoFormatinpackages/abstractions/kiota_abstractions/utils.pyto parse ISO 8601 duration strings.remodule.Replace
pendulumcalls:pendulum.parsecalls with equivalent BCL/abstractions methods inpackages/serialization/form/kiota_serialization_form/form_parse_node.py.pendulum.parsecalls with equivalent BCL/abstractions methods inpackages/serialization/json/kiota_serialization_json/json_parse_node.py.Remove
pendulumdependency:pendulumdependency frompackages/serialization/form/pyproject.toml.pendulumdependency frompackages/serialization/json/pyproject.toml.For more details, open the Copilot Workspace session.