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

Fix broken Any and TypeVar behaviour #962

Merged
merged 4 commits into from Nov 7, 2019
Merged

Fix broken Any and TypeVar behaviour #962

merged 4 commits into from Nov 7, 2019

Conversation

@samuelcolvin
Copy link
Owner

samuelcolvin commented Nov 4, 2019

Change Summary

  • fix None value passed to Any fields
  • support TypeVar and thereby un-parameterized collection types, e.g. Dict rather than Dict[Any, Any]

Related issue number

fix #961

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)
@samuelcolvin samuelcolvin changed the title Fix broken Dict behaviour Fix broken Any and TypeVar behaviour Nov 6, 2019
samuelcolvin added 2 commits Nov 6, 2019
@codecov

This comment has been minimized.

Copy link

codecov bot commented Nov 6, 2019

Codecov Report

Merging #962 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff           @@
##           master   #962    +/-   ##
======================================
  Coverage     100%   100%            
======================================
  Files          17     17            
  Lines        3142   3385   +243     
  Branches      615    767   +152     
======================================
+ Hits         3142   3385   +243
Impacted Files Coverage Δ
pydantic/version.py 100% <100%> (ø) ⬆️
pydantic/validators.py 100% <100%> (ø) ⬆️
pydantic/fields.py 100% <100%> (ø) ⬆️
pydantic/schema.py 100% <100%> (ø) ⬆️
pydantic/env_settings.py 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0c18619...71ab229. Read the comment docs.

@samuelcolvin samuelcolvin marked this pull request as ready for review Nov 6, 2019
@samuelcolvin

This comment has been minimized.

Copy link
Owner Author

samuelcolvin commented Nov 6, 2019

@dmontagu please let me know what you think about this. I ended up supporting TypeVar to fix this.

I guess the documentation needs a new section on this.

@samuelcolvin

This comment has been minimized.

Copy link
Owner Author

samuelcolvin commented Nov 6, 2019

@dmontagu @tiangolo @koxudaxi

This and #969 should go out ASAP as fixes.

Do we want to do a new release from master v1.1 which would include the mypy plugin etc., or base this off the v1 tag and do a v1.0.1 release?

I think we might as well go straight to v1.1 but if anyone has a strong feeling about this, please let me know here.

@dmontagu

This comment has been minimized.

Copy link
Collaborator

dmontagu commented Nov 6, 2019

I think the support for TypeVar constraints/bounds is pretty awesome!

I'm in favor of releasing this as 1.1 with the mypy plugin. Considering the full backwards compatibility, I don't think there is a need to make a 1.0.1 release first. But either way is fine with me.

I would release the bug fixes prior to dropping non-plugin support for type-checking the pydantic.dataclasses.dataclass decorator though. I'm not sure how to consider changes to type checking behavior in the context of semver; I don't think it rises to the level of being considered a "breaking change", but presumably releasing a bugfix to the same minor version would be preferable if an update requires changes to get type checking to pass.

@samuelcolvin samuelcolvin merged commit 1d3f782 into master Nov 7, 2019
11 checks passed
11 checks passed
Header rules No header rules processed
Details
Pages changed 6 new files uploaded
Details
Redirect rules No redirect rules processed
Details
Mixed content No mixed content detected
Details
codecov/project 100% (+0%) compared to 0c18619
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
samuelcolvin.pydantic Build #20191107.3 succeeded
Details
samuelcolvin.pydantic (Job Python36) Job Python36 succeeded
Details
samuelcolvin.pydantic (Job Python37) Job Python37 succeeded
Details
@samuelcolvin samuelcolvin deleted the dict-behaviour branch Nov 7, 2019
RohitK89 added a commit to flatironhealth/fh-immuta-utils that referenced this pull request Nov 13, 2019
pydantic has resolved the bug that was breaking 1.0 (samuelcolvin/pydantic#962).
RohitK89 added a commit to flatironhealth/fh-immuta-utils that referenced this pull request Nov 14, 2019
Setting up Travis for testing builds. Will be setting up builds and releases in
a separate commit.

This change also unpins pydantic since the issue that existed in 1.0 has since
been resolved (samuelcolvin/pydantic#962).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.