Skip to content

Commit

Permalink
drop py<=3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Mar 3, 2023
1 parent f75e742 commit a587f30
Show file tree
Hide file tree
Showing 36 changed files with 309 additions and 476 deletions.
5 changes: 1 addition & 4 deletions .meta/.readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,7 @@ Returns
"""Registers the current `tqdm` class with `pandas`."""
def trange(*args, **tqdm_kwargs):
"""
A shortcut for `tqdm(xrange(*args), **tqdm_kwargs)`.
On Python3+, `range` is used instead of `xrange`.
"""
"""Shortcut for `tqdm(range(*args), **tqdm_kwargs)`."""
Convenience Functions
~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion .meta/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pre-commit
pytest
pytest-asyncio
pytest-cov
pytest-timeout
nbval
ipywidgets
# py>=37: pytest-asyncio
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ However it would be helpful to bear in mind:
* use two spaces between variable name and colon, specify a type, and most likely state that it's optional: `VAR<space><space>:<space>TYPE[, optional]`
* use [default: ...] for default values of keyword arguments
+ will not break backward compatibility unless there is a very good reason
* e.g. breaking py26 compatibility purely in favour of readability (such as converting `dict(a=1)` to `{'a': 1}`) is not a good enough reason
* e.g. breaking py26 compatibility purely in favour of minor readability changes (such as converting `dict(a=1)` to `{'a': 1}`) is not a good enough reason
+ API changes should be discussed carefully
+ remember, with millions of downloads per month, `tqdm` must be extremely fast and reliable
- Any other kind of change may be included in a (possibly new) submodule
Expand Down
2 changes: 1 addition & 1 deletion DEMO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"metadata": {},
"source": [
"`trange(N)` can be also used as a convenient shortcut for\n",
"`tqdm(xrange(N))`."
"`tqdm(range(N))`."
]
},
{
Expand Down
9 changes: 2 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,7 @@ Parameters
* unit_divisor : float, optional
[default: 1000], ignored unless ``unit_scale`` is True.
* write_bytes : bool, optional
If (default: None) and ``file`` is unspecified,
bytes will be written in Python 2. If ``True`` will also write
bytes. In all other cases will default to unicode.
Whether to write bytes. If (default: False) will write unicode.
* lock_args : tuple, optional
Passed to ``refresh`` for intermediate output
(initialisation, iterating, and updating).
Expand Down Expand Up @@ -631,10 +629,7 @@ Returns
"""Registers the current `tqdm` class with `pandas`."""
def trange(*args, **tqdm_kwargs):
"""
A shortcut for `tqdm(xrange(*args), **tqdm_kwargs)`.
On Python3+, `range` is used instead of `xrange`.
"""
"""Shortcut for `tqdm(range(*args), **tqdm_kwargs)`."""
Convenience Functions
~~~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 1 addition & 4 deletions benchmarks/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ def __init__(self, length):
except ImportError:
from time import clock
self.time = clock
try:
self.iterable = xrange(int(length))
except NameError:
self.iterable = range(int(length))
self.iterable = range(int(length))

def run(self, cls):
pbar = cls(self.iterable)
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
- defaults
dependencies:
# base
- python=3
- python >=3.7
- pip
- ipykernel
- ipywidgets
Expand All @@ -20,7 +20,7 @@ dependencies:
- pytest
- pytest-cov
- pytest-timeout
- pytest-asyncio # [py>=3.7]
- pytest-asyncio
- nbval
- coverage
# extras
Expand Down
11 changes: 3 additions & 8 deletions examples/parallel_bars.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import print_function

import sys
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from multiprocessing import Pool, RLock, freeze_support
Expand All @@ -12,7 +11,6 @@
from tqdm.contrib.concurrent import process_map, thread_map

NUM_SUBITERS = 9
PY2 = sys.version_info[:1] <= (2,)


def progresser(n, auto_position=True, write_safe=False, blocking=True, progress=False):
Expand All @@ -37,7 +35,7 @@ def progresser(n, auto_position=True, write_safe=False, blocking=True, progress=
L = list(range(NUM_SUBITERS))[::-1]

print("Simple thread mapping")
thread_map(partial(progresser, write_safe=not PY2), L, max_workers=4)
thread_map(partial(progresser, write_safe=True), L, max_workers=4)

print("Simple process mapping")
process_map(partial(progresser), L, max_workers=4)
Expand All @@ -54,8 +52,5 @@ def progresser(n, auto_position=True, write_safe=False, blocking=True, progress=

print("Multi-threading")
tqdm.set_lock(TRLock())
pool_args = {}
if not PY2:
pool_args.update(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),))
with ThreadPoolExecutor(**pool_args) as p:
p.map(partial(progresser, progress=True, write_safe=not PY2, blocking=False), L)
with ThreadPoolExecutor(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),)) as p:
p.map(partial(progresser, progress=True, write_safe=True, blocking=False), L)
7 changes: 3 additions & 4 deletions examples/simple_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Simple tqdm examples and profiling
# Benchmark
for i in _range(int(1e8)):
for i in range(int(1e8)):
pass
# Basic demo
Expand Down Expand Up @@ -33,7 +33,7 @@
except ImportError:
pass
else:
for i in ProgressBar()(_range(int(1e8))):
for i in ProgressBar()(range(int(1e8))):
pass
# Dynamic miniters benchmark
Expand Down Expand Up @@ -61,5 +61,4 @@
stmts = filter(None, re.split(r'\n\s*#.*?\n', __doc__))
for s in stmts:
print(s.replace('import tqdm\n', ''))
print(timeit(stmt='try:\n\t_range = xrange'
'\nexcept:\n\t_range = range\n' + s, number=1), 'seconds')
print(timeit(stmt=s, number=1), 'seconds')
5 changes: 1 addition & 4 deletions examples/tqdm_wget.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
The local file path in which to save the url [default: /dev/null].
"""

try:
from urllib import request as urllib
except ImportError: # py2
import urllib
from os import devnull
from urllib import request as urllib

from docopt import docopt

Expand Down
12 changes: 3 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ classifiers=
Operating System :: POSIX :: SunOS/Solaris
Operating System :: Unix
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation
Programming Language :: Python :: Implementation :: IronPython
Programming Language :: Python :: Implementation :: PyPy
Expand All @@ -75,10 +73,9 @@ classifiers=
Topic :: Utilities
[options]
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
python_requires=>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
python_requires=>=3.7
install_requires=
colorama; platform_system == 'Windows'
importlib_resources; python_version < "3.7"
tests_require=tox
include_package_data=True
packages=find:
Expand All @@ -93,9 +90,6 @@ console_scripts=
[options.packages.find]
exclude=benchmarks, tests

[bdist_wheel]
universal=1

[flake8]
max_line_length=99
exclude=.asv,.eggs,.tox,.ipynb_checkpoints,build,dist,.git,__pycache__
Expand Down
12 changes: 0 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,3 @@ def pretest_posttest():
tqdm._instances.clear()
raise EnvironmentError(
"{0} `tqdm` instances still in existence POST-test".format(n))


if sys.version_info[0] > 2:
@fixture
def capsysbin(capsysbinary):
"""alias for capsysbinary (py3)"""
return capsysbinary
else:
@fixture
def capsysbin(capsys):
"""alias for capsys (py2)"""
return capsys
128 changes: 0 additions & 128 deletions tests/py37_asyncio.py

This file was deleted.

Loading

0 comments on commit a587f30

Please sign in to comment.