Skip to content

__deserialize_date return type dependent on runtime environment #1081

@juliantaylor

Description

@juliantaylor

the __deserialize_date function behaves differently depending on which dependencies you have installed at runtime.
https://github.com/kubernetes-client/python/blob/master/kubernetes/client/api_client.py#L585

if dateutils is installed you get datetime objects for dates and if not you get strings.

This is very bad behaviour for a library as code will break depending on which other packages are currently installed.
The function should be changed to always return a single type regardless of current runtime environment.
One way to do that would be to make the dependency mandatory and throw an import error on library load or to remove the dependency by parsing the string with stdlib methods.

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions