Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pydantic deprecation warnings #741

Closed
jku opened this issue Aug 29, 2023 · 4 comments · Fixed by #757
Closed

pydantic deprecation warnings #741

jku opened this issue Aug 29, 2023 · 4 comments · Fixed by #757
Assignees
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request

Comments

@jku
Copy link
Member

jku commented Aug 29, 2023

There are pydantic deprecation warnings now that pydantic 2.x is out when running the test suite, see e.g. logs in https://github.com/sigstore/sigstore-python/actions/runs/6004069422/job/16283850154

Related note: I'm also a little confused by the version requirements:

  • pyproject.toml sets pydantic >= 2,< 3
  • install/requirements.txt sets pydantic==1.10.6

what is going on here?

Specific deprecations

@validator is deprecated

Example

sigstore/_internal/fulcio/client.py:107: PydanticDeprecatedSince20: Pydantic V1 style `@validator` validators are deprecated. 
You should migrate to Pydantic V2 style `@field_validator` validators, see the migration guide for more details. 
Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.3/migration/

parse_obj is deprecated

Example

/home/runner/work/sigstore-python/sigstore-python/sigstore/transparency.py:161: PydanticDeprecatedSince20: The `parse_obj` method is deprecated; use `model_validate` instead. 
Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.3/migration/

parse_raw is deprecated

Example

/home/runner/work/sigstore-python/sigstore-python/test/unit/internal/fulcio/test_client.py:98: PydanticDeprecatedSince20: The `parse_raw` method is deprecated; if your data is JSON use `model_validate_json`, otherwise load the data then use `model_validate` instead. 
Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.3/migration/

load_str_bytes is deprecated

Example

/home/runner/work/sigstore-python/sigstore-python/env/lib/python3.11/site-packages/pydantic/main.py:999: PydanticDeprecatedSince20: load_str_bytes is deprecated. 
Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.3/migration/
@jku jku added the enhancement New feature or request label Aug 29, 2023
@woodruffw
Copy link
Member

pyproject.toml sets pydantic >= 2,< 3
install/requirements.txt sets pydantic==1.10.6

This is probably because of the release candidate: #705 bumped pydantic to the 2.x series and I made a release candidate for it, but the fully locked dependencies under install/ only track the latest stable version (which is the latest 1.x release).

I thought I squashed most of those deprecations with #705, but it looks like I missed a few. I can see about resolving those later today (unless you'd like to do it) 🙂

@jku
Copy link
Member Author

jku commented Aug 29, 2023

I can see about resolving those later today (unless you'd like to do it)

I can take a look tomorrow, no problem

@woodruffw woodruffw added the dependencies Pull requests that update a dependency file label Aug 29, 2023
@jku jku mentioned this issue Aug 30, 2023
@acascell
Copy link

Team, I am still seeing the following warning, would be worth to reopen this issue?

PydanticDeprecatedSince20: The `parse_obj` method is deprecated; use `model_validate` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.3/migration/
  warnings.warn('The `parse_obj` method is deprecated; use `model_validate` instead.', DeprecationWarning)

Here's the prject specifics:
pydantic 2.3.0 pydantic_core 2.6.3

@woodruffw
Copy link
Member

Team, I am still seeing the following warning, would be worth to reopen this issue?

Can you confirm that you're running a copy of sigstore-python from the latest main? The changes in this PR have not been included in a release yet, so if you're running a released version the deprecation warnings will still appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants