Skip to content
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

Drop Python 2 #220

Merged
merged 15 commits into from Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -3,7 +3,6 @@
TODO:
* [ ] Unit tests and/or doctests in docstrings
* [ ] ``tox -e py38`` passes locally
* [ ] ``tox -e py27`` passes locally
* [ ] Docstrings and API docs for any new/modified user-facing classes and functions
* [ ] Changes documented in docs/release.rst
* [ ] ``tox -e docs`` passes locally
Expand Down
8 changes: 3 additions & 5 deletions .travis.yml
Expand Up @@ -12,9 +12,6 @@ addons:

matrix:
include:
- os: linux
language: python
python: 2.7
- os: linux
language: python
python: 3.5
Expand All @@ -30,8 +27,9 @@ matrix:
python: 3.8
dist: xenial
sudo: true
- os: osx
language: generic
# Skip OSX build for now
# - os: osx
# language: generic

install:
- pip install -U tox-travis coveralls pip setuptools wheel pytest
Expand Down
4 changes: 0 additions & 4 deletions appveyor.yml
Expand Up @@ -12,10 +12,6 @@ environment:

matrix:

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
DISTUTILS_USE_SDK: "1"

- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5"

Expand Down
15 changes: 1 addition & 14 deletions docs/conf.py
Expand Up @@ -16,16 +16,7 @@

import sys
import os


PY2 = sys.version_info[0] == 2


if PY2: # pragma: py3 no cover
from mock import Mock as MagicMock
else: # pragma: py2 no cover
from unittest.mock import Mock as MagicMock

from unittest.mock import Mock as MagicMock

class Mock(MagicMock):
@classmethod
Expand All @@ -34,10 +25,6 @@ def __getattr__(cls, name):


MOCK_MODULES = ['msgpack']
if PY2:
MOCK_MODULES.append('lzma')


sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)


Expand Down
6 changes: 6 additions & 0 deletions docs/release.rst
@@ -1,6 +1,12 @@
Release notes
=============

Upcoming Release
----------------

* Drop support for Python 2.
By :user:`James Bourbeau <jrbourbeau>`, :issue:`220`.


.. _release_0.6.4:

Expand Down
2 changes: 0 additions & 2 deletions numcodecs/__init__.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# flake8: noqa
"""Numcodecs is a Python package providing buffer compression and
transformation codecs for use in data storage and communication
Expand All @@ -18,7 +17,6 @@

"""

from __future__ import absolute_import, print_function, division
import multiprocessing
import atexit

Expand Down
10 changes: 2 additions & 8 deletions numcodecs/abc.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""This module defines the :class:`Codec` base class, a common interface for
all codec classes.

Expand Down Expand Up @@ -29,10 +28,9 @@
other and vice versa.

"""
from __future__ import absolute_import, print_function, division


class Codec(object):
class Codec:
"""Codec abstract base class."""

# override in sub-class
Expand Down Expand Up @@ -117,10 +115,6 @@ def __eq__(self, other):
except AttributeError:
return False

def __ne__(self, other):
# only needed for PY2
return not self == other

def __repr__(self):

# override in sub-class if need special representation
Expand All @@ -129,7 +123,7 @@ def __repr__(self):
# parameters and valid keyword arguments to constructor function

r = '%s(' % type(self).__name__
params = ['%s=%r' % (k, getattr(self, k))
params = ['{}={!r}'.format(k, getattr(self, k))
for k in sorted(self.__dict__)
if not k.startswith('_')]
r += ', '.join(params) + ')'
Expand Down
5 changes: 1 addition & 4 deletions numcodecs/astype.py
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division

import numpy as np

from .abc import Codec
Expand Down Expand Up @@ -79,7 +76,7 @@ def get_config(self):

def __repr__(self):
return (
'%s(encode_dtype=%r, decode_dtype=%r)' % (
'{}(encode_dtype={!r}, decode_dtype={!r})'.format(
type(self).__name__,
self.encode_dtype.str,
self.decode_dtype.str
Expand Down