Skip to content

Commit

Permalink
bump version, merge pull request #1549 from tqdm/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Feb 10, 2024
2 parents 4c956c2 + e9f0c05 commit cc372d0
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 84 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/check.yml
Expand Up @@ -15,8 +15,8 @@ jobs:
- perf
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: pip install -U tox
Expand All @@ -28,21 +28,21 @@ jobs:
name: Benchmark (Full)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || github.token }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
run: |
pip install -U wheel
pip install -U wheel packaging
pip install -U virtualenv asv
git checkout master && git checkout -
asv machine --machine github-actions --yes
- name: Restore previous results
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .asv
key: asv-${{ runner.os }}
Expand All @@ -65,20 +65,20 @@ jobs:
name: Benchmark (Branch)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
run: |
pip install -U wheel
pip install -U wheel packaging
pip install -U virtualenv asv
git checkout master && git checkout -
asv machine --machine github-actions --yes
- name: Restore previous results
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .asv
key: asv-${{ runner.os }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/comment-bot.yml
Expand Up @@ -7,9 +7,9 @@ jobs:
if: startsWith(github.event.comment.body, '/tag ')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: React Seen
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const perm = await github.rest.repos.getCollaboratorPermissionLevel({
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
BODY: ${{ github.event.comment.body }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: React Success
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
post = (context.eventName == "issue_comment"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/post-release.yml
Expand Up @@ -8,19 +8,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout wiki
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.wiki
path: wiki
- name: Checkout docs
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.github.io
path: docs
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/test.yml
Expand Up @@ -8,13 +8,13 @@ jobs:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
Expand Down Expand Up @@ -54,10 +54,10 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: install
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Coveralls Finished
Expand All @@ -111,12 +111,14 @@ jobs:
deploy:
needs: [check, test]
runs-on: ubuntu-latest
environment: pypi
permissions: {contents: write, id-token: write, packages: write}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || github.token }}
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install
Expand All @@ -127,7 +129,6 @@ jobs:
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
password: ${{ secrets.PYPI_TOKEN }}
gpg_key: ${{ secrets.GPG_KEY }}
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- id: collect_assets
Expand Down
4 changes: 2 additions & 2 deletions .meta/.readme.rst
Expand Up @@ -613,7 +613,7 @@ first.
def progresser(n):
interval = 0.001 / (n + 2)
total = 5000
text = "#{}, est. {:<04.2}s".format(n, interval * total)
text = f"#{n}, est. {interval * total:<04.2}s"
for _ in trange(total, desc=text, position=n):
sleep(interval)
Expand All @@ -636,7 +636,7 @@ Note that in Python 3, ``tqdm.write`` is thread-safe:
def progresser(n):
interval = 0.001 / (n + 2)
total = 5000
text = "#{}, est. {:<04.2}s".format(n, interval * total)
text = f"#{n}, est. {interval * total:<04.2}s"
for _ in trange(total, desc=text):
sleep(interval)
if n == 6:
Expand Down
3 changes: 3 additions & 0 deletions .meta/nbval.ini
Expand Up @@ -7,3 +7,6 @@ replace: 00:00<00:00
[regex3]
regex: \|███▍ \|
replace: |███▎ |
[regex4]
regex: [ ]{4}\n
replace: \n
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -39,7 +39,7 @@ repos:
- pytest-timeout
- pytest-asyncio
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
args: [-j8]
Expand All @@ -52,11 +52,11 @@ repos:
- flake8-pyproject
- flake8-string-format
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
args: [--keep-count, --keep-output]
2 changes: 1 addition & 1 deletion LICENCE
Expand Up @@ -7,7 +7,7 @@ Exceptions or notable authors are listed below
in reverse chronological order:

* files: *
MPL-2.0 2015-2023 (c) Casper da Costa-Luis
MPL-2.0 2015-2024 (c) Casper da Costa-Luis
[casperdcl](https://github.com/casperdcl).
* files: tqdm/_tqdm.py
MIT 2016 (c) [PR #96] on behalf of Google Inc.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -137,9 +137,9 @@ clean:
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('*.py[co]')]"
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('tests/*.py[co]')]"
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('benchmarks/*.py[co]')]"
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('examples/*.py[co]')]"
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('tqdm/*.py[co]')]"
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('tqdm/contrib/*.py[co]')]"
@+python -c "import os, glob; [os.remove(i) for i in glob.glob('tqdm/examples/*.py[co]')]"
toxclean:
@+python -c "import shutil; shutil.rmtree('.tox', True)"

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -830,7 +830,7 @@ first.
def progresser(n):
interval = 0.001 / (n + 2)
total = 5000
text = "#{}, est. {:<04.2}s".format(n, interval * total)
text = f"#{n}, est. {interval * total:<04.2}s"
for _ in trange(total, desc=text, position=n):
sleep(interval)
Expand All @@ -853,7 +853,7 @@ Note that in Python 3, ``tqdm.write`` is thread-safe:
def progresser(n):
interval = 0.001 / (n + 2)
total = 5000
text = "#{}, est. {:<04.2}s".format(n, interval * total)
text = f"#{n}, est. {interval * total:<04.2}s"
for _ in trange(total, desc=text):
sleep(interval)
if n == 6:
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Expand Up @@ -28,6 +28,7 @@ dependencies:
- matplotlib # gui
- numpy # pandas, keras, contrib.tenumerate
- pandas
- pyarrow # pandas
- tensorflow # keras
- slack-sdk # contrib.slack
- requests # contrib.telegram
Expand Down
16 changes: 8 additions & 8 deletions tests/tests_keras.py
Expand Up @@ -39,8 +39,8 @@ def test_keras(capsys):
verbose=0)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
assert "{batches}/{batches}".format(batches=batches) not in res
assert f"{epochs}/{epochs}" in res
assert f"{batches}/{batches}" not in res

# full (epoch and batch) progress
model.fit(
Expand All @@ -58,8 +58,8 @@ def test_keras(capsys):
verbose=2)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
assert "{batches}/{batches}".format(batches=batches) in res
assert f"{epochs}/{epochs}" in res
assert f"{batches}/{batches}" in res

# auto-detect epochs and batches
model.fit(
Expand All @@ -71,8 +71,8 @@ def test_keras(capsys):
callbacks=[TqdmCallback(desc="training", verbose=2)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
assert "{batches}/{batches}".format(batches=batches) in res
assert f"{epochs}/{epochs}" in res
assert f"{batches}/{batches}" in res

# continue training (start from epoch != 0)
initial_epoch = 3
Expand All @@ -87,5 +87,5 @@ def test_keras(capsys):
miniters=1, mininterval=0, maxinterval=0)])
_, res = capsys.readouterr()
assert "training: " in res
assert "{epochs}/{epochs}".format(epochs=initial_epoch - 1) not in res
assert "{epochs}/{epochs}".format(epochs=epochs) in res
assert f"{initial_epoch - 1}/{initial_epoch - 1}" not in res
assert f"{epochs}/{epochs}" in res
24 changes: 19 additions & 5 deletions tests/tests_pandas.py
Expand Up @@ -4,6 +4,7 @@

pytestmark = mark.slow

np = importorskip('numpy')
random = importorskip('numpy.random')
rand = random.rand
randint = random.randint
Expand Down Expand Up @@ -66,6 +67,7 @@ def test_pandas_series():
f"\nExpected:\n{exres} at least twice.\nIn:\n{our_file.read()}\n")


@mark.filterwarnings("ignore:DataFrame.applymap has been deprecated:FutureWarning")
def test_pandas_data_frame():
"""Test pandas.DataFrame.progress_apply and .progress_applymap"""
with closing(StringIO()) as our_file:
Expand All @@ -80,6 +82,12 @@ def task_func(x):
res2 = df.applymap(task_func)
assert res1.equals(res2)

# map
if hasattr(df, 'map'): # pandas>=2.1.0
res1 = df.progress_map(task_func)
res2 = df.map(task_func)
assert res1.equals(res2)

# apply unhashable
res1 = []
df.progress_apply(res1.extend)
Expand Down Expand Up @@ -107,6 +115,8 @@ def task_func(x):
f"\nExpected:\n{exres} at least once.\nIn:\n{our_file.read()}\n")


@mark.filterwarnings(
"ignore:DataFrameGroupBy.apply operated on the grouping columns:DeprecationWarning")
def test_pandas_groupby_apply():
"""Test pandas.DataFrame.groupby(...).progress_apply"""
with closing(StringIO()) as our_file:
Expand All @@ -119,8 +129,8 @@ def test_pandas_groupby_apply():
dfs.groupby(['a']).progress_apply(lambda x: None)

df2 = df = pd.DataFrame({'a': randint(1, 8, 10000), 'b': rand(10000)})
res1 = df2.groupby("a").apply(max)
res2 = df2.groupby("a").progress_apply(max)
res1 = df2.groupby("a").apply(np.maximum.reduce)
res2 = df2.groupby("a").progress_apply(np.maximum.reduce)
assert res1.equals(res2)

our_file.seek(0)
Expand All @@ -139,11 +149,11 @@ def test_pandas_groupby_apply():
dfs.loc[0] = [2, 1, 1]
dfs['d'] = 100

expects = ['500/500', '1/1', '4/4', '2/2']
expects = ['500/500', '1/1', '4/4', '4/4']
dfs.groupby(dfs.index).progress_apply(lambda x: None)
dfs.groupby('d').progress_apply(lambda x: None)
dfs.groupby(dfs.columns, axis=1).progress_apply(lambda x: None)
dfs.groupby([2, 2, 1, 1], axis=1).progress_apply(lambda x: None)
dfs.T.groupby(dfs.columns).progress_apply(lambda x: None)
dfs.T.groupby([2, 2, 1, 1]).progress_apply(lambda x: None)

our_file.seek(0)
if our_file.read().count('100%') < 4:
Expand All @@ -159,6 +169,8 @@ def test_pandas_groupby_apply():
f"\nExpected:\n{exres} at least once.\nIn:\n{our_file.read()}\n")


@mark.filterwarnings(
"ignore:DataFrameGroupBy.apply operated on the grouping columns:DeprecationWarning")
def test_pandas_leave():
"""Test pandas with `leave=True`"""
with closing(StringIO()) as our_file:
Expand Down Expand Up @@ -193,6 +205,8 @@ def test_pandas_apply_args_deprecation():
"keyword arguments instead"))


@mark.filterwarnings(
"ignore:DataFrameGroupBy.apply operated on the grouping columns:DeprecationWarning")
def test_pandas_deprecation():
"""Test bar object instance as argument deprecation"""
try:
Expand Down

0 comments on commit cc372d0

Please sign in to comment.