Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove Python 3.8 Support#11258

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sydney-runkle merged 21 commits intomainfrom3.8-removal
Jan 15, 2025
Merged

Remove Python 3.8 Support#11258

sydney-runkle merged 21 commits intomainfrom3.8-removal
Jan 15, 2025

Conversation

sydney-runkle
Copy link
Contributor

@sydney-runklesydney-runkle commentedJan 10, 2025
edited
Loading

Includes#11257 changes (with temp bound onpydantic-extra-types).

Exciting diff here!

  • Remove documentation + packaging mentions of 3.8 as a minimum version
  • Remove use of special cases forzoneinfo imports
  • Remove pytest skips related to 3.8
  • Remove 3.8 specific workarounds
  • ImportLiteral,Annotated, etc fromtyping nottyping_extensions (docs examples, too)
  • Remove use of types liketyping.Dict,typing.List, etc
  • Fix an abundace of tests
  • Setruff target version to 3.9 to enforce fixes :)

Note: not touchingv1 files.

Best reviewed commit by commit, hiding whitespace. Would not recommend looking file by file.
I've commented on some of the more important / relevant changes below.

@cloudflare-workers-and-pagesCloudflare Workers and Pages
Copy link

cloudflare-workers-and-pagesbot commentedJan 10, 2025
edited
Loading

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit:e7b5413
Status: ✅  Deploy successful!
Preview URL:https://abce33e6.pydantic-docs.pages.dev
Branch Preview URL:https://3-8-removal.pydantic-docs.pages.dev

View logs

@github-actionsgithub-actionsbot added the relnotes-fixUsed for bugfixes. labelJan 10, 2025
@sydney-runklesydney-runkle added relnotes-changeUsed for changes to existing functionality which don't have a better categorization. and removed relnotes-fixUsed for bugfixes. labelsJan 10, 2025
@sydney-runklesydney-runkle marked this pull request as draftJanuary 10, 2025 19:02
@codspeed-hqCodSpeed HQ
Copy link

codspeed-hqbot commentedJan 10, 2025
edited
Loading

CodSpeed Performance Report

Merging#11258 willimprove performances by 16.74%

Comparing3.8-removal (e7b5413) withmain (7506b1c)

🎉 Hooray!pytest-codspeed just leveled up to 3.1.2!

A heads-up, this is abreaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit ourreleases page to delve into all the awesome details about this new version.

Summary

⚡ 15 improvements
✅ 30 untouched benchmarks

Benchmarks breakdown

Benchmarkmain3.8-removalChange
test_list_of_models_serialization58.4 µs53.4 µs+9.18%
test_complex_model_validation[__init__]54.8 µs49.4 µs+10.94%
test_complex_model_validation[model_validate]55.2 µs50.1 µs+10.17%
test_list_of_models_validation[__init__]94 µs82.1 µs+14.53%
test_list_of_models_validation[model_validate]92.3 µs79.1 µs+16.74%
test_nested_model_validation[__init__]57.1 µs51.7 µs+10.49%
test_nested_model_validation[model_validate]54.5 µs50.1 µs+8.88%
test_simple_model_validation[__init__]40.4 µs36.6 µs+10.31%
test_simple_model_validation[model_validate]40.7 µs38.4 µs+5.97%
test_north_star_dump_python18.3 ms16.8 ms+8.86%
test_north_star_json_loads21.8 ms19.5 ms+11.85%
test_north_star_validate_json54 ms49.1 ms+10.17%
test_north_star_validate_json_strict53.8 ms48.9 ms+10.03%
test_north_star_validate_python45.7 ms40.7 ms+12.33%
test_north_star_validate_python_strict35.3 ms31.1 ms+13.49%

Comment on lines -196 to +210
assert str(devtools.debug.format(obj)).split('\n')[1:] == [
' Obj(',
' int_attr=42,',
" str_attr='Marvin',",
' ) (Obj)',
]
if sys.version_info < (3, 11):
assert str(devtools.debug.format(obj)).split('\n')[1:] == [
' Obj(',
' int_attr=42,',
" str_attr='Marvin',",
' ) (Obj)',
]
else:
assert str(devtools.debug.format(obj)).split('\n')[1:] == [
' obj: Obj(',
' int_attr=42,',
" str_attr='Marvin',",
' ) (Obj)',
]
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This change is just related to a version bump inuv.lock. The only one of its kind in this PR.

@@ -1466,9 +1466,6 @@ class InnerModel(OuterModelA[K, V], OuterModelB[T], Generic[K, V, T]):
}


# TODO: SYDNEY - determine changes to make here (next 4 tests with 3.9 notes)


def test_generic_with_referenced_generic_type_1():
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@Viicos, I don't think I fully understand the changes you want made to these functions, perhaps you could help me out on this part? Thanks!

@github-actionsGitHub Actions
Copy link
Contributor

github-actionsbot commentedJan 10, 2025
edited
Loading

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic
  dataclasses.py
  fields.py
  functional_serializers.py
  json_schema.py
  main.py
  mypy.py
  networks.py
  type_adapter.py
  types.py
  pydantic/_internal
  _core_utils.py
  _decorators.py
  _decorators_v1.py
  _discriminated_union.py
  _fields.py
  _generate_schema.py
  _generics.py
  _known_annotated_metadata.py
  _mock_val_ser.py
  _model_construction.py
  _schema_generation_shared.py
  _typing_extra.py
  _validators.py
  pydantic/experimental
  pipeline.py
  pydantic/plugin
  __init__.py
  _loader.py
Project Total 

The report is truncated to 25 files out of 36. To see the full report, please visit the workflow summary page.

This report was generated bypython-coverage-comment-action

@sydney-runklesydney-runkle changed the titleDraft: Removing Python 3.8 SupportRemoving Python 3.8 SupportJan 11, 2025
@sydney-runkle
Copy link
ContributorAuthor

I'm guessing test failures are related to:

PEP 585 generic aliases don't convert args to ForwardRefs, unliketyping.List/Dict etc.

Looking into this now.

@sydney-runklesydney-runkle changed the titleRemoving Python 3.8 SupportRemove Python 3.8 SupportJan 14, 2025
@sydney-runklesydney-runkle marked this pull request as ready for reviewJanuary 14, 2025 09:34
@sydney-runklesydney-runkle added the third-party-testsAdd this label on a PR to trigger 3rd party tests labelJan 14, 2025
Copy link
Member

@ViicosViicos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just checking: do we have a single test testing fortyping.Dict/List/etc? So that we gather this as a single test, and then safely use the builtins in other tests (and we are still assured that the old constructs are supported).

@sydney-runkle
Copy link
ContributorAuthor

Just checking: do we have a single test testing for typing.Dict/List/etc? So that we gather this as a single test, and then safely use the builtins in other tests (and we are still assured that the old constructs are supported).

No, we should probably do this. How detailed do you think we need to be here? Ex - parametrization with forwardrefs, etc...

@sydney-runkle
Copy link
ContributorAuthor

Just checking: do we have a single test testing for typing.Dict/List/etc? So that we gather this as a single test, and then safely use the builtins in other tests (and we are still assured that the old constructs are supported).

Done via tests/test_types.py:test_pep585_generic_types

@sydney-runklesydney-runkle merged commitc371bd1 intomainJan 15, 2025
79 checks passed
@sydney-runklesydney-runkle deleted the 3.8-removal branchJanuary 15, 2025 15:24
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ViicosViicosViicos approved these changes

Assignees
No one assigned
Labels
relnotes-changeUsed for changes to existing functionality which don't have a better categorization.third-party-testsAdd this label on a PR to trigger 3rd party tests
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@sydney-runkle@Viicos

[8]ページ先頭

©2009-2025 Movatter.jp