Skip to content

Commit c93bbed

Browse files
committed
Drop Python 2 support, Python 3.6 is now required, bump version to 2.0.0-dev
1 parent 301c5fc commit c93bbed

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
13+
python-version: [3.6, 3.7, 3.8]
1414

1515
steps:
1616

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# gitchart ChangeLog
22

3-
## Version 1.6.0 (under dev)
3+
## Version 2.0.0 (under dev)
44

5+
- Drop Python 2 support, Python 3.6 is now required.
56
- Convert README and ChangeLog to markdown.
67

78
## Version 1.5 (2020-03-07)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ It can build following charts, as SVG or PNG:
1616

1717
Gitchart requires:
1818

19-
- Python ≥ 2.7
19+
- Python ≥ 3.6
2020
- http://pygal.org/[Pygal] (`pip install pygal`)
2121

2222
Optional dependencies:

gitchart.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
1+
#!/usr/bin/env python3
32
#
43
# Copyright (C) 2013-2020 Sébastien Helleu <[email protected]>
54
#
@@ -38,8 +37,6 @@
3837
files_type | pie | files by type (extension) | -
3938
"""
4039

41-
from __future__ import division, print_function
42-
4340
import argparse
4441
import datetime
4542
import os
@@ -51,7 +48,7 @@
5148

5249
import pygal
5350

54-
VERSION = '1.6.0-dev'
51+
VERSION = '2.0.0-dev'
5552

5653
ISSUES_REGEX_DEFAULT = re.compile(
5754
r'(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved)'
@@ -194,12 +191,12 @@ def _chart_authors(self):
194191
(number, name) = author.strip(' ').split('\t', 1)
195192
count += 1
196193
if self.max_diff <= 0 or count <= self.max_diff:
197-
pie_chart.add(name + ' ({0})'.format(number), int(number))
194+
pie_chart.add(name + f' ({number})', int(number))
198195
else:
199196
count_others += 1
200197
sum_others += int(number)
201198
if count_others:
202-
pie_chart.add('{0} others ({1})'.format(count_others, sum_others),
199+
pie_chart.add(f'{count_others} others ({sum_others})',
203200
sum_others)
204201
self._render(pie_chart)
205202
return True
@@ -229,12 +226,12 @@ def _chart_tickets_author(self):
229226
reverse=True):
230227
count += 1
231228
if self.max_diff <= 0 or count <= self.max_diff:
232-
pie_chart.add(name + ' ({0})'.format(number), number)
229+
pie_chart.add(name + f' ({number})', number)
233230
else:
234231
count_others += 1
235232
sum_others += int(number)
236233
if count_others:
237-
pie_chart.add('{0} others ({1})'.format(count_others, sum_others),
234+
pie_chart.add(f'{count_others} others ({sum_others})',
238235
sum_others)
239236
self._render(pie_chart)
240237
return True
@@ -243,7 +240,7 @@ def _chart_commits_hour_day(self):
243240
"""Generate bar chart with commits by hour of day."""
244241
# format of lines in stdout: 2013-03-15 18:27:55 +0100
245242
stdout = self._git_command_log(['--date=iso', '--pretty=format:%ad'])
246-
commits = {'{0:02d}'.format(hour): 0 for hour in range(0, 24)}
243+
commits = {f'{hour:02d}': 0 for hour in range(0, 24)}
247244
for line in stdout:
248245
commits[line.split()[1].split(':')[0]] += 1
249246
self._generate_bar_chart(commits)
@@ -253,14 +250,14 @@ def _chart_commits_hour_week(self):
253250
"""Generate dot chart with commits by hour of week."""
254251
# format of lines in stdout: Fri, 15 Mar 2013 18:27:55 +0100
255252
stdout = self._git_command_log(['--date=rfc', '--pretty=format:%ad'])
256-
commits = {day: {'{0:02d}'.format(hour): 0 for hour in range(0, 24)}
253+
commits = {day: {f'{hour:02d}': 0 for hour in range(0, 24)}
257254
for day in self.weekdays}
258255
for line in stdout:
259256
wday, _, _, _, hour, _ = line.split()
260257
commits[wday[:-1]][hour.split(':')[0]] += 1
261258
dot_chart = pygal.Dot(style=self.style, js=self.javascript)
262259
dot_chart.title = self.title
263-
dot_chart.x_labels = ['{0:02d}'.format(hh) for hh in range(0, 24)]
260+
dot_chart.x_labels = [f'{hh:02d}' for hh in range(0, 24)]
264261
for day in self.weekdays:
265262
dot_chart.add(day, commits[day])
266263
self._render(dot_chart)
@@ -325,12 +322,12 @@ def _chart_commits_year_month(self):
325322
date = (int(year) * 100) + int(month)
326323
min_date = min(min_date, date)
327324
max_date = max(max_date, date)
328-
year_month = '{0}-{1}'.format(year, month)
325+
year_month = f'{year}-{month}'
329326
commits[year_month] = commits.get(year_month, 0) + 1
330327
if min_date != 999999:
331328
date = min_date
332329
while date < max_date:
333-
year_month = '{0:04d}-{1:02d}'.format(date // 100, date % 100)
330+
year_month = f'{date // 100:04d}-{date % 100:02d}'
334331
commits[year_month] = commits.get(year_month, 0)
335332
if date % 100 == 12:
336333
# next year, for example: 201312 => 201401 (+89)
@@ -380,13 +377,13 @@ def _chart_files_type(self):
380377
for ext in sorted(extensions, key=extensions.get, reverse=True):
381378
count += 1
382379
if self.max_diff <= 0 or count <= self.max_diff:
383-
pie_chart.add(ext + ' ({0})'.format(extensions[ext]),
380+
pie_chart.add(ext + f' ({extensions[ext]})',
384381
extensions[ext])
385382
else:
386383
count_others += 1
387384
sum_others += extensions[ext]
388385
if count_others:
389-
pie_chart.add('{0} others ({1})'.format(count_others, sum_others),
386+
pie_chart.add(f'{count_others} others ({sum_others})',
390387
sum_others)
391388
self._render(pie_chart)
392389
return True
@@ -457,11 +454,11 @@ def main():
457454
'-j', '--js',
458455
default=','.join(pygal_config.js),
459456
help='comma-separated list of javascript files/links used in SVG')
457+
charts = ', '.join(sorted(GitChart.charts))
460458
parser.add_argument(
461459
'chart',
462460
metavar='chart', choices=sorted(GitChart.charts),
463-
help='{0}: {1}'.format('name of chart, one of',
464-
', '.join(sorted(GitChart.charts))))
461+
help=f'name of chart, one of: {charts}')
465462
parser.add_argument(
466463
'output',
467464
help=('output file (svg or png), special value "-" displays SVG '

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# Copyright (C) 2013-2020 Sébastien Helleu <[email protected]>
43
#
@@ -43,7 +42,7 @@
4342

4443
setup(
4544
name='gitchart',
46-
version='1.6.0-dev',
45+
version='2.0.0-dev',
4746
description=DESCRIPTION,
4847
long_description=readme,
4948
long_description_content_type='text/markdown',
@@ -61,7 +60,6 @@
6160
'Natural Language :: English',
6261
'Operating System :: OS Independent',
6362
'Programming Language :: Python',
64-
'Programming Language :: Python :: 2',
6563
'Programming Language :: Python :: 3',
6664
'Topic :: Software Development :: Version Control',
6765
],

0 commit comments

Comments
 (0)