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

update AnyClassMethod for change in python/typeshed#9771 #5505

Merged
merged 4 commits into from Apr 24, 2023

Conversation

ITProKyle
Copy link

@ITProKyle ITProKyle commented Apr 17, 2023

Change Summary

Updates the AnyClassMethod type variable to match recent changes to typeshed (python/typeshed#9771).

Related issue number

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

Selected Reviewer: @PrettyWood

@ITProKyle ITProKyle marked this pull request as ready for review April 17, 2023 19:38
@ITProKyle
Copy link
Author

please review

For some reason, checks arn't starting for this MR to ensure that the new version of mypy passes.

pydantic/typing.py Outdated Show resolved Hide resolved
@adriangb
Copy link
Member

Please rebase this onto our current main, you're 75 commits behind.

@ITProKyle
Copy link
Author

@adriangb - I rebased but it was only 1 commit behind the intended branch. This is a patch for the currently released, non-prepreelase version (1.10) so rebasing onto main would not result in the desired end state.

@@ -271,7 +271,8 @@ def is_union(tp: Optional[Type[Any]]) -> bool:
MappingIntStrAny = Mapping[IntStr, Any]
CallableGenerator = Generator[AnyCallable, None, None]
ReprArgs = Sequence[Tuple[Optional[str], Any]]
AnyClassMethod = classmethod[Any]
# classmethod[TargetType, CallableParamSpecType, CallableReturnType]
AnyClassMethod = classmethod[Any, Any, Any]
Copy link
Contributor

@dmontagu dmontagu Apr 18, 2023

Choose a reason for hiding this comment

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

Suggested change
AnyClassMethod = classmethod[Any, Any, Any]
MYPY = False
if not MYPY:
AnyClassMethod = classmethod[Any, Any, Any]
else:
AnyClassMethod = classmethod[Any]

I would suggest reverting the change to the mypy version (i.e., change it back to 0.971 in requirements-linting.txt) and making this change instead, which I think should result in the update to the definition used by pyright but not mypy.

I think this should keep everything else behaving the same (so we don't need to worry about breaking existing mypy functionality), but please confirm that this change would work for you with pyright.

As far as I'm currently aware it's not our intention to support mypy v1.2.0 with pydantic v1, given the various breaking changes (it will be supported in pydantic v2 though), so I wouldn't worry about updating the requirements-linting.txt.

Copy link
Author

@ITProKyle ITProKyle Apr 18, 2023

Choose a reason for hiding this comment

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

It didn't work on the pright side as provided but it did work with the condition swapped. It also worked locally with mypy==0.971.

@samuelcolvin
Copy link
Member

as per @dmontagu comments above, please update.

Copy link
Contributor

@dmontagu dmontagu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@yezz123 yezz123 left a comment

Choose a reason for hiding this comment

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

+1

@samuelcolvin samuelcolvin merged commit 5cfedf2 into pydantic:1.10.X-fixes Apr 24, 2023
49 checks passed
@samuelcolvin
Copy link
Member

thanks so much.

@ITProKyle ITProKyle deleted the fix/AnyClassMethod branch April 26, 2023 12:54
@ITProKyle
Copy link
Author

Any ETA on when we can expect to see this released?

@dmontagu
Copy link
Contributor

@ITProKyle this has just been released in v1.10.8, which should be available through PyPI shortly.

renovate bot added a commit to allenporter/flux-local that referenced this pull request May 25, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pydantic](https://togithub.com/pydantic/pydantic) | `==1.10.7` ->
`==1.10.8` |
[![age](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/compatibility-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/confidence-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pydantic/pydantic</summary>

###
[`v1.10.8`](https://togithub.com/pydantic/pydantic/releases/tag/v1.10.8):
2023-05-23

[Compare
Source](https://togithub.com/pydantic/pydantic/compare/v1.10.7...v1.10.8)

#### What's Changed

- Fix a bug in `Literal` usage with `typing-extension==4.6.0`,
[#&#8203;5826](https://togithub.com/pydantic/pydantic/issues/5826) by
[@&#8203;hramezani](https://togithub.com/hramezani)
- This solves the (closed) issue
[#&#8203;3849](https://togithub.com/pydantic/pydantic/issues/3849) where
aliased fields that use discriminated union fail to validate when the
data contains the non-aliased field name,
[#&#8203;5736](https://togithub.com/pydantic/pydantic/issues/5736) by
[@&#8203;benwah](https://togithub.com/benwah)
- Update email-validator dependency to >=2.0.0post2,
[#&#8203;5627](https://togithub.com/pydantic/pydantic/issues/5627) by
[@&#8203;adriangb](https://togithub.com/adriangb)
- update `AnyClassMethod` for changes in
[python/typeshed#&#8203;9771](https://togithub.com/python/typeshed/issues/9771),
[#&#8203;5505](https://togithub.com/pydantic/pydantic/issues/5505) by
[@&#8203;ITProKyle](https://togithub.com/ITProKyle)

#### New Contributors

-
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
made their first contribution in
[pydantic/pydantic#5375
- [@&#8203;ITProKyle](https://togithub.com/ITProKyle) made their first
contribution in
[pydantic/pydantic#5505
- [@&#8203;benwah](https://togithub.com/benwah) made their first
contribution in
[pydantic/pydantic#5736

**Full Changelog**:
pydantic/pydantic@v1.10.7...v1.10.8

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45OC40IiwidXBkYXRlZEluVmVyIjoiMzUuOTguNCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to allenporter/pyrainbird that referenced this pull request May 25, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pydantic](https://togithub.com/pydantic/pydantic) | `==1.10.7` ->
`==1.10.8` |
[![age](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/compatibility-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/pydantic/1.10.8/confidence-slim/1.10.7)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pydantic/pydantic</summary>

###
[`v1.10.8`](https://togithub.com/pydantic/pydantic/releases/tag/v1.10.8):
2023-05-23

[Compare
Source](https://togithub.com/pydantic/pydantic/compare/v1.10.7...v1.10.8)

##### What's Changed

- Fix a bug in `Literal` usage with `typing-extension==4.6.0`,
[#&#8203;5826](https://togithub.com/pydantic/pydantic/issues/5826) by
[@&#8203;hramezani](https://togithub.com/hramezani)
- This solves the (closed) issue
[#&#8203;3849](https://togithub.com/pydantic/pydantic/issues/3849) where
aliased fields that use discriminated union fail to validate when the
data contains the non-aliased field name,
[#&#8203;5736](https://togithub.com/pydantic/pydantic/issues/5736) by
[@&#8203;benwah](https://togithub.com/benwah)
- Update email-validator dependency to >=2.0.0post2,
[#&#8203;5627](https://togithub.com/pydantic/pydantic/issues/5627) by
[@&#8203;adriangb](https://togithub.com/adriangb)
- update `AnyClassMethod` for changes in
[python/typeshed#&#8203;9771](https://togithub.com/python/typeshed/issues/9771),
[#&#8203;5505](https://togithub.com/pydantic/pydantic/issues/5505) by
[@&#8203;ITProKyle](https://togithub.com/ITProKyle)

##### New Contributors

-
[@&#8203;DimitriPapadopoulos](https://togithub.com/DimitriPapadopoulos)
made their first contribution in
[pydantic/pydantic#5375
- [@&#8203;ITProKyle](https://togithub.com/ITProKyle) made their first
contribution in
[pydantic/pydantic#5505
- [@&#8203;benwah](https://togithub.com/benwah) made their first
contribution in
[pydantic/pydantic#5736

**Full Changelog**:
pydantic/pydantic@v1.10.7...v1.10.8

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/allenporter/pyrainbird).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45OC40IiwidXBkYXRlZEluVmVyIjoiMzUuOTguNCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@Kludex Kludex mentioned this pull request Aug 25, 2023
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants