Skip to content

Commit

Permalink
Remove python 2.7 support
Browse files Browse the repository at this point in the history
Version 2.7 of Python soon will reach the end of its live. It already
hinders the application of new language features which are incompatible
with 2.7. Thus, stopping to support `python2.7.` is necessary.

All major distributions ship some version of the Python3 series already.
Thus, stopping to support `python2.7` should be relatively light in
trouble for users.

* CleanUp Get rid of builtins variable
* CleanUp Get rid of try-expect for ImportError
* CleanUp Get rid of try-expect for NameError
* CleanUp Remove encoding declarations
* CleanUp Remove unicode prefix from string literals
* CleanUp Remove unicode prefix from string literals
* Require Python >= 3.5 in setup.py

Co-authored-by: Max Görner <max@familie-goerner.eu>

Reference PR: #305
  • Loading branch information
MaxG87 committed Jan 7, 2021
1 parent 4194fdf commit 510fc1a
Show file tree
Hide file tree
Showing 18 changed files with 112 additions and 180 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ matrix:
os: linux
dist: xenial
env: TOXENV=flake8
- python: 2.7
os: linux
dist: trusty
env: TOXENV=py27
- python: 3.5
os: linux
dist: trusty
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- The `log` command output can now be filtered to exclude projects and tags via `--ignore-project` and `--ignore-tag` (#395)

### Removed

- Python 2.7 support (#305).

## [1.10.0] - 2020-07-03

### Added
Expand Down
1 change: 0 additions & 1 deletion scripts/fuzzer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import arrow
import random
Expand Down
1 change: 0 additions & 1 deletion scripts/gen-cli-docs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import inspect

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup file for the Watson distribution."""

from os.path import join
Expand Down Expand Up @@ -46,6 +45,7 @@ def parse_requirements(requirements, ignore=('setuptools',)):
license='MIT',
long_description=readme,
install_requires=parse_requirements('requirements.txt'),
python_requires='>=3.5',
tests_require=parse_requirements('requirements-dev.txt'),
entry_points={
'console_scripts': [
Expand All @@ -64,8 +64,6 @@ def parse_requirements(requirements, ignore=('setuptools',)):
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
Expand Down
12 changes: 2 additions & 10 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

import os
import datetime

try:
from unittest import mock
except ImportError:
import mock

try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import mock
from io import StringIO

import py

Expand Down
10 changes: 5 additions & 5 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def test_config_get(mocker, watson):
content = u"""
content = """
[backend]
url = foo
token =
Expand All @@ -24,7 +24,7 @@ def test_config_get(mocker, watson):


def test_config_getboolean(mocker, watson):
content = u"""
content = """
[options]
flag1 = 1
flag2 = ON
Expand All @@ -48,7 +48,7 @@ def test_config_getboolean(mocker, watson):


def test_config_getint(mocker, watson):
content = u"""
content = """
[options]
value1 = 42
value2 = spamm
Expand All @@ -72,7 +72,7 @@ def test_config_getint(mocker, watson):


def test_config_getfloat(mocker, watson):
content = u"""
content = """
[options]
value1 = 3.14
value2 = 42
Expand All @@ -99,7 +99,7 @@ def test_config_getfloat(mocker, watson):


def test_config_getlist(mocker, watson):
content = u"""
content = """
# empty lines in option values (including the first one) are discarded
[options]
value1 =
Expand Down
19 changes: 4 additions & 15 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""Unit tests for the 'utils' module."""

import arrow
Expand All @@ -9,15 +8,8 @@
import os
import datetime
import operator

try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from io import StringIO
from mock import patch
import pytest
from click.exceptions import Abort
from dateutil.tz import tzutc
Expand All @@ -35,7 +27,6 @@
safe_save,
sorted_groupby,
parse_tags,
PY2,
json_arrow_encoder,
)
from . import mock_datetime
Expand Down Expand Up @@ -104,11 +95,9 @@ def test_make_json_writer_with_kwargs():

def test_make_json_writer_with_unicode():
fp = StringIO()
writer = make_json_writer(lambda: {u'ùñï©ôð€': u'εvεrywhεrε'})
writer = make_json_writer(lambda: {'ùñï©ôð€': 'εvεrywhεrε'})
writer(fp)
expected = u'{\n "ùñï©ôð€": "εvεrywhεrε"\n}'
if PY2:
expected = expected.encode('utf-8')
expected = '{\n "ùñï©ôð€": "εvεrywhεrε"\n}'
assert fp.getvalue() == expected


Expand Down
Loading

0 comments on commit 510fc1a

Please sign in to comment.