Skip to content

Commit bac223f

Browse files
authored
Merge pull request #282 from mattip/cleanup3
update version to 0.5.1 and cleanup
2 parents 506ab69 + 072849c commit bac223f

12 files changed

Lines changed: 46 additions & 69 deletions

File tree

‎.github/workflows/cibuildwheel.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ jobs:
3838
CIBW_ARCHS_LINUX: auto aarch64
3939
# cp3*t-*: free-threaded CPython is built by default since
4040
# cibuildwheel 4, but vmprof does not support it
41-
CIBW_SKIP: "pp* cp3*t-* *-win32 *-manylinux_i686 *musllinux*"
41+
CIBW_SKIP: "cp3*t-* *-win32 *-manylinux_i686 *musllinux*"
4242
CIBW_BEFORE_BUILD_LINUX: dnf install -y libunwind-devel
43-
CIBW_BEFORE_TEST: pip install -r test_requirements.txt
43+
CIBW_TEST_GROUPS: test
4444
CIBW_TEST_COMMAND: cd {package} && pytest vmprof jitlog -vv
4545
CIBW_TEST_COMMAND_WINDOWS: cd /d {package} && pytest vmprof jitlog -vv
4646
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x}"
@@ -78,7 +78,8 @@ jobs:
7878
- name: Test wheel
7979
run: |
8080
FAILED=false
81-
pypy -m pip install -r test_requirements.txt build
81+
pypy -m pip install --upgrade pip
82+
pypy -m pip install --group test build
8283
pypy -m pytest vmprof -v || FAILED=true
8384
pypy -m pytest jitlog -v || FAILED=true
8485
if [ "$FAILED" == true ]; then exit 1; fi

‎.github/workflows/tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: |
4444
python -m pip install --upgrade pip
4545
python -m pip install .
46-
python -m pip install -r test_requirements.txt
46+
python -m pip install --group test
4747
- name: Display Python version
4848
run: python -c "import sys; print(sys.version)"
4949
- name: Run Tests

‎dev_requirements.txt‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎meson.build‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('vmprof', 'c',
2-
version: '0.5.0',
2+
version: '0.5.1',
33
license: 'MIT',
44
meson_version: '>=1.1.0',
55
)

‎pyproject.toml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ authors = [
1515
requires-python = ">=3.9,<3.16"
1616
dependencies = [
1717
"requests",
18-
"six",
1918
"colorama",
2019
]
2120
classifiers = [
@@ -32,5 +31,12 @@ Documentation = "https://vmprof.readthedocs.org/"
3231
[project.scripts]
3332
vmprofshow = "vmprof.show:main"
3433

34+
[dependency-groups]
35+
test = [
36+
"pytest",
37+
"cffi",
38+
"setuptools>=77",
39+
]
40+
3541
[tool.meson-python.args]
3642
setup = ["--vsenv"]

‎test_requirements.txt‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎vmprof/cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import argparse
44
import sys
5-
from six.moves import configparser
5+
import configparser
66

77

88
def build_argparser():

‎vmprof/reader.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import os
33
import struct
44
import sys
5-
from six.moves import xrange
65
import io
76
import gzip
87
import datetime
@@ -209,12 +208,12 @@ def read_trace(self, depth):
209208
kinds_and_pcs = self.read_addresses(depth * 2)
210209
# kinds_and_pcs is a list of [kind1, pc1, kind2, pc2, ...]
211210
return [wrap_kind(kinds_and_pcs[i], kinds_and_pcs[i+1])
212-
for i in xrange(0, len(kinds_and_pcs), 2)]
211+
for i in range(0,len(kinds_and_pcs), 2)]
213212
else:
214213
trace = self.read_addresses(depth)
215214

216215
if self.state.profile_lines:
217-
for i in xrange(0, len(trace), 2):
216+
for i in range(0,len(trace), 2):
218217
# In the line profiling mode even items in the trace are line numbers.
219218
# Every line number corresponds to the following frame, represented by an address.
220219
trace[i] = -trace[i]

‎vmprof/show.py‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import inspect
44
import linecache
55
import os
6-
import six
76
import sys
87
import tokenize
98
import vmprof
@@ -13,15 +12,15 @@
1312
from vmprof.stats import EmptyProfileFile
1413

1514

16-
class color(six.text_type):
15+
class color(str):
1716
RED = '\033[31m'
1817
WHITE = '\033[37m'
1918
BLUE = '\033[94m'
2019
BOLD = '\033[1m'
2120
END = '\033[0m'
2221

2322
def __new__(cls, content, color, bold=False):
24-
return six.text_type.__new__(
23+
return str.__new__(
2524
cls, "%s%s%s%s" % (color, cls.BOLD if bold else "", content, cls.END))
2625

2726
class AbstractPrinter(object):
@@ -81,7 +80,7 @@ def _walk_tree(self, parent, node, level, callback):
8180
level += 1
8281
if level > self._prune_level:
8382
return
84-
for c in six.itervalues(node.children):
83+
for c in node.children.values():
8584
self._walk_tree(node, c, level, callback)
8685

8786
color = color
@@ -140,7 +139,7 @@ def _print_tree(self, tree):
140139
partial(self._print_node, total=float(tree.count)))
141140

142141

143-
class html_color(six.text_type):
142+
class html_color(str):
144143
RED = 'red'
145144
WHITE = 'black'
146145
BLUE = 'blue'
@@ -172,7 +171,7 @@ def _walk_tree(self, parent, node, level, callback):
172171
level += 1
173172
if level > self._prune_level:
174173
return
175-
for c in six.itervalues(node.children):
174+
for c in node.children.values():
176175
self._walk_tree(node, c, level, callback)
177176
print("</details>")
178177

@@ -218,7 +217,7 @@ def _show(self, tree):
218217

219218
def _walk_tree(self, parent, node, callback):
220219
callback(parent, node)
221-
for c in six.itervalues(node.children):
220+
for c in node.children.values():
222221
self._walk_tree(node, c, callback)
223222

224223
def _print_tree(self, tree):
@@ -235,7 +234,7 @@ def collect_node(parent, node):
235234
0 if parse_block_name(ch.name)[0] == 'n' and self.no_native
236235
else ch.count
237236

238-
for ch in six.itervalues(node.children))
237+
for ch in node.children.values())
239238

240239
func_id_to_count[ndescr] = func_id_to_count.get(ndescr, 0) + mycount
241240

@@ -284,15 +283,15 @@ def walk(node, d):
284283
# only python supported for line profiling
285284
if block_type == 'py':
286285
lines = d.setdefault((filename, int(funline), funname), {})
287-
for l, cnt in six.iteritems(node.lines):
286+
for l, cnt in node.lines.items():
288287
lines[l] = lines.get(l, 0) + cnt
289288

290-
for c in six.itervalues(node.children):
289+
for c in node.children.values():
291290
walk(c, d)
292291

293292
walk(tree, funcs)
294293

295-
return six.iteritems(funcs)
294+
return funcs.items()
296295

297296
def show_func(self, filename, start_lineno, func_name, timings, stream=None, stripzeros=False):
298297
""" Show results for a single function.
@@ -305,7 +304,7 @@ def show_func(self, filename, start_lineno, func_name, timings, stream=None, str
305304
total_hits = 0.0
306305

307306
linenos = []
308-
for lineno, nhits in six.iteritems(timings):
307+
for lineno, nhits in timings.items():
309308
total_hits += nhits
310309
linenos.append(lineno)
311310

@@ -338,7 +337,7 @@ def show_func(self, filename, start_lineno, func_name, timings, stream=None, str
338337
# Fake empty lines so we can see the timings, if not the code.
339338
nlines = max(linenos) - min(min(linenos), start_lineno) + 1
340339
sublines = [''] * nlines
341-
for lineno, nhits in six.iteritems(timings):
340+
for lineno, nhits in timings.items():
342341
d[lineno] = (nhits, '%5.1f' % (100* nhits / total_hits))
343342
linenos = range(start_lineno, start_lineno + len(sublines))
344343
empty = ('', '')

‎vmprof/stats.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import six
21
from vmprof.reader import AssemblerCode, JittedCode, NativeCode
32

43
class EmptyProfileFile(Exception):
@@ -77,7 +76,7 @@ def generate_top(self):
7776
current_iter[addr] = None
7877

7978
def top_profile(self):
80-
return [(self._get_name(k), v) for (k, v) in six.iteritems(self.functions)]
79+
return [(self._get_name(k), v) for (k, v) in self.functions.items()]
8180

8281
def _get_name(self, addr):
8382
if self.adr_dict is not None:
@@ -203,29 +202,29 @@ def as_json(self):
203202
return json.dumps(self._serialize())
204203

205204
def _serialize(self):
206-
chld = [ch._serialize() for ch in six.itervalues(self.children)]
205+
chld = [ch._serialize() for ch in self.children.values()]
207206
# if we don't make str() of addr here, JS does its
208207
# int -> float -> int losy convertion without
209208
# any warning
210209
return [self.name, str(self.addr), self.count, self.meta, chld]
211210

212211
def _rec_count(self):
213212
c = 1
214-
for x in six.itervalues(self.children):
213+
for x in self.children.values():
215214
c += x._rec_count()
216215
return c
217216

218217
def walk(self, callback):
219218
callback(self)
220-
for c in six.itervalues(self.children):
219+
for c in self.children.values():
221220
c.walk(callback)
222221

223222
def cumulative_meta(self, d=None):
224223
if d is None:
225224
d = {}
226-
for c in six.itervalues(self.children):
225+
for c in self.children.values():
227226
c.cumulative_meta(d)
228-
for k, v in six.iteritems(self.meta):
227+
for k, v in self.meta.items():
229228
d[k] = d.get(k, 0) + v
230229
return d
231230

@@ -241,7 +240,7 @@ def get_self_count(self):
241240
if self._self_count is not None:
242241
return self._self_count
243242
self._self_count = self.count
244-
for elem in six.itervalues(self.children):
243+
for elem in self.children.values():
245244
self._self_count -= elem.count
246245
return self._self_count
247246

0 commit comments

Comments
 (0)