Skip to content

Commit b9f34d0

Browse files
committed
drop support for Python 3.6 and mark Python 3.9 as supported where not already
1 parent 0782799 commit b9f34d0

File tree

10 files changed

+25
-43
lines changed

10 files changed

+25
-43
lines changed

.github/workflows/python-package-conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
# os: ["ubuntu-latest", "macos-latest", "windows-latest"]
17-
python-version: [3.6, 3.7, 3.8, 3.9]
17+
python-version: [3.7, 3.8, 3.9]
1818

1919
defaults:
2020
run:

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Once you have satisfied the requirements detailed below, simply run::
7373
Required Dependencies
7474
---------------------
7575

76-
- Python 3.6 or 3.7
76+
- Python 3.7, 3.8 or 3.9
7777
- `numpy <http://www.numpy.org/>`__ (1.13 or later)
7878
- `pandas <http://pandas.pydata.org/>`__ (0.20 or later)
7979

design.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ G.clength.split[2, 5] == G.clength[2], G.clength[5]
279279
# minr_replica = [('benef_tot', [('men', 0.20), ('women', 0.57)])
280280
# ('prop_carr', [('men', 0.46), ('women', 0.65)])]
281281

282-
# 3.6+ (nice but only string labels)
282+
# nice but only string labels
283+
283284
# minr_replica = od(benef_tot=od(men=0.20, women=0.57),
284285
# prop_carr=od(men=0.46, women=0.65))
285286

doc/source/changes/version_0_34.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Syntax changes
1212
Backward incompatible changes
1313
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

15-
* other backward incompatible changes
15+
* dropped support for Python 3.6.
1616

1717

1818
New features

larray/core/array.py

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
from collections.abc import Iterable, Sequence
3131
import builtins
3232
import os
33-
import sys
3433
import functools
3534
import warnings
3635

@@ -2932,11 +2931,6 @@ def _prepare_aggregate(self, op, args, kwargs=None, commutative=False, stack_dep
29322931
assert isinstance(explicit_axis, AxisCollection)
29332932
args += tuple(explicit_axis)
29342933
kwargs_items = kwargs.items()
2935-
if not commutative and len(kwargs_items) > 1:
2936-
# TODO: lift this restriction for python3.6+
2937-
raise ValueError(f"grouping aggregates on multiple axes at the same time using keyword arguments is not "
2938-
f"supported for '{op.__name__}' (because it is not a commutative operation and keyword "
2939-
f"arguments are *not* ordered in Python)")
29402934

29412935
# Sort kwargs by axis name so that we have consistent results between runs because otherwise rounding errors
29422936
# could lead to slightly different results even for commutative operations.
@@ -9312,7 +9306,7 @@ def eye(rows, columns=None, k=0, title=None, dtype=None, meta=None) -> Array:
93129306
# stack(('M', a1), ('F', a2), axis='sex')
93139307
# stack(a1, a2, axis='sex')
93149308

9315-
# on Python 3.6, we could do something like (it would make from_lists obsolete for 1D arrays):
9309+
# we could do something like (it would make from_lists obsolete for 1D arrays):
93169310
# stack('sex', M=1, F=2)
93179311

93189312
# which is almost equivalent to:
@@ -9520,10 +9514,8 @@ def stack(elements=None, axes=None, title=None, meta=None, dtype=None, res_axes=
95209514
M 1.0 0.0
95219515
F 1.0 0.0
95229516
9523-
Without passing an explicit order for labels (or an axis object like above), it should only be used on Python 3.6
9524-
or later because keyword arguments are NOT ordered on earlier Python versions.
9517+
Without passing an explicit order for labels (or an axis object like above)
95259518
9526-
>>> # use this only on Python 3.6 and later
95279519
>>> stack(BE=arr1, FO=arr2, axes='nat') # doctest: +SKIP
95289520
sex\nat BE FO
95299521
M 1.0 0.0
@@ -9583,17 +9575,9 @@ def stack(elements=None, axes=None, title=None, meta=None, dtype=None, res_axes=
95839575
axes = AxisCollection(axes)
95849576

95859577
if kwargs:
9586-
if not isinstance(axes, AxisCollection) and sys.version_info[:2] < (3, 6):
9587-
warnings.warn("keyword arguments ordering is not guaranteed for Python < 3.6 so it is not "
9588-
"recommended to use them in stack() without providing labels order in the axes argument")
95899578
elements = kwargs.items()
95909579

95919580
if isinstance(elements, dict):
9592-
if not isinstance(axes, AxisCollection) and sys.version_info[:2] < (3, 7):
9593-
# stacklevel=3 because of deprecate_kwarg
9594-
warnings.warn("dict ordering is not guaranteed for Python < 3.7 so it is not recommended to use "
9595-
"them in stack() without providing labels order in the axes argument", stacklevel=3)
9596-
95979581
elements = elements.items()
95989582

95999583
if isinstance(elements, Array):

larray/inout/excel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ def __init__(self, fname, overwrite_file=False):
237237
super(PandasExcelHandler, self).__init__(fname, overwrite_file)
238238

239239
def _open_for_read(self):
240-
engine = 'openpyxl' if sys.version_info < (3, 7) else None
241-
self.handle = pd.ExcelFile(self.fname, engine=engine)
240+
self.handle = pd.ExcelFile(self.fname)
242241

243242
def _open_for_write(self):
244243
_, ext = os.path.splitext(self.fname)

larray/tests/common.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import re
3-
import sys
43
import inspect
54
from contextlib import contextmanager
65

@@ -153,8 +152,6 @@ def meta():
153152
needs_xlsxwriter = pytest.mark.skipif(SKIP_EXCEL_TESTS or xlsxwriter is None,
154153
reason="xlsxwriter is required for this test")
155154

156-
needs_python37 = pytest.mark.skipif(sys.version_info < (3, 7), reason="Python 3.7 is required for this test")
157-
158155

159156
@contextmanager
160157
def must_warn(warn_cls=None, msg=None, match=None, check_file=True, check_num=True):

larray/tests/test_array.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
from larray.tests.common import meta
1212
from larray.tests.common import (inputpath, tmp_path,
1313
assert_array_equal, assert_array_nan_equal, assert_larray_equiv, assert_larray_equal,
14-
needs_xlwings, needs_pytables, needs_xlsxwriter, needs_openpyxl, needs_python37,
15-
must_warn)
14+
needs_xlwings, needs_pytables, needs_xlsxwriter, needs_openpyxl, must_warn)
1615
from larray import (Array, LArray, Axis, AxisCollection, LGroup, IGroup, Metadata,
1716
zeros, zeros_like, ndtest, empty, ones, eye, diag, stack, sequence,
1817
union, clip, exp, where, X, mean, inf, nan, isnan, round,
@@ -5172,7 +5171,7 @@ def test_stack():
51725171

51735172

51745173
def test_stack_kwargs_no_axis_labels():
5175-
# these tests rely on kwargs ordering, hence python 3.6
5174+
# these tests rely on kwargs ordering, hence python 3.6+
51765175

51775176
# 1) using scalars
51785177
# ----------------
@@ -5207,9 +5206,8 @@ def test_stack_kwargs_no_axis_labels():
52075206
assert_array_equal(res, expected)
52085207

52095208

5210-
@needs_python37
52115209
def test_stack_dict_no_axis_labels():
5212-
# these tests rely on dict ordering, hence python 3.7
5210+
# these tests rely on dict ordering (hence require python 3.7+)
52135211

52145212
# 1) dict of scalars
52155213
# ------------------

make_release.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ def update_metapackage(local_repository, release_name, public_release=True, **ex
3737

3838
# TODO: this should be echocall(redirect_stdout=False)
3939
print(f'Updating larrayenv metapackage to version {version}')
40-
args = ['conda', 'metapackage', 'larrayenv', version, '--dependencies', f'larray =={version}',
41-
f'larray-editor =={version}', f'larray_eurostat =={version}', "qtconsole", "matplotlib",
42-
"pyqt", "qtpy", "pytables", "pydantic", "xlsxwriter", "xlrd", "xlwt", "openpyxl", "xlwings"]
43-
# required for pydantic
44-
if sys.version_info < (3, 7):
45-
args += ["dataclasses"]
46-
args += ['--user', 'larray-project', '--home', 'http://github.com/larray-project/larray',
47-
'--license', 'GPL-3.0',
48-
'--summary', "'Package installing larray and all sub-projects and optional dependencies'"]
49-
check_call(args)
40+
dependencies = [
41+
f'larray =={version}', f'larray-editor =={version}', f'larray_eurostat =={version}',
42+
'qtconsole', 'matplotlib', 'pyqt', 'qtpy', 'pytables', 'pydantic',
43+
'xlsxwriter', 'xlrd', 'xlwt', 'openpyxl', 'xlwings',
44+
]
45+
check_call([
46+
'conda', 'metapackage', 'larrayenv', version,
47+
'--dependencies'] + dependencies + [
48+
'--user', 'larray-project',
49+
'--home', 'http://github.com/larray-project/larray',
50+
'--license', 'GPL-3.0',
51+
'--summary', "'Package installing larray and all sub-projects and optional dependencies'",
52+
])
5053

5154

5255
def merge_changelogs(build_dir, src_documentation, release_name, public_release, branch='master', **extra_kwargs):

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ addopts = -v --doctest-modules
99
--ignore=larray/core/npufuncs.py
1010
--ignore=larray/ipfp
1111
--ignore=larray/inout/xw_reporting.py
12-
# doctest fails for Python 3.6 and numpy >= 1.17
12+
# doctest is copied from numpy (and fails for some Python + numpy version combinations)
1313
--deselect larray/core/array.py::larray.core.array.Array.astype
1414
# doctest fails (because the plot method returns a matplotlib axis object,
1515
# which we do not mention in the doctest to make it nicer)

0 commit comments

Comments
 (0)