Skip to content

Commit 2c37207

Browse files
authored
Dependency cleanup (#666) fixes #663
* fix dependency issues * remove py36 test
1 parent b271251 commit 2c37207

File tree

10 files changed

+15
-33
lines changed

10 files changed

+15
-33
lines changed

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.6, 3.7, 3.8, 3.9]
18+
python-version: [3.7, 3.8, 3.9]
1919
steps:
2020
- uses: actions/checkout@v2
2121
- name: Set up Python ${{ matrix.python-version }}

setup.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,10 @@ def run(self):
4343
f.write('\n__version__ = "{}"\n'.format(version_git))
4444

4545
requirements = [
46-
'six',
4746
'numpy',
48-
'protobuf >= 3.8.0',
47+
'protobuf >= 3.8.0, <=3.20.1',
4948
]
5049

51-
test_requirements = [
52-
'future'
53-
'pytest',
54-
'matplotlib',
55-
'crc32c',
56-
]
5750

5851
setup(
5952
name='tensorboardX',
@@ -74,16 +67,14 @@ def run(self):
7467
'License :: OSI Approved :: MIT License',
7568
'Natural Language :: English',
7669
'Programming Language :: Python :: 3',
77-
'Programming Language :: Python :: 3.6',
7870
'Programming Language :: Python :: 3.7',
7971
'Programming Language :: Python :: 3.8',
72+
'Programming Language :: Python :: 3.9',
8073
],
8174
cmdclass={
8275
'develop': PostDevelopCommand,
8376
'install': PostInstallCommand,
8477
},
85-
test_suite='tests',
86-
tests_require=test_requirements
8778
)
8879

8980

tensorboardX/caffe2_graph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import logging
88
import os
99
import re
10-
import six
1110

1211
from builtins import bytes
1312
from caffe2.proto import caffe2_pb2
@@ -166,7 +165,7 @@ def _remap_keys(old_dict, rename_fn):
166165
None. Modifies old_dict in-place.
167166
'''
168167
new_dict = {rename_fn(key): value for key,
169-
value in six.iteritems(old_dict)}
168+
value in old_dict.items()}
170169
old_dict.clear()
171170
old_dict.update(new_dict)
172171

tensorboardX/event_file_writer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import threading
2424
import time
2525
import multiprocessing
26-
import six
26+
import queue
2727

2828
from .proto import event_pb2
2929
from .record_writer import RecordWriter, directory_check
@@ -207,7 +207,7 @@ def run(self):
207207
return
208208
self._record_writer.write_event(data)
209209
self._has_pending_data = True
210-
except six.moves.queue.Empty:
210+
except queue.Empty:
211211
pass
212212

213213
now = time.time()

tensorboardX/summary.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import re as _re
99

1010
# pylint: disable=unused-import
11-
from six.moves import range
1211

1312
from .proto.summary_pb2 import Summary
1413
from .proto.summary_pb2 import HistogramProto
@@ -70,7 +69,6 @@ def _draw_single_box(image, xmin, ymin, xmax, ymax, display_str, color='black',
7069
def hparams(hparam_dict=None, metric_dict=None):
7170
from tensorboardX.proto.plugin_hparams_pb2 import HParamsPluginData, SessionEndInfo, SessionStartInfo
7271
from tensorboardX.proto.api_pb2 import Experiment, HParamInfo, MetricInfo, MetricName, Status, DataType
73-
from six import string_types
7472

7573
PLUGIN_NAME = 'hparams'
7674
PLUGIN_DATA_VERSION = 0
@@ -91,7 +89,7 @@ def hparams(hparam_dict=None, metric_dict=None):
9189
if v is None:
9290
continue
9391

94-
if isinstance(v, string_types):
92+
if isinstance(v, str):
9593
ssi.hparams[k].string_value = v
9694
hps.append(HParamInfo(name=k, type=DataType.Value("DATA_TYPE_STRING")))
9795
continue

tensorboardX/torchvis.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import unicode_literals
55

66
import gc
7-
import six
87
import time
98

109
from functools import wraps
@@ -43,15 +42,15 @@ def unregister(self, *args):
4342
gc.collect()
4443

4544
def __getattr__(self, attr):
46-
for _, subscriber in six.iteritems(self.subscribers):
45+
for _, subscriber in self.subscribers.items():
4746
def wrapper(*args, **kwargs):
48-
for _, subscriber in six.iteritems(self.subscribers):
47+
for _, subscriber in self.subscribers.items():
4948
if hasattr(subscriber, attr):
5049
getattr(subscriber, attr)(*args, **kwargs)
5150
return wrapper
5251
raise AttributeError
5352

5453
# Handle writer management (open/close) for the user
5554
def __del__(self):
56-
for _, subscriber in six.iteritems(self.subscribers):
55+
for _, subscriber in self.subscribers.items():
5756
subscriber.close()

tensorboardX/writer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import json
99
import os
1010
import numpy
11-
import six
1211
import time
1312
import logging
1413
import atexit
@@ -337,7 +336,7 @@ def _check_caffe2_blob(self, item):
337336
workspace.FetchBlob(blob_name)
338337
workspace.FetchBlobs([blob_name1, blob_name2, ...])
339338
"""
340-
return isinstance(item, six.string_types)
339+
return isinstance(item, str)
341340

342341
def _get_file_writer(self):
343342
"""Returns the default FileWriter instance. Recreates it if closed."""
@@ -558,7 +557,7 @@ def add_histogram(
558557
"""
559558
if self._check_caffe2_blob(values):
560559
values = workspace.FetchBlob(values)
561-
if isinstance(bins, six.string_types) and bins == 'tensorflow':
560+
if isinstance(bins, str) and bins == 'tensorflow':
562561
bins = self.default_bins
563562
self._get_file_writer().add_summary(
564563
histogram(tag, values, bins, max_bins=max_bins), global_step, walltime)

tensorboardX/x2num.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import logging
77
import numpy as np
8-
import six
98
logger = logging.getLogger(__name__)
109

1110

@@ -21,7 +20,7 @@ def make_np(x):
2120
return check_nan(np.array(x))
2221
if isinstance(x, np.ndarray):
2322
return check_nan(x)
24-
if isinstance(x, six.string_types): # Caffe2 will pass name of blob(s) to fetch
23+
if isinstance(x, str): # Caffe2 will pass name of blob(s) to fetch
2524
return check_nan(prepare_caffe2(x))
2625
if np.isscalar(x):
2726
return check_nan(np.array([x]))

test-requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
flake8
22
pytest
33
torch
4-
six
5-
protobuf==3.15
4+
torchvision
5+
protobuf==3.20.1
66
numpy==1.21.0
7-
pillow
87
tensorboard
98
boto3
10-
future
119
matplotlib
1210
moto
1311
soundfile

tests/record_writer_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from __future__ import division
2020
from __future__ import print_function
2121

22-
import six
2322
import os
2423
from tensorboardX.record_writer import RecordWriter
2524
from tensorboard.compat.tensorflow_stub.pywrap_tensorflow import PyRecordReader_New

0 commit comments

Comments
 (0)