Skip to content

Remove __root__ from BaseModel typing-only attrs#3540

Merged
samuelcolvin merged 2 commits intopydantic:masterfrom
layday:rm-__root__
Dec 19, 2021
Merged

Remove __root__ from BaseModel typing-only attrs#3540
samuelcolvin merged 2 commits intopydantic:masterfrom
layday:rm-__root__

Conversation

@layday
Copy link
Copy Markdown
Contributor

@layday layday commented Dec 19, 2021

Change Summary

__root__ is not a class variable nor is it always present.

The switch to ClassVar caused type errors to be reported in Pylance/Pyright.

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

`__root__` is not a class variable nor is it always present.

The switch to `ClassVar` caused type errors to be reported in Pylance/Pyright.
@layday
Copy link
Copy Markdown
Contributor Author

layday commented Dec 19, 2021

please review

@layday layday mentioned this pull request Dec 19, 2021
4 tasks
@samuelcolvin samuelcolvin merged commit da916f3 into pydantic:master Dec 19, 2021
@samuelcolvin
Copy link
Copy Markdown
Member

Thanks so much, looks like it was added back in the original implementation of __root__ #628 and I can't see how this would be breaking change

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.

3 participants