Skip to content

Commit

Permalink
Trac #30551: Drop Python 3.6 support
Browse files Browse the repository at this point in the history
This can be a dependency for other tickets.

For instance tickets updating dependencies to
versions that dropped support for Python 3.6.

Related:

- #30384: Adopt "time window-based" Python versions support policy
- #29756: Meta-ticket: Review of Python 3 features that sagelib should
use systematically
- #30053 - can be dropped if 3.6 is gone

URL: https://trac.sagemath.org/30551
Reported by: slelievre
Ticket author(s): Tobias Diez, Matthias Koeppe
Reviewer(s): Matthias Koeppe, Dima Pasechnik
  • Loading branch information
Release Manager committed May 11, 2021
2 parents dce94e3 + b06731c commit 3859440
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 41 deletions.
9 changes: 0 additions & 9 deletions build/bin/sage-bootstrap-python
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ fi
# is accessible by this python; this is to guard on Cygwin against Pythons
# installed somewhere else in Windows.

# Trac #30008: Make it work even if the environment tries to sabotage UTF-8
# operation in Python 3.0.x-3.6.x by setting LC_ALL=C or similar.

if [ "$LC_ALL" = "C" -o "$LANG" = "C" -o "$LC_CTYPE" = "C" ]; then
LC_ALL=$(locale -a | grep -E -i '^(c|en_us)[-.]utf-?8$' | head -n 1)
LANG=$LC_ALL
export LC_ALL
export LANG
fi

PYTHONS="python python3 python3.8 python3.7 python2.7 python3.6 python2"
for PY in $PYTHONS; do
Expand Down
7 changes: 1 addition & 6 deletions build/bin/sage-site
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,7 @@ if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then

# Trac #30002: ensure an English locale so that it is possible to
# scrape out warnings by pattern matching.
# Trac #30576: But we have to avoid the C locale, which disables
# proper UTF-8 operation in Python 3.6 or older.
LC_ALL=$(locale -a | grep -E -i '^(c|en_us)[-.]utf-?8$' | head -n 1)
LANG=$LC_ALL
export LC_ALL
export LANG
export LANG=C

# See #30351: bugs in macOS implementations of openblas/libgopm can cause
# docbuild to hang if multiple OpenMP threads are allowed.
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SAGE_SPKG_CONFIGURE([python3], [
m4_pushdef([MIN_VERSION], [3.6.0])
m4_pushdef([MIN_VERSION], [3.7.0])
m4_pushdef([MIN_NONDEPRECATED_VERSION], [3.7.0])
m4_pushdef([LT_VERSION], [3.10.0])
AC_ARG_WITH([python],
Expand Down
10 changes: 0 additions & 10 deletions src/bin/sage
Original file line number Diff line number Diff line change
Expand Up @@ -955,16 +955,6 @@ fi
exec-runtests() {
sage_setup
export PYTHONIOENCODING="utf-8" # Fix encoding for doctests
# Trac #31191: Some versions of Python 3.6 disable utf-8 even if
# the locale is just "POSIX". This leads to errors in both the
# doctest framework and in various individual doctests.
if locale | grep -q -E -i '^LC_CTYPE="(C|POSIX)"$'; then
# Get an UTF-8 locale if possible.
LC_ALL=$(locale -a | grep -E -i '^(c|en_us)[-.]utf-?8$' | head -n 1)
LANG=$LC_ALL
export LC_ALL
export LANG
fi
exec sage-runtests "$@"
}

Expand Down
3 changes: 1 addition & 2 deletions src/doc/en/installation/source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ rather than building a Python 3 installation from scratch.
Use the configure option ``--without-system-python3`` in case you want Python 3
built from scratch.

Sage will accept versions 3.6.x to 3.9.x; however, support for system python 3.6.x
is deprecated and will be removed in the next development cycle.
Sage will accept versions 3.7.x to 3.9.x.

You can also use ``--with-python=/path/to/python3_binary`` to tell Sage to use
``/path/to/python3_binary`` to set up the venv. Note that setting up venv requires
Expand Down
13 changes: 4 additions & 9 deletions src/sage/combinat/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,25 +353,20 @@ def cardinality(self):
8
sage: Subsets(3).cardinality()
8
"""
return Integer(1) << self._s.cardinality()

def __len__(self):
r"""
Equivalent to ``self.cardinality()``.
TESTS::
``__len__`` should return a Python int; in Python 3.7+ this happens
automatically, but not on Python 3.6.
``__len__`` should return a Python int.
sage: S = Subsets(Set([1,2,3]))
sage: len(S)
8
sage: type(len(S)) is int
True
"""
return int(self.cardinality())
return Integer(1) << self._s.cardinality()

__len__ = cardinality

def first(self):
"""
Expand Down
1 change: 0 additions & 1 deletion src/sage/graphs/views.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ cdef class EdgesView:
elif i < 0:
return list(self)[i]
else:
i = int(i) # For Python < 3.7 where islice doesn't support non-int
try:
return next(islice(self, i, i + 1, 1))
except StopIteration:
Expand Down
3 changes: 1 addition & 2 deletions src/setup.cfg.m4
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ classifiers =
Operating System :: POSIX
Operating System :: MacOS :: MacOS X
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation :: CPython
Topic :: Scientific/Engineering :: Mathematics

[options]
python_requires = >=3.6, <3.10
python_requires = >=3.7, <3.10
install_requires =
sage_conf
esyscmd(`sage-get-system-packages install-requires \
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ setenv =
homebrew-python3.9: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/[email protected]/bin/python3
# https://github.com/pypa/manylinux
manylinux-standard: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp38-cp38/bin/python3
manylinux-python3.6: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp36-cp36m/bin/python3
manylinux-python3.7: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp37-cp37m/bin/python3
manylinux-python3.8: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp38-cp38/bin/python3
manylinux-python3.9: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp39-cp39/bin/python3
Expand Down

0 comments on commit 3859440

Please sign in to comment.