traceloop / traceloop/openllmetry
๐ Bug Report: `pydantic` warning: Support for class-based `config` is deprecated, use ConfigDict instead
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.4k
- Forks
- 1.1k
- Avg merge
- 8d 14h
- Merged PRs (30d)
- 2
Description
Which component is this bug for?
Traceloop SDK
๐ Description
traceloop-sdk triggers a pydantic deprecation warning when importing some of its types (see below minimal example). This is because the code uses pydantics v1 config format (see migration guide):
class RegistryObjectBaseModel(BaseModel):
class Config:
arbitrary_types_allowed = True
(from packages/traceloop-sdk/traceloop/sdk/prompts/model.py)
๐ Reproduction steps
import warnings
warnings.simplefilter("always")
from traceloop.sdk.prompts.model import Prompt
def main():
print("Hello world!")
if __name__ == "__main__":
main()
๐ Expected behavior
The program should run without deprecation warnings.
๐ Actual Behavior with Screenshots
Running the application prints the following:
<path>/.venv/Lib/site-packages/pydantic/_internal/_config.py:323: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.11/migration/
warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
Hello world!
๐ค Python Version
3.12
๐ Provide any additional context for the Bug.
I presume the reason for the old configuration format is to still provide compatibility with pydantic v1. If that is the case, this warning could probably be solved in a similar fashion to the way fastapi does it:
class BaseModelWithConfig(BaseModel):
if PYDANTIC_V2:
model_config = {"extra": "allow"}
else:
class Config:
extra = "allow"
(from fastapi/openapi/models.py)
๐ Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up โ it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/traceloop-sdk/traceloop/sdk/prompts/model.py, especially RegistryObjectBaseModel and its configuration. Review the linked Pydantic migration guidance and reproduce the warning with the provided import example. Done means the supported configuration no longer emits the deprecation warning while preserving the intended arbitrary-types behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100