Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1923 +/- ##
==========================================
- Coverage 74.46% 74.45% -0.02%
==========================================
Files 82 82
Lines 9098 9102 +4
Branches 1853 1855 +2
==========================================
+ Hits 6775 6777 +2
Misses 2020 2020
- Partials 303 305 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
eaa9c3e to
682af0f
Compare
eca7aaa to
5a213dc
Compare
c0f7b24 to
cfbbf99
Compare
5a213dc to
135fd7b
Compare
| dtype: dict[str, Any] | str | None = ..., | ||
| ) -> pd.DataFrame: ... | ||
|
|
||
| @overload |
There was a problem hiding this comment.
The cost of overloaded signatures allows us to infer the return type based on the chunk_size type, yeah? I'm somewhat ambivalent about this as I find overload types a little confusing, but I presume this has been useful to you when writing scripts etc?
| import csv | ||
| import os | ||
| from typing import Iterable, Sequence | ||
| from typing import Any, Iterable, Iterator, Sequence, overload |
There was a problem hiding this comment.
I considered adding types for read_csv_with_index_col() but decided against it, as it relies on fragile imports from pandas._typing.¹
I don't really know the state of python typing, how does this tend to work for non-core libraries? The TS community has been really proactive about publishing separate type libraries for most common JS-only packages, although ensuring the versions are in-sync has been a little painful. Pandas clearly has some types (pd.DataFrame), do they hide FilePath, ReadCsvBuffer etc away because the types aren't stable?
There was a problem hiding this comment.
pandas-stubs is basically the same thing (separate type library) and it's official, so sync is not much of an issue.
There was a problem hiding this comment.
I'm not sure why pandas._typing is hidden away, but it's explicitly noted in docs.
pandas.api.typing should be stable. v3 includes FilePath and ReadCsvBuffer, but we still target compatibility with v1.
135fd7b to
57c36c4
Compare
This is cleaner and prevents false-positive 'call-overload' Mypy errors.
For type checking. I considered adding types for read_csv_with_index_col() but decided against it, as it relies on fragile imports from pandas._typing.¹ ¹ https://github.com/pandas-dev/pandas-stubs/blob/64e978cbce28de05ff38105c169387283b6c95c2/pandas-stubs/io/parsers/readers.pyi#L39
cfbbf99 to
9312413
Compare
Description of proposed changes
For type checking.
I considered adding types for read_csv_with_index_col() but decided against it, as it relies on fragile imports from pandas._typing.¹
¹ https://github.com/pandas-dev/pandas-stubs/blob/64e978cbce28de05ff38105c169387283b6c95c2/pandas-stubs/io/parsers/readers.pyi#L39
Related issue(s)
Follow-up to #1917 (review)
Checklist