Skip to content

Commit 0d0ff1e

Browse files
authoredJan 16, 2024··
Bump backoff to be compatible with newer python versions (#165)
* bump backoff for pyton 3.11 compatibility * update pip version * try new circleci yml * remove 'make' * make pylint happy * make pylint happy * make pylint happy again * backoff version is a breaking change for old python versions * Changelog update
1 parent 2c053f4 commit 0d0ff1e

File tree

8 files changed

+39
-27
lines changed

8 files changed

+39
-27
lines changed
 

‎.circleci/config.yml

+22-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
1-
version: 2
1+
version: 2.1
2+
3+
workflows:
4+
build:
5+
jobs:
6+
- build:
7+
context:
8+
- circleci-user
9+
210
jobs:
311
build:
412
docker:
5-
- image: ubuntu:16.04
13+
- image: 218546966473.dkr.ecr.us-east-1.amazonaws.com/sources-python:1.1.0
614
steps:
715
- checkout
8-
- run:
9-
name: 'Install python 3.5.2'
10-
command: |
11-
apt update
12-
apt install --yes python3 python3-pip python3-venv
1316
- run:
1417
name: 'Setup virtualenv'
1518
command: |
16-
mkdir -p ~/.virtualenvs
19+
pyenv global 3.11.7
1720
python3 -m venv ~/.virtualenvs/singer-python
1821
source ~/.virtualenvs/singer-python/bin/activate
19-
pip install -U 'pip<19.2' 'setuptools<51.0.0'
20-
make install
22+
pip install -U 'pip==20.3.4' 'setuptools<51.0.0'
23+
pip install .[dev]
24+
- run:
25+
name: 'Pylint'
26+
command: |
27+
source ~/.virtualenvs/singer-python/bin/activate
28+
pip install pylint
29+
pylint singer --extension-pkg-whitelist=ciso8601 -d missing-docstring,broad-exception-raised,broad-exception-caught,bare-except,too-many-return-statements,too-many-branches,too-many-arguments,no-else-return,too-few-public-methods,fixme,protected-access,consider-using-f-string
2130
- run:
22-
name: 'Run tests'
31+
name: 'Run Tests'
2332
command: |
24-
# Need to re-activate the virtualenv
2533
source ~/.virtualenvs/singer-python/bin/activate
26-
make test
34+
pip install nose2
35+
nose2 -v -s tests

‎CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 6.0.0
4+
* Bump backoff version to 2.2.1. This version drops support for python 3.5, but adds it for 3.1o [#165](https://github.com/singer-io/singer-python/pull/165)
5+
36
## 5.13.0
47
* Add support for dev mode argument parsing [#158](https://github.com/singer-io/singer-python/pull/158)
58

‎setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55

66
setup(name="singer-python",
7-
version='5.13.0',
7+
version='6.0.0',
88
description="Singer.io utility library",
99
author="Stitch",
1010
classifiers=['Programming Language :: Python :: 3 :: Only'],
@@ -14,7 +14,7 @@
1414
'jsonschema==2.6.0',
1515
'simplejson==3.11.1',
1616
'python-dateutil>=2.6.0',
17-
'backoff==1.8.0',
17+
'backoff==2.2.1',
1818
'ciso8601',
1919
],
2020
extras_require={

‎singer/catalog.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __eq__(self, other):
9292

9393
@classmethod
9494
def load(cls, filename):
95-
with open(filename) as fp: # pylint: disable=invalid-name
95+
with open(filename, encoding="utf-8") as fp:
9696
return Catalog.from_dict(json.load(fp))
9797

9898
@classmethod

‎singer/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, message):
1111
The first line is the error's class name. The subsequent lines are
1212
the message that class was created with.
1313
"""
14-
super().__init__('{}\n{}'.format(self.__class__.__name__, message))
14+
super().__init__(f"{self.__class__.__name__}\n{message}")
1515

1616

1717
class SingerConfigurationError(SingerError):

‎singer/messages.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
class Message():
1212
'''Base class for messages.'''
1313

14-
def asdict(self): # pylint: disable=no-self-use
14+
def asdict(self):
1515
raise Exception('Not implemented')
1616

1717
def __eq__(self, other):
1818
return isinstance(other, Message) and self.asdict() == other.asdict()
1919

2020
def __repr__(self):
21-
pairs = ["{}={}".format(k, v) for k, v in self.asdict().items()]
21+
pairs = [f"{k}={v}" for k, v in self.asdict().items()]
2222
attrstr = ", ".join(pairs)
23-
return "{}({})".format(self.__class__.__name__, attrstr)
23+
return f"{self.__class__.__name__}({attrstr})"
2424

2525
def __str__(self):
2626
return str(self.asdict())
@@ -169,7 +169,7 @@ def asdict(self):
169169

170170
def _required_key(msg, k):
171171
if k not in msg:
172-
raise Exception("Message is missing required key '{}': {}".format(k, msg))
172+
raise Exception(f"Message is missing required key '{k}': {msg}")
173173

174174
return msg[k]
175175

‎singer/transform.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ def tostr(self):
7777
path = ".".join(map(str, self.path))
7878
if self.schema:
7979
if self.logging_level >= logging.INFO:
80-
msg = "data does not match {}".format(self.schema)
80+
msg = f"data does not match {self.schema}"
8181
else:
82-
msg = "does not match {}".format(self.schema)
82+
msg = f"does not match {self.schema}"
8383
else:
8484
msg = "not in schema"
8585

8686
if self.logging_level >= logging.INFO:
87-
output = "{}: {}".format(path, msg)
87+
output = f"{path}: {msg}"
8888
else:
89-
output = "{}: {} {}".format(path, self.data, msg)
89+
output = f"{path}: {self.data} {msg}"
9090
return output
9191

9292

‎singer/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def chunk(array, num):
105105

106106

107107
def load_json(path):
108-
with open(path) as fil:
108+
with open(path, encoding="utf-8") as fil:
109109
return json.load(fil)
110110

111111

@@ -193,7 +193,7 @@ def parse_args(required_config_keys):
193193
def check_config(config, required_keys):
194194
missing_keys = [key for key in required_keys if key not in config]
195195
if missing_keys:
196-
raise Exception("Config is missing required keys: {}".format(missing_keys))
196+
raise Exception(f"Config is missing required keys: {missing_keys}")
197197

198198

199199
def backoff(exceptions, giveup):

0 commit comments

Comments
 (0)
Please sign in to comment.