betcode-org / betconnect

betconnect - API client
MIT License
7 stars 6 forks source link

Resolve pydantic deprecation warning #49

Closed mzaja closed 6 months ago

mzaja commented 1 year ago

When importing the package, the following warning is shown:

...venv\Lib\site-packages\pydantic\_internal\_config.py:261: UserWarning: Valid config keys have changed in V2:
* 'allow_population_by_field_name' has been renamed to 'populate_by_name'
* 'allow_mutation' has been removed
  warnings.warn(message, UserWarning)

The warnings originate from this file: https://github.com/betcode-org/betconnect/blob/master/betconnect/resources/baseresource.py.

The root cause is that package versions in requirements.txt are not fixed, so presumably pydantic 1.x was used initially but nowadays pydantic 2.x gets installed.

Please either:

  1. Set pydantic<2.0 in requirements.txt to prevent pydantic 2.x being installed by default.
  2. Update BaseResource.Config according to https://docs.pydantic.dev/latest/migration/, then set pydantic>=2.0 in requirements.txt.