Skip to content
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

json/form/text - remove pendulum dependency #448

Closed
3 tasks
baywet opened this issue Jan 14, 2025 · 3 comments · Fixed by #450
Closed
3 tasks

json/form/text - remove pendulum dependency #448

baywet opened this issue Jan 14, 2025 · 3 comments · Fixed by #450
Labels
enhancement New feature or request help wanted Good candidate for a pull request priority:p1 High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7days type:enhancement Enhancement request targeting an existing experience WIP

Comments

@baywet
Copy link
Member

baywet commented Jan 14, 2025

related #348

Pendulum is a fairly heavy dependency (requires cargo at install???), which maintenance over time doesn't see guaranteed (author fatigue).

We have only 3 (non-test) files making references to this dependency, with a total of 12 references to parsing functions.
https://github.com/search?q=repo%3Amicrosoft%2Fkiota-python+pendulum+language%3APython+NOT+path%3A%2F%5Epackages%5C%2Fserialization%5C%2Fjson%5C%2Ftests%5C%2Funit%5C%2F%2F+NOT+path%3A%2F%5Epackages%5C%2Fserialization%5C%2Fform%5C%2Ftests%5C%2Funit%5C%2F%2F&type=code&l=Python

Except for time delta, all those parsing functions have equivalents in the main python BCL.

https://docs.python.org/3/library/datetime.html#datetime.datetime.fromisoformat
https://docs.python.org/3/library/datetime.html#datetime.time.fromisoformat
https://docs.python.org/3/library/datetime.html#datetime.date.fromisoformat

Here are the steps to take:

  • implement a static function parseTimeDeltaFromIsoFormat in abstractions use the duration ABNF from RFC 3339
  • replace all calls to pendulum by the equivalent BCL/abstractions methods
  • remove the dependency from the packages.
@baywet baywet added enhancement New feature or request help wanted Good candidate for a pull request priority:p1 High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7days type:enhancement Enhancement request targeting an existing experience labels Jan 14, 2025
@baywet baywet added this to Kiota Jan 14, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Jan 14, 2025
@baywet baywet mentioned this issue Jan 14, 2025
3 tasks
@baywet baywet moved this from Needs Triage 🔍 to New📃 in Kiota Jan 14, 2025
@svrooij
Copy link
Contributor

svrooij commented Jan 14, 2025

I was having this exact issue only minutes ago, then I found this exact issue. Really looking forward into trying this out.

Image

@baywet
Copy link
Member Author

baywet commented Jan 14, 2025

@svrooij Is this something you'd like to submit a pull request for provided some guidance?

@svrooij
Copy link
Contributor

svrooij commented Jan 14, 2025

@baywet I would, but I have no idea what I'm doing python wise 😄

Let's see what Github Copilot workspace has to say about this issue.

svrooij added a commit to svrooij/kiota-python that referenced this issue Jan 14, 2025
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).
@baywet baywet closed this as completed in 8a66dc4 Jan 17, 2025
@github-project-automation github-project-automation bot moved this from New📃 to Done ✔️ in Kiota Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Good candidate for a pull request priority:p1 High priority/Major issue but not blocking or Big percentage of customers affected.Bug SLA <=7days type:enhancement Enhancement request targeting an existing experience WIP
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants