Skip to content

Commit 2d91a7b

Browse files
authored
Drop python 2.7 support (#52)
1 parent 8bb6e0e commit 2d91a7b

File tree

19 files changed

+898
-192
lines changed

19 files changed

+898
-192
lines changed

.github/workflows/CI.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, macos-latest, windows-latest]
17-
python-version: ['pypy-2.7', 2.7, 3.6, 'pypy-3.7', 3.7, 'pypy-3.8', 3.8, 3.9] #, '3.10']
17+
python-version: [3.7, 'pypy-3.8', 3.8, 'pypy-3.9', 3.9, '3.10', '3.11']
1818
include:
1919
- os: ubuntu-latest
2020
path: ~/.cache/pip
@@ -23,34 +23,33 @@ jobs:
2323
- os: windows-latest
2424
path: ~\AppData\Local\pip\Cache
2525
exclude:
26-
- os: macos-latest
27-
python-version: 'pypy-2.7'
28-
- os: macos-latest
29-
python-version: 'pypy-3.7'
3026
- os: macos-latest
3127
python-version: 'pypy-3.8'
32-
- os: windows-latest
33-
python-version: 'pypy-2.7'
34-
- os: windows-latest
35-
python-version: 'pypy-3.7'
28+
- os: macos-latest
29+
python-version: 'pypy-3.9'
3630
- os: windows-latest
3731
python-version: 'pypy-3.8'
32+
- os: windows-latest
33+
python-version: 'pypy-3.9'
34+
defaults:
35+
run:
36+
shell: bash
3837

3938
runs-on: ${{ matrix.os }}
4039
env:
4140
PYTHONIOENCODING: UTF-8
4241
steps:
4342
- name: Checkout repo
44-
uses: actions/checkout@v2
43+
uses: actions/checkout@v3
4544

4645
- name: Set Up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v2
46+
uses: actions/setup-python@v4
4847
with:
4948
python-version: ${{ matrix.python-version }}
5049

5150
- name: Cache Install
5251
id: restore-cache
53-
uses: actions/cache@v2
52+
uses: actions/cache@v3
5453
with:
5554
path: |
5655
${{ matrix.path }}
@@ -60,21 +59,20 @@ jobs:
6059
- name: Install Poetry
6160
uses: snok/install-poetry@v1
6261
with:
63-
version: 1.1.12
62+
version: 1.2.2
6463
virtualenvs-create: false
65-
- run: poetry config experimental.new-installer false
6664

6765
- name: Install
68-
run: make install
66+
run: poetry install
6967

7068
- name: Style
7169
if: ${{ ! startsWith(matrix.python-version, 'pypy-') }}
72-
run: make style
70+
run: poetry run flake8 tests/ plotille/ examples/
7371

7472
- name: Tests
75-
run: make tests
73+
run: poetry run pytest -s -vvv
7674

77-
- uses: codecov/codecov-action@v2
75+
- uses: codecov/codecov-action@v3
7876
with:
7977
flags: unittests
8078
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}

.github/workflows/Publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ jobs:
1313

1414
steps:
1515
- name: Checkout repo
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
- name: Set Up Python 3.7
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v4
2020
with:
2121
python-version: 3.7
2222

2323
- name: Install Poetry
2424
uses: snok/install-poetry@v1
2525
with:
26-
version: 1.1.12
26+
version: 1.2.2
2727

2828
- name: Build
2929
run: poetry build -vvv -f sdist
3030

3131
- name: Archive artifacts
32-
uses: actions/upload-artifact@v2
32+
uses: actions/upload-artifact@v3
3333
with:
3434
path: dist/*.tar.gz
3535

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ __pycache__/
1515
dist/
1616
README.rst
1717
.pytest_cache/
18-
poetry.lock
1918
Pipfile.lock
2019
cov_html/
2120
coverage.xml

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: style tests
1+
.PHONY: style tests install
22

33
style:
44
poetry run flake8 tests/ plotille/ examples/
@@ -8,4 +8,3 @@ tests:
88

99
install:
1010
poetry install
11-
poetry run pip install -r tests/requirements.txt

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
[![CI](https://github.com/tammoippen/plotille/actions/workflows/CI.yml/badge.svg)](https://github.com/tammoippen/plotille/actions/workflows/CI.yml)
66
[![codecov](https://codecov.io/gh/tammoippen/plotille/branch/master/graph/badge.svg?token=OGWI832JNM)](https://codecov.io/gh/tammoippen/plotille)
77
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/tammoippen/plotille.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tammoippen/plotille/context:python)
8-
[![Tested CPython Versions](https://img.shields.io/badge/cpython-2.7%2C%203.6%2C%203.7%2C%203.8%2C%203.9-brightgreen.svg)](https://img.shields.io/badge/cpython-2.7%2C%203.6%2C%203.7%2C%203.8%2C%203.8-brightgreen.svg)
9-
[![Tested PyPy Versions](https://img.shields.io/badge/pypy-2.7--7.3%2C%203.7--7.3%2C%203.8--7.3-brightgreen.svg)](https://img.shields.io/badge/pypy-2.7--7.3%2C%203.7--7.3%2C%203.8--7.3-brightgreen.svg)
8+
[![Tested CPython Versions](https://img.shields.io/badge/cpython-3.7%2C%203.8%2C%203.9%2C%203.10%2C%203.11-brightgreen.svg)](https://img.shields.io/badge/cpython-3.7%2C%203.8%2C%203.9%2C%203.10%2C%203.11-brightgreen.svg)
9+
[![Tested PyPy Versions](https://img.shields.io/badge/pypy-3.8%2C%203.9-brightgreen.svg)](https://img.shields.io/badge/pypy-3.8%2C%203.9-brightgreen.svg)
1010
[![PyPi version](https://img.shields.io/pypi/v/plotille.svg)](https://pypi.python.org/pypi/plotille)
1111
[![Downloads](https://pepy.tech/badge/plotille/month)](https://pepy.tech/project/plotille)
1212
[![PyPi license](https://img.shields.io/pypi/l/plotille.svg)](https://pypi.python.org/pypi/plotille)
1313

14-
Plots, scatter plots, histograms and heatmaps in the terminal using braille dots, and foreground and background colors - with (almost) no dependancies. Make complex figures using the Figure class or make fast and simple plots using graphing function - similar to a very small sibling to matplotlib. Or use the canvas to plot dots, lines and images yourself.
14+
Plots, scatter plots, histograms and heatmaps in the terminal using braille dots, and foreground and background colors - with no dependancies. Make complex figures using the Figure class or make fast and simple plots using graphing function - similar to a very small sibling to matplotlib. Or use the canvas to plot dots, lines and images yourself.
1515

1616
Install:
1717

@@ -30,6 +30,8 @@ Basic support for timeseries plotting is provided with release 3.2: for any `X`
3030

3131
Support for heatmaps using background colors for figures and displaying images binary with braille, or in color with background colors using the canvas - provided with release 4.0
3232

33+
If you are still using python 2.7, please use plotille v4 or before. With v5 I am dropping support for python 2.7, as the effort to maintain the discontinued version is too much.
34+
3335
## Documentation
3436

3537
```python

plotille/_canvas.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525

2626
import os
2727

28-
import six
29-
3028
from ._colors import rgb2byte
3129
from ._dots import Dots
3230
from ._util import roundeven
@@ -374,5 +372,5 @@ def plot(self, linesep=os.linesep):
374372
unicode: The canvas as a string.
375373
"""
376374

377-
return linesep.join(''.join(map(six.text_type, row))
375+
return linesep.join(''.join(map(str, row))
378376
for row in reversed(self._canvas))

plotille/_colors.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import os
2828
import sys
2929

30-
import six
31-
3230

3331
def color(text, fg=None, bg=None, mode='names', no_color=False, full_reset=True): # noqa: C901 complex (12)
3432
"""Surround `text` with control characters for coloring
@@ -109,9 +107,9 @@ def color(text, fg=None, bg=None, mode='names', no_color=False, full_reset=True)
109107
elif mode == 'byte':
110108
start = _byte(fg, bg)
111109
elif mode == 'rgb':
112-
if isinstance(fg, six.string_types):
110+
if isinstance(fg, str):
113111
fg = _hex2rgb(fg)
114-
if isinstance(bg, six.string_types):
112+
if isinstance(bg, str):
115113
bg = _hex2rgb(bg)
116114

117115
start = _rgb(fg, bg)
@@ -215,17 +213,17 @@ def _byte(fg, bg):
215213

216214
fg_ = ''
217215
if fg is not None:
218-
fg_ = '38;5;' + six.text_type(fg)
216+
fg_ = '38;5;' + str(fg)
219217
bg_ = ''
220218
if bg is not None:
221-
bg_ = '48;5;' + six.text_type(bg)
219+
bg_ = '48;5;' + str(bg)
222220

223221
return _join_codes(fg_, bg_)
224222

225223

226224
def _hex2rgb(h):
227225
"""Transform rgb hex representation into rgb tuple of ints representation"""
228-
assert isinstance(h, six.string_types)
226+
assert isinstance(h, str)
229227
if h.lower().startswith('0x'):
230228
h = h[2:]
231229
if len(h) == 3:
@@ -248,10 +246,10 @@ def _rgb(fg, bg):
248246

249247
fg_ = ''
250248
if fg is not None:
251-
fg_ = '38;2;' + ';'.join(map(six.text_type, fg))
249+
fg_ = '38;2;' + ';'.join(map(str, fg))
252250
bg_ = ''
253251
if bg is not None:
254-
bg_ = '48;2;' + ';'.join(map(six.text_type, bg))
252+
bg_ = '48;2;' + ';'.join(map(str, bg))
255253

256254
return _join_codes(fg_, bg_)
257255

plotille/_dots.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2424
# THE SOFTWARE.
2525

26-
import six
27-
2826
from ._colors import color
2927

3028
# I plot upside down, hence the different order
@@ -99,7 +97,7 @@ def marker(self):
9997

10098
@marker.setter
10199
def marker(self, value):
102-
assert value is None or isinstance(value, six.string_types)
100+
assert value is None or isinstance(value, str)
103101
assert value is None or len(value) == 1
104102
self._marker = value
105103

@@ -113,7 +111,7 @@ def __str__(self):
113111
if self.marker:
114112
res = self.marker
115113
else:
116-
res = six.unichr(0x2800 + self._dots)
114+
res = chr(0x2800 + self._dots)
117115

118116
return color(res, fg=self.fg, bg=self.bg, **self.color_kwargs)
119117

@@ -161,7 +159,7 @@ def braille_from(dots):
161159

162160
code = 0x2800 + int(''.join(bin_code), 2)
163161

164-
return six.unichr(code)
162+
return chr(code)
165163

166164

167165
def dots_from(braille):
@@ -178,7 +176,7 @@ def dots_from(braille):
178176
"""
179177
assert 0x2800 <= ord(braille) <= 0x28ff
180178

181-
code = six.text_type(bin(ord(braille) - 0x2800))[2:].rjust(8, '0')
179+
code = str(bin(ord(braille) - 0x2800))[2:].rjust(8, '0')
182180

183181
dots = []
184182
for i, c in enumerate(code):

plotille/_figure.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
from itertools import cycle
2828
import os
2929

30-
from six.moves import zip
31-
3230
from ._canvas import Canvas
3331
from ._colors import color, rgb2byte
3432
from ._figure_data import Heat, Histogram, Plot, Span, Text

plotille/_figure_data.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2424
# THE SOFTWARE.
2525

26-
import six
27-
from six.moves import zip
28-
2926
from . import _cmaps
3027
from ._util import hist
3128

@@ -186,15 +183,15 @@ def __init__(self, X, cmap=None):
186183
for RGB data.
187184
"""
188185
assert len(X)
189-
assert cmap is None or isinstance(cmap, six.string_types) or isinstance(cmap, _cmaps.Colormap)
186+
assert cmap is None or isinstance(cmap, (str, _cmaps.Colormap))
190187
len_first = len(X[0])
191188
assert all(len(x) == len_first for x in X)
192189
self._X = X
193190

194191
if cmap is None:
195192
cmap = 'viridis'
196193

197-
if isinstance(cmap, six.string_types):
194+
if isinstance(cmap, str):
198195
cmap = _cmaps.cmaps[cmap]()
199196
self.cmap = cmap
200197

0 commit comments

Comments
 (0)