Which project are you requesting an enhancement for?
kr8s
What do you need?
We use box to make accessing nested data structures more pleasant and pythonic.
Right now we just use the default box settings, which means any data structures that use camel case keys needs to be accessed via camel case attributes.
Unfortunately this operation in box is destructive and modifies the underlying data structure to store data in the snake case form. Which means when converting back to a dictionary you don't get the same structure that you put in.
>>> data.to_dict()
{'load_balancer': True}
Given that kr8s needs to be able to update data back to the Kubernetes API we can't be mangling the data structures like this.
It would be great if we could somehow support this snake case attribute access without modifying the data structure so that we can serialize data back out transparently.
Which project are you requesting an enhancement for?
kr8s
What do you need?
We use
box
to make accessing nested data structures more pleasant and pythonic.Right now we just use the default box settings, which means any data structures that use camel case keys needs to be accessed via camel case attributes.
Box supports a camel killer box to make keys like
loadBalancer
more pythonic by optionally converting them to snake case likeload_balancer
.You can access the
loadBalancer
key using either.loadBalancer
or.load_balancer
. Which is very pleasant.Unfortunately this operation in
box
is destructive and modifies the underlying data structure to store data in the snake case form. Which means when converting back to a dictionary you don't get the same structure that you put in.Given that
kr8s
needs to be able to update data back to the Kubernetes API we can't be mangling the data structures like this.It would be great if we could somehow support this snake case attribute access without modifying the data structure so that we can serialize data back out transparently.