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

(#34) Add support for Python 3.9 #37

Merged
merged 2 commits into from
Oct 8, 2020
Merged

(#34) Add support for Python 3.9 #37

merged 2 commits into from
Oct 8, 2020

Conversation

drewbanin
Copy link
Contributor

@drewbanin drewbanin commented Oct 8, 2020

Fixes #34

This PR updates Hologram's type inference code to be compatible with changes in Python 3.9. Previously, Optional types were treated as Union[_type_, None]. In Python 3.9, the Optional type is preserved directly. This PR replaces logic that checks for Union types with corresponding logic that checks for Optional types.

I smoke tested this locally, but would be great to run the dbt integration tests on Py39 while pointing to this hologram branch

@gshank
Copy link
Contributor

gshank commented Oct 8, 2020

This commit regresses the change in hologram/init.py to stop using 'best_match', which caused the test failures. This change should be undone:

-        error = next(iter(validator.iter_errors(data)), None)
+        error = jsonschema.exceptions.best_match(validator.iter_errors(data))

@drewbanin
Copy link
Contributor Author

ooh - thanks @gshank! I was confused about the test failure for sure. I did something silly when making this branch - thanks for the quick pointer :D

@gshank
Copy link
Contributor

gshank commented Oct 8, 2020

This looks good for hologram. I've opened issue #2822 to create tox.ini targets for dbt and test with it.

@drewbanin drewbanin merged commit ae61097 into master Oct 8, 2020
@drewbanin drewbanin deleted the fix/py39-compat branch October 8, 2020 19:00
@drewbanin
Copy link
Contributor Author

hey @Sherm4nLC - this error is caused by some changes in Python v3.9 (newly released). That error is in fact fixed by this PR! If you're hitting this snag still, you can try running dbt with Python v3.8. We'll have this code change live in the next release of dbt, which should get Python v3.9 working correctly

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.

Python 3.9 support
3 participants