diff --git a/setup.cfg b/setup.cfg index bf5ba63c..59a6ebbb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,7 +8,7 @@ ignore = [metadata] requires-dist = - tqdm >= 4.11 + tqdm >= 4.14 requests >= 2.5.0, != 2.15, != 2.16 requests-toolbelt >= 0.8.0 pkginfo >= 1.0 diff --git a/setup.py b/setup.py index 8febeb11..25f04bdc 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ install_requires = [ - "tqdm >= 4.11", + "tqdm >= 4.14", "pkginfo >= 1.0", "requests >= 2.5.0, != 2.15, != 2.16", "requests-toolbelt >= 0.8.0", diff --git a/twine/repository.py b/twine/repository.py index 7aeebcd2..5774a4be 100644 --- a/twine/repository.py +++ b/twine/repository.py @@ -34,14 +34,13 @@ class ProgressBar(tqdm): - def update_to(self, n): """Update the bar in the way compatible with requests-toolbelt. This is identical to tqdm.update, except ``n`` will be the current value - not the delta as tqdm expects. """ - self.update(n - self.n) + self.update(n - self.n) # will also do self.n = n class Repository(object): @@ -136,8 +135,9 @@ def _upload(self, package): (package.basefilename, fp, "application/octet-stream"), )) encoder = MultipartEncoder(data_to_send) - with ProgressBar(total=encoder.len, unit='bytes', - unit_scale=True, leave=False) as bar: + with ProgressBar(total=encoder.len, + unit='B', unit_scale=True, unit_divisor=1024, + miniters=1) as bar: monitor = MultipartEncoderMonitor( encoder, lambda monitor: bar.update_to(monitor.bytes_read) )