Skip to content

TYPING: add some type hints to core.generic #27646

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

Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
05dcd23
TYPING: add some type hints to core.generic
simonjayhawkins Jul 29, 2019
3dfecd1
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Jul 29, 2019
a207010
black
simonjayhawkins Jul 29, 2019
978029e
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Jul 31, 2019
3ba8c76
move typing_extensions to _typing.py
simonjayhawkins Jul 31, 2019
9aa69fe
add whatsnew
simonjayhawkins Jul 31, 2019
4346a6b
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 3, 2019
8fb0254
use Literal for Axis Alias
simonjayhawkins Aug 3, 2019
3b04221
return type Type[FrameOrSeries] for _constructor
simonjayhawkins Aug 3, 2019
ec609ee
resolve merge conflict
simonjayhawkins Aug 5, 2019
2f35f26
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 5, 2019
ac31e7d
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 6, 2019
7c4e87a
remove typing_extensions
simonjayhawkins Aug 6, 2019
f56794d
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 8, 2019
0ce386e
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 24, 2019
b8195b9
resolve merge conflicts
simonjayhawkins Aug 27, 2019
3690f0b
remove extra line
simonjayhawkins Aug 27, 2019
416c461
resolve merge conflict
simonjayhawkins Aug 28, 2019
aa71327
import FrameOrSeries and _T from _typing
simonjayhawkins Aug 28, 2019
6397422
lint error - unused import
simonjayhawkins Aug 28, 2019
b8866d6
revert changes to runtime behaviour
simonjayhawkins Aug 29, 2019
90833db
Merge remote-tracking branch 'upstream/master' into type-hints-core.g…
simonjayhawkins Aug 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,45 @@ Backwards incompatible API changes
- :class:`pandas.core.groupby.GroupBy.transform` now raises on invalid operation names (:issue:`27489`).
-

.. _whatsnew_1000.api_breaking.deps:

Increased minimum versions for dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Supporting Python 3.6, we are not able to take advantage of new types added to the typing module. The typing_extensions module
contains both backports of these changes as well as experimental types that will eventually be added to the typing module.

If installed, we now require:

+-------------------------+-----------------+----------+
| Package | Minimum Version | Required |
+=========================+=================+==========+
| | | |
+-------------------------+-----------------+----------+
| | | |
+-------------------------+-----------------+----------+
| typing_extensions (dev) | | |
+-------------------------+-----------------+----------+

For `optional libraries <https://dev.pandas.io/install.html#dependencies>`_ the general recommendation is to use the latest version.
The following table lists the lowest version per library that is currently being tested throughout the development of pandas.
Optional libraries below the lowest tested version may still work, but are not considered supported.

+-----------------+-----------------+
| Package | Minimum Version |
+=================+=================+
| | |
+-----------------+-----------------+
| | |
+-----------------+-----------------+
| | |
+-----------------+-----------------+
| | |
+-----------------+-----------------+

See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.


Other API changes
^^^^^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies:
- isort # check that imports are in the right order
- mypy
- pycodestyle # used by flake8
- typing_extensions
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a note in 1.0 docs (may have to add a new section on dependencies like we did in 0.25) and list this


# documentation
- gitpython # obtain contributors from git for whatsnew
Expand Down
8 changes: 8 additions & 0 deletions pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
from pandas.core.frame import DataFrame # noqa: F401
from pandas.core.series import Series # noqa: F401
from pandas.core.sparse.series import SparseSeries # noqa: F401
from typing_extensions import Literal

IgnoreRaise = Literal["ignore", "raise"]
FirstLast = Literal["first", "last"]
else:
IgnoreRaise = str
FirstLast = str


AnyArrayLike = TypeVar(
Expand All @@ -28,3 +35,4 @@
Scalar = Union[str, int, float]
Axis = Union[str, int]
Ordered = Optional[bool]
Level = Union[str, int]
Loading