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

Add support for complex pydantic models #208

Merged
merged 1 commit into from
Nov 17, 2020

Conversation

leiserfg
Copy link
Contributor

Fixes #207

Attention: @prkumar

@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #208 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #208   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files          44       44           
  Lines        2390     2399    +9     
  Branches      174      179    +5     
=======================================
+ Hits         2388     2397    +9     
  Misses          2        2           
Impacted Files Coverage Δ
uplink/converters/pydantic_.py 100.00% <100.00%> (ø)

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 73ea8ae...34fac7a. Read the comment docs.

@leiserfg
Copy link
Contributor Author

@prkumar do I need to change something to get this merged?

Copy link
Owner

@prkumar prkumar left a comment

Choose a reason for hiding this comment

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

@prkumar do I need to change something to get this merged?

The changes are causing tests to fail in py3.5 and py3.6: https://github.com/prkumar/uplink/pull/208/checks?check_run_id=1298280158. I mention some options of how we may address this in a separate comment:

To solve this, we can either do a try/catch around the code, or we can move this test into a separate file (e.g., test_converters_py37.py) and add some logic to have pytest skip that file when running against versions below 3.7: https://docs.pytest.org/en/latest/example/pythoncollection.html#customizing-test-collection

Other than that, these changes look good to me. However, I have a limited experience with using pydantic. Maybe @gmcrocetti may have some input, as the original contributor of uplink's Pydantic support in #200?

from typing import List

class ComplexModel(pydantic.BaseModel):
when: datetime = datetime.utcnow()
Copy link
Owner

Choose a reason for hiding this comment

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

These annotations are causing tests to fail with py3.5 and py3.6 due to SyntaxError: https://github.com/prkumar/uplink/pull/208/checks?check_run_id=1298280158

To solve this, we can either do a try/catch around the code, or we can move this test into a separate file (e.g., test_converters_py37.py) and add some logic to have pytest skip that file when running against versions below 3.7: https://docs.pytest.org/en/latest/example/pythoncollection.html#customizing-test-collection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the test to use comment's annotation so it does not fail on python3.5.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prkumar I need this please, I'm tied to the old version of uplink without it.

Copy link
Owner

Choose a reason for hiding this comment

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

@leiserfg - I plan to cut another release sometime this week. I'm working on merging #209 in as well

Copy link
Owner

Choose a reason for hiding this comment

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

@leiserfg - Changes were released yesterday with v0.9.3

@prkumar prkumar merged commit ee3c763 into prkumar:master Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pydantic encoding issues
2 participants