Skip to content

Commit

Permalink
bump version, merge pull request #1246 from tqdm/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Sep 20, 2021
2 parents 140c948 + 058fe72 commit 18d7aa4
Show file tree
Hide file tree
Showing 19 changed files with 210 additions and 259 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
with:
repository: ${{ github.repository }}.github.io
path: docs
ref: src
token: ${{ secrets.GH_TOKEN }}
- uses: actions/setup-python@v2
with:
Expand All @@ -39,12 +38,13 @@ jobs:
git commit -a -m "update release notes to ${GITHUB_REF#refs/tags/}"
git push
popd
- name: Update Docs
run: |
pushd docs
git fetch --depth=1 origin master:master
git checkout master
git push --set-upstream origin master
git checkout -
make deploy
popd
- run: make -C docs build
- if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
uses: casperdcl/push-dir@v1
with:
message: update static site
branch: gh-pages
dir: docs/build/docs/_site
nojekyll: true
name: tqdm[bot]
email: 68520887+tqdm-bot@users.noreply.github.com
92 changes: 37 additions & 55 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ on:
push:
pull_request:
schedule:
- cron: '2 1 * * 6' # M H d m w (Saturdays at 1:02)
- cron: '2 1 * * 6' # M H d m w (Sat 1:02)
jobs:
check:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
if: github.event_name != 'pull_request' || github.repository_owner != 'tqdm'
runs-on: ubuntu-latest
name: check
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -37,48 +36,27 @@ jobs:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT: ${{ github.event_name }}
- run: pre-commit run -a --show-diff-on-failure
test-os:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
strategy:
matrix:
python: [2.7, 3.7]
os: [macos-latest, windows-latest]
name: py${{ matrix.python }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: install
shell: bash
run: |
pip install -U tox
mkdir -p "$HOME/bin"
curl -sfL https://coverage.codacy.com/get.sh > "$HOME/bin/codacy"
chmod +x "$HOME/bin/codacy"
echo "$HOME/bin" >> $GITHUB_PATH
- run: tox -e py${PYVER/./}
shell: bash
env:
PYVER: ${{ matrix.python }}
COVERALLS_FLAG_NAME: py${{ matrix.python }}-${{ matrix.os }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
# coveralls needs explicit token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
test:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
if: github.event_name != 'pull_request' || github.repository_owner != 'tqdm'
name: py${{ matrix.python }}-${{ matrix.os }}
strategy:
matrix:
os: [ubuntu]
python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
name: py${{ matrix.python }}
runs-on: ubuntu-latest
timeout-minutes: 20
include:
- os: macos
python: 2.7
- os: macos
python: 3.8
- os: windows
python: 2.7
- os: windows
python: 3.8
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 35
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -88,35 +66,39 @@ jobs:
python-version: ${{ matrix.python }}
- name: install
run: |
pip install -U tox
pip install -U tox tox-gh-actions
mkdir -p "$HOME/bin"
curl -sfL https://coverage.codacy.com/get.sh > "$HOME/bin/codacy"
chmod +x "$HOME/bin/codacy"
echo "$HOME/bin" >> $GITHUB_PATH
- name: tox
run: |
if [[ "$PYVER" == py* ]]; then
tox -e $PYVER # basic:pypy
elif [[ "$PYVER" == *3.9 ]]; then
tox -e py${PYVER/./} # basic
elif [[ "$PYVER" == "3.7" ]]; then
tox -e py${PYVER/./}-tf,py${PYVER/./}-tf-keras # full
TIMEOUT=10m
if [[ "${{ matrix.python }}" = "2.7" ]]; then
TIMEOUT=15m
elif [[ "py${{ matrix.python }}-${{ matrix.os }}" = "py3.8-ubuntu" ]]; then
export TOXENV="py38-tf,py38-tf-keras" # full
fi
if [[ "${{ matrix.os }}" != "ubuntu" ]]; then
tox -e py${PYVER/./} # basic
else
tox -e py${PYVER/./}-tf-keras # normal
timeout $TIMEOUT tox || timeout $TIMEOUT tox || timeout $TIMEOUT tox
fi
env:
PYVER: ${{ matrix.python }}
COVERALLS_FLAG_NAME: py${{ matrix.python }}
PLATFORM: ${{ matrix.os }}
COVERALLS_FLAG_NAME: py${{ matrix.python }}-${{ matrix.os }}
COVERALLS_PARALLEL: true
COVERALLS_SERVICE_NAME: github
# coveralls needs explicit token
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
finish:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
if: github.event_name != 'pull_request' || github.repository_owner != 'tqdm'
name: pytest cov
continue-on-error: ${{ github.event_name != 'push' }}
needs: [test, test-os]
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
Expand All @@ -133,7 +115,7 @@ jobs:
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
deploy:
needs: [check, test, test-os]
needs: [check, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -150,7 +132,7 @@ jobs:
with:
password: ${{ secrets.PYPI_TOKEN }}
gpg_key: ${{ secrets.GPG_KEY }}
upload: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') }}
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- id: collect_assets
name: Collect assets
run: |
Expand All @@ -166,7 +148,7 @@ jobs:
fi
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
19 changes: 9 additions & 10 deletions .meta/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def doc2rst(doc, arglist=True, raw=False):
else:
doc = dedent(doc)
if arglist:
doc = '\n'.join([i if not i or i[0] == ' ' else '* ' + i + ' '
for i in doc.split('\n')])
doc = '\n'.join(i if not i or i[0] == ' ' else '* ' + i + ' '
for i in doc.split('\n'))
return doc


Expand All @@ -50,10 +50,8 @@ def doc2rst(doc, arglist=True, raw=False):
README_rst = fd.read()
DOC_tqdm = doc2rst(tqdm.tqdm.__doc__, False).replace('\n', '\n ')
DOC_tqdm_init = doc2rst(tqdm.tqdm.__init__.__doc__)
DOC_tqdm_init_args = DOC_tqdm_init.partition(doc2rst(HEAD_ARGS))[-1]\
.replace('\n ', '\n ')
DOC_tqdm_init_args, _, DOC_tqdm_init_rets = DOC_tqdm_init_args\
.partition(doc2rst(HEAD_RETS))
DOC_tqdm_init_args = DOC_tqdm_init.partition(doc2rst(HEAD_ARGS))[-1].replace('\n ', '\n ')
DOC_tqdm_init_args, _, DOC_tqdm_init_rets = DOC_tqdm_init_args.partition(doc2rst(HEAD_RETS))
DOC_cli = doc2rst(tqdm.cli.CLI_EXTRA_DOC).partition(doc2rst(HEAD_CLI))[-1]
DOC_tqdm_tqdm = {}
for i in dir(tqdm.tqdm):
Expand All @@ -65,10 +63,11 @@ def doc2rst(doc, arglist=True, raw=False):
DOC_tqdm_init_args = DOC_tqdm_init_args.replace(' *,', ' ``*``,')
DOC_tqdm_init_args = DOC_tqdm_init_args.partition('* gui : bool, optional')[0]

README_rst = README_rst.replace('{DOC_tqdm}', DOC_tqdm)\
.replace('{DOC_tqdm.tqdm.__init__.Parameters}', DOC_tqdm_init_args)\
.replace('{DOC_tqdm.cli.CLI_EXTRA_DOC}', DOC_cli)\
.replace('{DOC_tqdm.tqdm.__init__.Returns}', DOC_tqdm_init_rets)
README_rst = (
README_rst.replace('{DOC_tqdm}', DOC_tqdm)
.replace('{DOC_tqdm.tqdm.__init__.Parameters}', DOC_tqdm_init_args)
.replace('{DOC_tqdm.cli.CLI_EXTRA_DOC}', DOC_cli)
.replace('{DOC_tqdm.tqdm.__init__.Returns}', DOC_tqdm_init_rets))
for k, v in DOC_tqdm_tqdm.items():
README_rst = README_rst.replace('{DOC_tqdm.tqdm.%s}' % k, v)

Expand Down
2 changes: 1 addition & 1 deletion .meta/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flake8
pre-commit
pytest
pytest-cov
pytest-timeout
Expand Down
7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,19 @@ repos:
- id: flake8
args: [-j8]
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-isort
- flake8-string-format
- flake8-type-annotations
- repo: https://github.com/PyCQA/isort
rev: 5.9.2
rev: 5.9.3
hooks:
- id: isort
- repo: https://github.com/kynan/nbstripout
rev: 0.4.0
rev: 0.5.0
hooks:
- id: nbstripout
args: [--keep-count, --keep-output]
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Mozilla Public Licence (MPL) v. 2.0 - Exhibit A

This Source Code Form is subject to the terms of the
Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file,
If a copy of the MPL was not distributed with this project,
You can obtain one at https://mozilla.org/MPL/2.0/.


Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ all:
@+make build

flake8:
@+flake8 -j 8 --count --statistics --exit-zero .
@+pre-commit run -a flake8
@+pre-commit run -a nbstripout

test:
TOX_SKIP_ENV=perf tox --skip-missing-interpreters -p all
Expand Down Expand Up @@ -159,6 +160,7 @@ install_build:
python -m pip install -r .meta/requirements-dev.txt
install_test:
python -m pip install -r .meta/requirements-test.txt
pre-commit install

build:
@make prebuildclean
Expand Down
8 changes: 1 addition & 7 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ dependencies:
- pytest-timeout
- pytest-asyncio # [py>=3.7]
- nbval
- flake8
- flake8-bugbear
- flake8-comprehensions
- coverage
# extras
- dask # dask
- matplotlib # gui
- nbstripout # notebook editing
- numpy # pandas, keras, contrib.tenumerate
- pandas
- tensorflow # keras
Expand All @@ -38,8 +34,6 @@ dependencies:
- argopt # `cd wiki && pymake`
- twine # `pymake pypi`
- wheel # `setup.py bdist_wheel`
- pydoc-markdown # `cd docs && pymake`
- pip:
- py-make >=0.1.0 # `setup.py make/pymake`
- pydoc-markdown # `cd docs && pymake`
- flake8-debugger # flake8
- flake8-string-format # flake8
2 changes: 1 addition & 1 deletion examples/7zx.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def main():
break
ln = l_raw.strip()
if ln.startswith("Extracting"):
exname = ln.lstrip("Extracting").lstrip()
exname = ln[len("Extracting"):].lstrip()
s = fcomp.get(exname, 0) # 0 is likely folders
t.update(s)
tall.update(s)
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ exclude=benchmarks, tests
universal=1

[flake8]
max_line_length=88
max_line_length=99
exclude=.asv,.eggs,.tox,.ipynb_checkpoints,build,dist,.git,__pycache__

[pydocstyle]
add_ignore=D400,D415

[yapf]
coalesce_brackets=True
column_limit=88
column_limit=99
each_dict_entry_on_separate_line=False
i18n_comment=NOQA
space_between_ending_comma_and_closing_bracket=False
split_before_named_assigns=False
split_before_closing_bracket=False

[isort]
line_length=88
line_length=99
multi_line_output=4
known_first_party=tqdm,tests

Expand Down
4 changes: 2 additions & 2 deletions tests/tests_contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def test_enumerate(tqdm_kwargs):
enumerate(a, 42)
)
with closing(StringIO()) as our_file:
_ = list(tenumerate((i for i in a), file=our_file, **tqdm_kwargs))
_ = list(tenumerate(iter(a), file=our_file, **tqdm_kwargs))
assert "100%" not in our_file.getvalue()
with closing(StringIO()) as our_file:
_ = list(tenumerate((i for i in a), file=our_file, total=len(a), **tqdm_kwargs))
_ = list(tenumerate(iter(a), file=our_file, total=len(a), **tqdm_kwargs))
assert "100%" in our_file.getvalue()


Expand Down
8 changes: 3 additions & 5 deletions tests/tests_itertools.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Tests for `tqdm.contrib.itertools`.
"""
import itertools
import itertools as it

from tqdm.contrib.itertools import product

Expand All @@ -21,8 +21,6 @@ def test_product():
"""Test contrib.itertools.product"""
with closing(StringIO()) as our_file:
a = range(9)
assert list(product(a, a[::-1], file=our_file)) == \
list(itertools.product(a, a[::-1]))
assert list(product(a, a[::-1], file=our_file)) == list(it.product(a, a[::-1]))

assert list(product(a, NoLenIter(a), file=our_file)) == \
list(itertools.product(a, NoLenIter(a)))
assert list(product(a, NoLenIter(a), file=our_file)) == list(it.product(a, NoLenIter(a)))

0 comments on commit 18d7aa4

Please sign in to comment.