traceloop / traceloop/openllmetry

๐Ÿ› Bug Report: `pydantic` warning: Support for class-based `config` is deprecated, use ConfigDict instead

Open
#2,959 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up โ€” it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.