diff options
-rw-r--r-- | .pre-commit-config.yaml | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rw-r--r-- | environment.yml | 4 | ||||
-rw-r--r-- | pyproject.toml | 1 | ||||
-rw-r--r-- | tests/tests_asyncio.py | 12 | ||||
-rw-r--r-- | tox.ini | 3 | ||||
-rw-r--r-- | tqdm/cli.py | 5 | ||||
-rw-r--r-- | tqdm/utils.py | 2 |
8 files changed, 20 insertions, 11 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5eb5e3c..34c8344 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: - pytest-timeout - pytest-asyncio - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8 args: [-j8] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 533a8ab..6f8f2a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -99,7 +99,7 @@ Note: to install all versions of the Python interpreter that are specified in [tox.ini](https://github.com/tqdm/tqdm/blob/master/tox.ini), you can use `MiniConda` to install a minimal setup. You must also ensure that each distribution has an alias to call the Python interpreter -(e.g. `python311` for Python 3.11's interpreter). +(e.g. `python312` for Python 3.12's interpreter). ### Alternative unit tests with pytest diff --git a/environment.yml b/environment.yml index e2e6b95..a8347fe 100644 --- a/environment.yml +++ b/environment.yml @@ -38,10 +38,10 @@ dependencies: - build # `python -m build` # `cd docs && pymake` - mkdocs-material -- pydoc-markdown - pygments - pymdown-extensions - pip: - py-make >=0.1.0 # `make/pymake` - mkdocs-minify-plugin # `cd docs && pymake` - - git+https://github.com/tqdm/jsmin@python3-only#egg=jsmin # `cd docs && pymake` + - git+https://github.com/tqdm/jsmin@fix-pip#egg=jsmin # `cd docs && pymake` + - pydoc-markdown >=4.6 # `cd docs && pymake` diff --git a/pyproject.toml b/pyproject.toml index 6ee6d5e..ce05eed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation", "Programming Language :: Python :: Implementation :: IronPython", diff --git a/tests/tests_asyncio.py b/tests/tests_asyncio.py index bdef569..250e658 100644 --- a/tests/tests_asyncio.py +++ b/tests/tests_asyncio.py @@ -48,10 +48,14 @@ async def test_generators(capsys): _, err = capsys.readouterr() assert '9it' in err - with tqdm(acount(), desc="async_counter") as pbar: - async for i in pbar: - if i >= 8: - break + acounter = acount() + try: + with tqdm(acounter, desc="async_counter") as pbar: + async for i in pbar: + if i >= 8: + break + finally: + await acounter.aclose() _, err = capsys.readouterr() assert '9it' in err @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist=py{37,38,39,310,311,py3}{,-tf}{,-keras}, perf, check +envlist=py{37,38,39,310,311,312,py3}{,-tf}{,-keras}, perf, check isolated_build=True [gh-actions] @@ -14,6 +14,7 @@ python= 3.9: py39 3.10: py310 3.11: py311 + 3.12: py312 pypy-3.7: pypy3 [gh-actions:env] PLATFORM= diff --git a/tqdm/cli.py b/tqdm/cli.py index 7284f28..d681b16 100644 --- a/tqdm/cli.py +++ b/tqdm/cli.py @@ -5,6 +5,7 @@ import logging import re import sys from ast import literal_eval as numeric +from textwrap import indent from .std import TqdmKeyError, TqdmTypeError, tqdm from .version import __version__ @@ -177,7 +178,9 @@ def main(fp=sys.stderr, argv=None): logging.basicConfig(level=getattr(logging, logLevel), format="%(levelname)s:%(module)s:%(lineno)d:%(message)s") - d = tqdm.__doc__ + CLI_EXTRA_DOC + # py<3.13 doesn't dedent docstrings + d = (tqdm.__doc__ if sys.version_info < (3, 13) + else indent(tqdm.__doc__, " ")) + CLI_EXTRA_DOC opt_types = dict(RE_OPTS.findall(d)) # opt_types['delim'] = 'chr' diff --git a/tqdm/utils.py b/tqdm/utils.py index f7060be..af3ec7d 100644 --- a/tqdm/utils.py +++ b/tqdm/utils.py @@ -14,7 +14,7 @@ from weakref import proxy _range, _unich, _unicode, _basestring = range, chr, str, str CUR_OS = sys.platform IS_WIN = any(CUR_OS.startswith(i) for i in ['win32', 'cygwin']) -IS_NIX = any(CUR_OS.startswith(i) for i in ['aix', 'linux', 'darwin']) +IS_NIX = any(CUR_OS.startswith(i) for i in ['aix', 'linux', 'darwin', 'freebsd']) RE_ANSI = re.compile(r"\x1b\[[;\d]*[A-Za-z]") try: |