From ac7221ac01319916b00e54f4219030a6a6900177 Mon Sep 17 00:00:00 2001 From: Betsy Lorton Date: Fri, 10 Jan 2020 09:43:38 -0500 Subject: [PATCH 1/2] Remove python 2 compatibility Remove python 2 from tox testing, Travis, and setup.py. Remove the six library. --- .travis.yml | 3 +-- retirement_api/models.py | 4 +--- retirement_api/tests/test_commands.py | 2 +- retirement_api/tests/test_views.py | 6 ++---- retirement_api/utils/ss_update_stats.py | 2 +- setup.py | 2 -- tox.ini | 3 +-- 7 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07975b8..ce5daac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: python python: -- 2.7 - 3.6 cache: pip install: @@ -10,7 +9,7 @@ before_script: - npm config set package-lock false script: - tox -- python2.7 setup.py bdist_wheel --universal +- python3.6 setup.py bdist_wheel --universal after_success: - coveralls deploy: diff --git a/retirement_api/models.py b/retirement_api/models.py index a9af99a..198d080 100644 --- a/retirement_api/models.py +++ b/retirement_api/models.py @@ -1,8 +1,6 @@ from django.db import models from django.template.defaultfilters import slugify -from six import text_type - WORKFLOW_STATE = [ ('APPROVED', 'Approved'), @@ -171,7 +169,7 @@ def dump_translation_text(self, output=False, outfile=None): f.write(line.encode('utf-8')) for phrase in phrases: f.write('#: templates/claiming.html\n'.encode('utf-8')) - f.write(text_type('msgid "%s"\n' % phrase).encode('utf-8')) + f.write(str('msgid "%s"\n' % phrase).encode('utf-8')) f.write('msgstr ""\n\n'.encode('utf-8')) else: return phrases diff --git a/retirement_api/tests/test_commands.py b/retirement_api/tests/test_commands.py index 4694a6b..f38e888 100644 --- a/retirement_api/tests/test_commands.py +++ b/retirement_api/tests/test_commands.py @@ -1,7 +1,7 @@ import mock import unittest -from six import StringIO +from io import StringIO from django.core.management import call_command diff --git a/retirement_api/tests/test_views.py b/retirement_api/tests/test_views.py index cb83d91..50008d0 100644 --- a/retirement_api/tests/test_views.py +++ b/retirement_api/tests/test_views.py @@ -12,8 +12,6 @@ # import unittest from django.http import HttpRequest -from six import binary_type - from retirement_api.views import (param_check, income_check, estimator, @@ -87,7 +85,7 @@ def test_get_full_retirement_age(self): def test_estimator_url_data(self): request = self.req_blank response = estimator(request, dob='1955-05-05', income='40000') - self.assertIsInstance(response.content, binary_type) + self.assertIsInstance(response.content, bytes) rdata = json.loads(response.content) for each in self.return_keys: self.assertTrue(each in rdata.keys()) @@ -106,7 +104,7 @@ def test_estimator_query_data(self): request = self.req_good response = estimator(request) self.assertTrue(response.status_code == 200) - self.assertIsInstance(response.content, binary_type) + self.assertIsInstance(response.content, bytes) rdata = json.loads(response.content) for each in self.return_keys: self.assertTrue(each in rdata.keys()) diff --git a/retirement_api/utils/ss_update_stats.py b/retirement_api/utils/ss_update_stats.py index ee89c11..219ec63 100755 --- a/retirement_api/utils/ss_update_stats.py +++ b/retirement_api/utils/ss_update_stats.py @@ -14,7 +14,7 @@ import requests # from django.template.defaultfilters import slugify from bs4 import BeautifulSoup as bs -from six import StringIO +from io import StringIO TODAY = datetime.datetime.now().date() BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) diff --git a/setup.py b/setup.py index 5b37dbb..9c3c9c8 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,6 @@ 'dj-database-url>=0.4.2,<1', 'python-dateutil>=2.1<3', 'requests>=2.18,<3', - 'six>=1.11.0,<2', ] @@ -49,7 +48,6 @@ def read_file(filename): 'Topic :: Internet :: WWW/HTTP', 'Intended Audience :: Developers', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.6', 'Framework :: Django', 'Development Status :: 4 - Beta', diff --git a/tox.ini b/tox.ini index 3c57f38..c1b36c1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] skipsdist=True -envlist=py{27,36}-dj{111} +envlist=py{36}-dj{111} [testenv] install_command=pip install -e ".[testing]" -U {opts} {packages} @@ -10,7 +10,6 @@ commands= coverage report --skip-covered -m basepython= - py27: python2.7 py36: python3.6 deps= From e96c8c938bc81a0bd4774a0995170450874c0050 Mon Sep 17 00:00:00 2001 From: Betsy Lorton Date: Fri, 10 Jan 2020 11:42:20 -0500 Subject: [PATCH 2/2] Don't create universal wheels Since we no longer support python 2, we no longer need to create a wheel that is python 2 compatible. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ce5daac..9e3d209 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_script: - npm config set package-lock false script: - tox -- python3.6 setup.py bdist_wheel --universal +- python setup.py bdist_wheel after_success: - coveralls deploy: