Open mkoeppe opened 4 years ago
Description changed:
---
+++
@@ -1,5 +1,5 @@
-- types
+- types (#29775)
- native namespace packages - #28925
- ...?
About types, has a general policy been discussed on sage-devel?
typing
is a standard Python 3 module, and it allows one to catch more errors.. Why would one have anything against it?
typing
is a standard Python 3 module, and it allows one to catch more errors.. Why would one have anything against it?
Are there reasons (e.g. performance) not to use it in certain circumstances?
I created this ticket as a place for discussions of these new features to make sure that we use them systematically in the Sage library, rather than in an ad-hoc way.
For example, for typing, I think there are opportunities to integrate it with the various dynamically generated classes that come in from the category system, as I noted in #29775.
There shouldn't be any performance issues with typing as it is deactivated on runtime (the only additional overhead is the import of the typing
package).
See also the discussion here https://realpython.com/python-type-checking/#pros-and-cons
Description changed:
---
+++
@@ -1,5 +1,6 @@
- types (#29775)
- native namespace packages - #28925
+- `yield from` - #29857
- ...?
Description changed:
---
+++
@@ -2,5 +2,6 @@
- types (#29775)
- native namespace packages - #28925
- `yield from` - #29857
+- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
- ...?
Description changed:
---
+++
@@ -3,5 +3,6 @@
- native namespace packages - #28925
- `yield from` - #29857
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
-- ...?
+- f-strings (formatted strings)
+ - ...?
Description changed:
---
+++
@@ -4,5 +4,8 @@
- `yield from` - #29857
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
- f-strings (formatted strings)
- - ...?
+- ...?
+See also:
+
+- #29728: Meta-ticket: improve compatibility with the Python library
Description changed:
---
+++
@@ -4,6 +4,7 @@
- `yield from` - #29857
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
- f-strings (formatted strings)
+- keyword-only parameters (#16607)
- ...?
See also:
Description changed:
---
+++
@@ -5,6 +5,7 @@
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
- f-strings (formatted strings)
- keyword-only parameters (#16607)
+- new import machinery - #27074 (Make `.sage` modules importable)
- ...?
See also:
Description changed:
---
+++
@@ -6,6 +6,7 @@
- f-strings (formatted strings)
- keyword-only parameters (#16607)
- new import machinery - #27074 (Make `.sage` modules importable)
+- `__matmul__` (infix `@` operator) - #22760
- ...?
See also:
Description changed:
---
+++
@@ -7,6 +7,7 @@
- keyword-only parameters (#16607)
- new import machinery - #27074 (Make `.sage` modules importable)
- `__matmul__` (infix `@` operator) - #22760
+- `from ..a import b`
- ...?
See also:
Description changed:
---
+++
@@ -1,5 +1,5 @@
-- types (#29775)
+- types (#29775, #30381)
- native namespace packages - #28925
- `yield from` - #29857
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
Description changed:
---
+++
@@ -13,3 +13,5 @@
See also:
- #29728: Meta-ticket: improve compatibility with the Python library
+- #30384: Adopt the “time window-based” policy for support of Python versions from NEP 29
+
Replying to @egourgoulhon:
About types, has a general policy been discussed on sage-devel?
+1 for using typing. Return types in particular are useful for tab-completion on the result of function calls. For example
sage: "hello".upper().lower().upper()
this tab-completes without evaluating the code (i.e. without setting IPython's IPCompleter.greedy
config option).
Description changed:
---
+++
@@ -1,5 +1,7 @@
-- types (#29775, #30381)
+- static typing (#29775, #30381)
+ - #30381 Python 3 typing/protocols/ABCs
+ - #30511 Type hints (`__annotations__`) and coercion/categories/Cython
- native namespace packages - #28925
- `yield from` - #29857
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
Description changed:
---
+++
@@ -1,7 +1,8 @@
-- static typing (#29775, #30381)
+- static typing
+ - #29775 Add a bit of typing to manifold code
- #30381 Python 3 typing/protocols/ABCs
- - #30511 Type hints (`__annotations__`) and coercion/categories/Cython
+ - #30511 Type hints (`__annotations__`) and coercion/Cython
- native namespace packages - #28925
- `yield from` - #29857
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
Description changed:
---
+++
@@ -1,3 +1,4 @@
+Python 3.6 features
- static typing
- #29775 Add a bit of typing to manifold code
@@ -5,7 +6,6 @@
- #30511 Type hints (`__annotations__`) and coercion/Cython
- native namespace packages - #28925
- `yield from` - #29857
-- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
- f-strings (formatted strings)
- keyword-only parameters (#16607)
- new import machinery - #27074 (Make `.sage` modules importable)
@@ -13,8 +13,14 @@
- `from ..a import b`
- ...?
+Python 3.7+ features
+
+- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
+
+
See also:
- #29728: Meta-ticket: improve compatibility with the Python library
- #30384: Adopt the “time window-based” policy for support of Python versions from NEP 29
+- #30551 Drop Python 3.6 support
Description changed:
---
+++
@@ -17,6 +17,9 @@
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
+Python 3.8+ features:
+
+- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
See also:
Description changed:
---
+++
@@ -17,6 +17,8 @@
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
+- `from `__future__` import annotations` (#31006)
+
Python 3.8+ features:
- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
Description changed:
---
+++
@@ -15,7 +15,7 @@
Python 3.7+ features
-- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (requires python 3.7 or backport `importlib_resources` if we want to support 3.6 - but that does not support resources within namespace packages)
+- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (#31306)
- `from `__future__` import annotations` (#31006)
Description changed:
---
+++
@@ -1,5 +1,6 @@
Python 3.6 features
+- [https://docs.python.org/3/library/pathlib.html pathlib](https://docs.python.org/3/library/pathlib.html pathlib)
- static typing
- #29775 Add a bit of typing to manifold code
- #30381 Python 3 typing/protocols/ABCs
Description changed:
---
+++
@@ -1,6 +1,6 @@
Python 3.6 features
-- [https://docs.python.org/3/library/pathlib.html pathlib](https://docs.python.org/3/library/pathlib.html pathlib)
+- [pathlib](https://docs.python.org/3/library/pathlib.html)
- static typing
- #29775 Add a bit of typing to manifold code
- #30381 Python 3 typing/protocols/ABCs
Description changed:
---
+++
@@ -8,7 +8,7 @@
- native namespace packages - #28925
- `yield from` - #29857
- f-strings (formatted strings)
-- keyword-only parameters (#16607)
+- keyword-only parameters (#16607, #31309)
- new import machinery - #27074 (Make `.sage` modules importable)
- `__matmul__` (infix `@` operator) - #22760
- `from ..a import b`
Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.
Description changed:
---
+++
@@ -1,4 +1,4 @@
-Python 3.6 features
+Python 3.6 features (https://docs.python.org/3.10/whatsnew/3.6.html):
- [pathlib](https://docs.python.org/3/library/pathlib.html)
- static typing
@@ -14,15 +14,19 @@
- `from ..a import b`
- ...?
-Python 3.7+ features
+Python 3.7 features (https://docs.python.org/3.10/whatsnew/3.7.html):
- [importlib.resources](https://docs.python.org/3/library/importlib.html#module-importlib.resources) (#31306)
- `from `__future__` import annotations` (#31006)
-Python 3.8+ features:
+Python 3.8 features (https://docs.python.org/3.10/whatsnew/3.8.html):
- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
+
+Python 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html):
+
+Python 3.10 features (https://docs.python.org/3.10/whatsnew/3.10.html):
See also:
Description changed:
---
+++
@@ -20,6 +20,8 @@
- `from `__future__` import annotations` (#31006)
+- https://docs.python.org/3/library/dataclasses.html
+
Python 3.8 features (https://docs.python.org/3.10/whatsnew/3.8.html):
- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
Description changed:
---
+++
@@ -1,3 +1,6 @@
+**For Sage 9.4, all of the following features can be used:**
+
+
Python 3.6 features (https://docs.python.org/3.10/whatsnew/3.6.html):
- [pathlib](https://docs.python.org/3/library/pathlib.html)
@@ -22,9 +25,14 @@
- https://docs.python.org/3/library/dataclasses.html
+
+**Using features introduced in Python 3.8 or later cannot be used in Sage yet because we support system Python 3.7.x.**
+
Python 3.8 features (https://docs.python.org/3.10/whatsnew/3.8.html):
- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
+- `f'{expr=}'` https://docs.python.org/3.10/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging
+- PEP 590: Vectorcall: a fast calling protocol for CPython https://docs.python.org/3.10/whatsnew/3.8.html#pep-590-vectorcall-a-fast-calling-protocol-for-cpython
Python 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html):
Description changed:
---
+++
@@ -33,6 +33,10 @@
- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
- `f'{expr=}'` https://docs.python.org/3.10/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging
- PEP 590: Vectorcall: a fast calling protocol for CPython https://docs.python.org/3.10/whatsnew/3.8.html#pep-590-vectorcall-a-fast-calling-protocol-for-cpython
+- `functools.cached_property()` https://docs.python.org/3.10/whatsnew/3.8.html#functools
+- `pprint(sort_dicts=False)`
+- `shutil.copytree(dirs_exist_ok=True)`
+
Python 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html):
Description changed:
---
+++
@@ -5,6 +5,8 @@
- [pathlib](https://docs.python.org/3/library/pathlib.html)
- static typing
+ - #32058 add typing annotations in permutations
+ - #32067 Developer manual: Section on typing annotations
- #29775 Add a bit of typing to manifold code
- #30381 Python 3 typing/protocols/ABCs
- #30511 Type hints (`__annotations__`) and coercion/Cython
Description changed:
---
+++
@@ -28,16 +28,21 @@
- https://docs.python.org/3/library/dataclasses.html
-**Using features introduced in Python 3.8 or later cannot be used in Sage yet because we support system Python 3.7.x.**
+Python 3.8 features (https://docs.python.org/3.10/whatsnew/3.8.html) can be used as soon as #32937 is merged:
-Python 3.8 features (https://docs.python.org/3.10/whatsnew/3.8.html):
-
+- assignment expressions `:=` (https://docs.python.org/3.10/whatsnew/3.8.html#assignment-expressions)
- positional-only parameters ([PEP 570](https://www.python.org/dev/peps/pep-0570/))
- `f'{expr=}'` https://docs.python.org/3.10/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging
- PEP 590: Vectorcall: a fast calling protocol for CPython https://docs.python.org/3.10/whatsnew/3.8.html#pep-590-vectorcall-a-fast-calling-protocol-for-cpython
- `functools.cached_property()` https://docs.python.org/3.10/whatsnew/3.8.html#functools
- `pprint(sort_dicts=False)`
-- `shutil.copytree(dirs_exist_ok=True)`
+- `shutil.copytree(dirs_exist_ok=True)` https://docs.python.org/3.10/whatsnew/3.8.html#shutil
+- `as_integer_ratio`, `__index__` special method (https://docs.python.org/3.10/whatsnew/3.8.html#other-language-changes)
+- `math.dist`, `hypot`, `prod`, `perm`, `comb`, `isqrt` https://docs.python.org/3.10/whatsnew/3.8.html#math
+- `typing.TypedDict`, `typing.Literal`, `Final`, `Protocol` https://docs.python.org/3.10/whatsnew/3.8.html#typing
+
+
+**Using features introduced in Python 3.9 or later cannot be used in Sage yet because we support system Python 3.8.x.**
Python 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html):
Description changed:
---
+++
@@ -49,6 +49,9 @@
Python 3.10 features (https://docs.python.org/3.10/whatsnew/3.10.html):
+Python 3.11 features (https://docs.python.org/3.11/whatsnew/3.11.html):
+
+
See also:
- #29728: Meta-ticket: improve compatibility with the Python library
Description changed:
---
+++
@@ -42,7 +42,7 @@
- `typing.TypedDict`, `typing.Literal`, `Final`, `Protocol` https://docs.python.org/3.10/whatsnew/3.8.html#typing
-**Using features introduced in Python 3.9 or later cannot be used in Sage yet because we support system Python 3.8.x.**
+**Features introduced in Python 3.9 or later cannot be used in Sage yet because we support system Python 3.8.x.**
Python 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html):
Description changed:
---
+++
@@ -1,4 +1,4 @@
-**For Sage 9.4, all of the following features can be used:**
+**For Sage 9.7, all of the following features can be used:**
Python 3.6 features (https://docs.python.org/3.10/whatsnew/3.6.html):
Description changed:
---
+++
@@ -48,6 +48,8 @@
Python 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html):
Python 3.10 features (https://docs.python.org/3.10/whatsnew/3.10.html):
+- #34678: `match ... case`
+
Python 3.11 features (https://docs.python.org/3.11/whatsnew/3.11.html):
For Sage 10.4, all of the following features can be used
Python 3.6 features (https://docs.python.org/3.10/whatsnew/3.6.html):
32058 add typing annotations in permutations
32067 Developer manual: Section on typing annotations
29775 Add a bit of typing to manifold code
30381 Python 3 typing/protocols/ABCs
30511 Type hints (
__annotations__
) and coercion/Cythonyield from
- #29857.sage
modules importable)__matmul__
(infix@
operator) - #22760from ..a import b
Python 3.7 features (https://docs.python.org/3.10/whatsnew/3.7.html)
importlib.resources (#31306)
from
futureimport annotations
(#31006)https://docs.python.org/3/library/dataclasses.html
Python 3.8 features (https://docs.python.org/3.10/whatsnew/3.8.html)
:=
(https://docs.python.org/3.10/whatsnew/3.8.html#assignment-expressions)f'{expr=}'
https://docs.python.org/3.10/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debuggingfunctools.cached_property()
https://docs.python.org/3.10/whatsnew/3.8.html#functoolspprint(sort_dicts=False)
shutil.copytree(dirs_exist_ok=True)
https://docs.python.org/3.10/whatsnew/3.8.html#shutilas_integer_ratio
,__index__
special method (https://docs.python.org/3.10/whatsnew/3.8.html#other-language-changes)math.dist
,hypot
,prod
,perm
,comb
,isqrt
https://docs.python.org/3.10/whatsnew/3.8.html#mathtyping.TypedDict
,typing.Literal
,Final
,Protocol
https://docs.python.org/3.10/whatsnew/3.8.html#typingPython 3.9 features (https://docs.python.org/3.10/whatsnew/3.9.html)
Features introduced in Python 3.10 or later cannot be used in Sage yet because we support system Python 3.9.x
Python 3.10 features (https://docs.python.org/3.10/whatsnew/3.10.html):
34678:
match ... case
36609
Python 3.11 features (https://docs.python.org/3.11/whatsnew/3.11.html):
Python 3.12 features (https://docs.python.org/3.12/whatsnew/3.12.html):
Python 3.13 features (https://docs.python.org/3.13/whatsnew/3.13.html):
See also
29728: Meta-ticket: improve compatibility with the Python library
30384: Adopt the “time window-based” policy for support of Python versions from NEP 29
30551 Drop Python 3.6 support
CC: @fchapoton @dimpase @jhpalmieri @tobiasdiez @tscrim @nthiery @slel @nbruin
Component: python3
Keywords: sd109
Issue created by migration from https://trac.sagemath.org/ticket/29756