Skip to content

Commit

Permalink
Merge pull request #1326 from jules-ch/drop-python3.6
Browse files Browse the repository at this point in the history
Drop support for Python 3.6
  • Loading branch information
hgrecco authored Jun 12, 2021
2 parents 0cc9cb0 + de79c45 commit 9fc752c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 38 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ jobs:
test-linux:
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
numpy: [null, "numpy>=1.14,<2.0.0"]
python-version: [3.7, 3.8]
numpy: [null, "numpy>=1.17,<2.0.0"]
uncertainties: [null, "uncertainties==3.0.1", "uncertainties>=3.0.1,<4.0.0"]
extras: [null]
include:
- python-version: 3.6
numpy: numpy==1.14.6
- python-version: 3.7
numpy: numpy==1.17.5
extras: matplotlib==2.2.5
- python-version: 3.8
numpy: "numpy"
Expand Down
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Pint Changelog
- Fix a few small typos.
(Issue #1308)

### Breaking Changes

- pint no longer supports Python 3.6
- Minimum Numpy version supported is 1.17+


0.17 (2021-03-22)
-----------------
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ and constants. Due to its modular design, you can extend (or even rewrite!)
the complete list without changing the source code. It supports a lot of
numpy mathematical operations **without monkey patching or wrapping numpy**.

It has a complete test coverage. It runs in Python 3.6+ with no other dependency.
If you need Python 2.7 or 3.4/3.5 compatibility, use Pint 0.9.
It has a complete test coverage. It runs in Python 3.7+ with no other dependency.
If you need Python 3.6 compatibility, use Pint 0.17.
It is licensed under BSD.

It is extremely easy and natural to use:
Expand Down
2 changes: 1 addition & 1 deletion docs/getting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

Pint has no dependencies except Python_ itself. In runs on Python 3.6+.
Pint has no dependencies except Python_ itself. In runs on Python 3.7+.

You can install it (or upgrade to the latest version) using pip_::

Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Due to its modular design, you can extend (or even rewrite!) the complete list
without changing the source code. It supports a lot of numpy mathematical
operations **without monkey patching or wrapping numpy**.

It has a complete test coverage. It runs in Python 3.6+ with no other
It has a complete test coverage. It runs in Python 3.7+ with no other
dependencies. It is licensed under a `BSD 3-clause style license`_.

It is extremely easy and natural to use:
Expand Down
19 changes: 1 addition & 18 deletions pint/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
import warnings
from typing import List

from packaging import version

from .compat import (
HAS_NUMPY_ARRAY_FUNCTION,
NUMPY_VER,
_to_magnitude,
babel_parse,
compute,
Expand Down Expand Up @@ -1248,11 +1244,7 @@ def __mul__(self, other):
__rmul__ = __mul__

def __matmul__(self, other):
# Use NumPy ufunc (existing since 1.16) for matrix multiplication
if version.parse(NUMPY_VER) >= version.parse("1.16"):
return np.matmul(self, other)
else:
return NotImplemented
return np.matmul(self, other)

__rmatmul__ = __matmul__

Expand Down Expand Up @@ -1792,15 +1784,6 @@ def prod(self, *args, **kwargs):
Wraps np.prod().
"""
# TODO: remove after support for 1.16 has been dropped
if not HAS_NUMPY_ARRAY_FUNCTION:
raise NotImplementedError(
"prod is only defined for"
" numpy == 1.16 with NUMPY_ARRAY_FUNCTION_PROTOCOL enabled"
f" or for numpy >= 1.17 ({np.__version__} is installed)."
" Please try setting the NUMPY_ARRAY_FUNCTION_PROTOCOL environment variable"
" or updating your numpy version."
)
return np.prod(self, *args, **kwargs)

def __ito_if_needed(self, to_units):
Expand Down
10 changes: 2 additions & 8 deletions pint/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import copy
import functools
import importlib.resources
import itertools
import locale
import os
Expand Down Expand Up @@ -79,13 +80,6 @@
to_units_container,
)

try:
import importlib.resources as importlib_resources
except ImportError:
# Backport for Python < 3.7
import importlib_resources


_BLOCK_RE = re.compile(r"[ (]")


Expand Down Expand Up @@ -534,7 +528,7 @@ def load_definitions(self, file, is_resource=False):
if isinstance(file, str):
try:
if is_resource:
rbytes = importlib_resources.read_binary(__package__, file)
rbytes = importlib.resources.read_binary(__package__, file)
return self.load_definitions(
StringIO(rbytes.decode("utf-8")), is_resource
)
Expand Down
7 changes: 3 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@ classifiers =
Programming Language :: Python
Topic :: Scientific/Engineering
Topic :: Software Development :: Libraries
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9

[options]
packages = pint
zip_safe = True
include_package_data = True
python_requires = >=3.6
python_requires = >=3.7
install_requires =
packaging
importlib-metadata; python_version < '3.8'
importlib-resources; python_version < '3.7'
setup_requires = setuptools; setuptools_scm
test_suite = pint.testsuite.testsuite
scripts = pint/pint-convert

[options.extras_require]
numpy = numpy >= 1.14
numpy = numpy >= 1.17
uncertainties = uncertainties >= 3.0
test =
pytest
Expand Down

0 comments on commit 9fc752c

Please sign in to comment.