Skip to content

Commit 343555e

Browse files
authored
Merge pull request #58 from maxmind/greg/py3
Drop Python 2 support
2 parents e014129 + 190ee89 commit 343555e

14 files changed

Lines changed: 328 additions & 215 deletions

.travis.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,25 @@ sudo: false
33
language: python
44
matrix:
55
include:
6-
- python: 2.7
7-
dist: trusty
8-
- python: 3.5
9-
dist: trusty
106
- python: 3.6
11-
dist: trusty
127
- python: 3.7
13-
dist: xenial
148
- python: 3.8
15-
dist: xenial
169
env:
1710
- RUN_LINTER=1
1811
- RUN_SNYK=1
1912
- python: nightly
2013
dist: xenial
21-
- python: pypy
22-
dist: trusty
2314
allow_failures:
2415
- python: nightly
2516

2617
before_install:
2718
- "if [[ $RUN_SNYK && $SNYK_TOKEN ]]; then sudo apt-get install -y nodejs; npm install -g snyk; fi"
2819
install:
29-
- "if [[ $RUN_LINTER ]]; then pip install --upgrade pylint black; fi"
20+
- pip install -e git+https://github.com/maxmind/GeoIP2-python#egg=geoip2
21+
- "if [[ $RUN_LINTER ]]; then pip install --upgrade pylint black mypy voluptuous-stubs; fi"
3022
script:
3123
- python setup.py test
24+
- "if [[ $RUN_LINTER ]]; then mypy minfraud tests; fi"
3225
- "if [[ $RUN_LINTER ]]; then ./.travis-pylint.sh; fi"
3326
- "if [[ $RUN_LINTER ]]; then ./.travis-black.sh; fi"
3427
- "if [[ $RUN_SNYK && $SNYK_TOKEN ]]; then snyk test --org=maxmind --file=requirements.txt; fi"

HISTORY.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@
33
History
44
-------
55

6+
2.0.0
7+
8+
* IMPORTANT: Python 2.7 and 3.5 support has been dropped. Python 3.6 or greater
9+
is required.
10+
* Type hints have been added.
11+
* Email validation is now done with ``email_validator`` rather than
12+
``validate_email``.
13+
* URL validation is now done with ``urllib.parse`` rather than ``rfc3987``.
14+
* RFC 3339 timestamp validation is now done via a regular expression.
15+
616
1.13.0 (2020-07-14)
717
+++++++++++++++++++
818

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ minFraud Score, Insights, Factors and Report Transaction Python API
55
Description
66
-----------
77

8-
This package provides an API for the `MaxMind minFraud Score, Insights, and
8+
This package provides an API for the `MaxMind minFraud Score, Insights, and
99
Factors web services <https://dev.maxmind.com/minfraud/>`_ as well as the
1010
`Report Transaction web service
1111
<https://dev.maxmind.com/minfraud/report_transaction>`_.
@@ -252,8 +252,7 @@ Report Transactions Example
252252
Requirements
253253
------------
254254

255-
This code requires Python 2.7+ or 3.5+. Older versions are not supported.
256-
This library has been tested with CPython and PyPy.
255+
Python 3.6 or greater is required. Older versions are not supported.
257256

258257
Versioning
259258
----------

dev-bin/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [ -n "$(git status --porcelain)" ]; then
3535
fi
3636

3737
# Make sure release deps are installed with the current python
38-
pip install -U sphinx wheel voluptuous strict_rfc3339 validate_email rfc3987
38+
pip install -U sphinx wheel voluptuous email_validator twine
3939

4040
perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/g" minfraud/version.py
4141

minfraud/errors.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
77
"""
88

9+
from typing import Optional
10+
911

1012
class MinFraudError(RuntimeError):
1113
"""There was a non-specific error in minFraud.
@@ -39,7 +41,9 @@ class HTTPError(MinFraudError):
3941
4042
"""
4143

42-
def __init__(self, message, http_status=None, uri=None):
44+
def __init__(
45+
self, message: str, http_status: Optional[int] = None, uri: Optional[str] = None
46+
) -> None:
4347
super(HTTPError, self).__init__(message)
4448
self.http_status = http_status
4549
self.uri = uri

0 commit comments

Comments
 (0)