Closed impredicative closed 10 months ago
Hi @impredicative this is not a bug, it's expected since you're using the python built-in function dir()
which is returning a list of all valid attributes in an object.
Since snapshot
is an instance of a sub-class of a pydantic BaseModel
it inherits all the attributes of a standard BaseModel
, including the ones you listed. There's no code on alpaca-py to add any of those fields, and this is just related to the fact that we use pydantic for data validation.
I'm not sure what's your use case, but if you don't want to see those attributes, you simply don't need to use the dir()
function.
The representation of the snapshot object won't include them, and they're not included in the model_fields
as well.
An IDE such as PyCharm visibly and graphically shows the distracting model attributes, which is why I opened this issue. I do not use dir
for development purposes.
Is there an existing issue for this?
Current Behavior
When I get a snapshot using v0.12.0, there are noisy and unnecessary
model_*
attributes all over the place. This was not an issue with v0.10.0.They can be listed by seeing:
This applies recursively to all pydantic objects.
Expected Behavior
These internal model attributes should ideally be hidden via a leading underscore if they need to exist at all.
SDK Version I encountered this issue in
0.12.0
Steps To Reproduce
Filled out the Steps to Reproduce section?
Anything else?
No response