Skip to content

Commit

Permalink
Remove py2 support (pynamodb#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettheel authored May 25, 2020
1 parent 5e125a1 commit 8d58d2e
Show file tree
Hide file tree
Showing 49 changed files with 1,118 additions and 2,017 deletions.
16 changes: 2 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
language: python

python:
- "3.7"
- "3.6"
- "3.5"
- "2.7"
- "pypy"


# See https://github.com/travis-ci/travis-ci/issues/9815
matrix:
include:
- python: "3.7"
dist: xenial
sudo: true

env:
- AWS_SECRET_ACCESS_KEY=fake_key AWS_ACCESS_KEY_ID=fake_id
- "pypy3"

install:
- pip install -e .[signals] -r requirements-dev.txt
Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ From GitHub::
$ pip install git+https://github.com/pynamodb/PynamoDB#egg=pynamodb

From conda-forge::

$ conda install -c conda-forge pynamodb

Upgrading
Expand Down Expand Up @@ -228,7 +228,7 @@ Want to backup and restore a table? No problem.
Features
========

* Python >= 3.3, and 2.7 support
* Python >= 3.5 support
* An ORM-like interface with query and scan filters
* Compatible with DynamoDB Local
* Supports the entire DynamoDB API
Expand All @@ -240,4 +240,3 @@ Features
* Complex queries
* Batch operations with automatic pagination
* Iterators for working with Query and Scan operations

1 change: 0 additions & 1 deletion docs/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Here is an example showing how to enable logging for PynamoDB:

.. code-block:: python
from __future__ import print_function
import logging
from pynamodb.models import Model
from pynamodb.attributes import (
Expand Down
1 change: 0 additions & 1 deletion examples/attributes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
A PynamoDB example using a custom attribute
"""
from __future__ import print_function
import pickle
from pynamodb.attributes import BinaryAttribute, UnicodeAttribute
from pynamodb.models import Model
Expand Down
1 change: 0 additions & 1 deletion examples/connection.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Examples using a connection
"""
from __future__ import print_function
from pynamodb.connection import Connection

# Get a connection
Expand Down
1 change: 0 additions & 1 deletion examples/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleTablesAndData.html
"""
from __future__ import print_function
import logging
from pynamodb.models import Model
from pynamodb.attributes import (
Expand Down
1 change: 0 additions & 1 deletion examples/url_shortener/shortener.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
A fully working url shortener example
"""
from __future__ import print_function
import flask
from hashlib import md5
from base64 import b64encode
Expand Down
2 changes: 1 addition & 1 deletion pynamodb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"""
__author__ = 'Jharrod LaFon'
__license__ = 'MIT'
__version__ = '4.3.3'
__version__ = '5.0.0b1'
35 changes: 4 additions & 31 deletions pynamodb/_compat.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
import six
import sys
from typing import Generic, TYPE_CHECKING

if six.PY2:
from inspect import getargspec as getfullargspec
if TYPE_CHECKING:
GenericMeta = type # to avoid dynamic base class
else:
from inspect import getfullargspec


class FakeGenericMeta(type):
"""Poor man's Generic[T] that doesn't depend on typing. The real generics are in the type stubs."""
def __getitem__(self, item):
return self


def load_module(name, path):
"""Load module using the Python version compatible function."""
if sys.version_info >= (3, 3):
from importlib.machinery import SourceFileLoader

# Typeshed is incorrect in requiring a string arg to `load_module`,
# as this works with no args or a None arg.
# Even `load_module` is now deprecated, so we should update to just
# using the following approach in >= python 3.5:
# https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
loader = SourceFileLoader(name, path)
return loader.load_module() # type: ignore
else:
from imp import load_source
return load_source(name, path)


__all__ = ('getfullargspec', 'FakeGenericMeta', 'load_module')
GenericMeta = type(Generic)
Loading

0 comments on commit 8d58d2e

Please sign in to comment.