-
-
Notifications
You must be signed in to change notification settings - Fork 310
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: add List, Dict, Tuple and NamedTuple to the GenericDType bound #1556
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Sam Goodwin <[email protected]>
pandera/typing/common.py
Outdated
List[Any], | ||
Dict[Any, Any], | ||
Tuple[Any], | ||
NamedTuple, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, I can't make the type parameters more precise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cosmicBboy I think this change is ready to go, LMK if you see any issue with leaving these types wide.
Outstanding question is whether NamedTuple
belongs there though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you spot-check this with mypy?
NamedTuple should be fine here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think I've patched the MyPy problems:
> pre-commit run mypy --all-files
mypy.....................................................................Passed
- hook id: mypy
- duration: 2.27s
Success: no issues found in 180 source files
Signed-off-by: Sam Goodwin <[email protected]>
Signed-off-by: Sam Goodwin <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1556 +/- ##
===========================================
- Coverage 94.29% 83.07% -11.22%
===========================================
Files 91 111 +20
Lines 7024 8191 +1167
===========================================
+ Hits 6623 6805 +182
- Misses 401 1386 +985 ☔ View full report in Codecov by Sentry. |
Thanks @sam-goodwin, see https://pandera.readthedocs.io/en/latest/CONTRIBUTING.html#set-up-pre-commit for steps to make sure linters and unit tests are passing. You'll also need to sign your commits: https://pandera.readthedocs.io/en/latest/CONTRIBUTING.html#dco-signing-commits |
Signed-off-by: Sam Goodwin <[email protected]>
Signed-off-by: Sam Goodwin <[email protected]>
Mypy errors:
Note that pandera needs to support python 3.8 as well, so we need to use the generic types in the typing module. Failing unit test:
Looks like you need to use the built-in |
Do you mean we can't specify ints with specific precision in a List or Dict in pandera? |
Signed-off-by: Sam Goodwin <[email protected]>
This just follows the way pandas deals with data. Columns containing In summary, |
@sam-goodwin friendly ping: one of the unit tests is still failing: https://github.com/unionai-oss/pandera/actions/runs/8861081819/job/24332580434?pr=1556 |
Closes #1555