Skip to content

Commit

Permalink
bump version, merge pull request #1627 from tqdm/devel
Browse files Browse the repository at this point in the history
misc minor updates
  • Loading branch information
casperdcl authored Oct 28, 2024
2 parents 951a2ba + 0a439b5 commit 5b84012
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 80 deletions.
47 changes: 7 additions & 40 deletions .github/workflows/comment-bot.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,17 @@
# runs on any comment matching the format `/tag <tagname> <commit>`
name: Comment Bot
on:
issue_comment: {types: [created]}
pull_request_review_comment: {types: [created]}
jobs:
tag: # /tag <tagname> <commit>
if: startsWith(github.event.comment.body, '/tag ')
tag:
runs-on: ubuntu-latest
permissions: {contents: write, pull-requests: write, issues: write}
steps:
- uses: actions/checkout@v4
- name: React Seen
uses: actions/github-script@v7
with:
script: |
const perm = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner, repo: context.repo.repo,
username: context.payload.comment.user.login})
post = (context.eventName == "issue_comment"
? github.rest.reactions.createForIssueComment
: github.rest.reactions.createForPullRequestReviewComment)
if (!["admin", "write"].includes(perm.data.permission)){
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "laugh"})
throw "Permission denied for user " + context.payload.comment.user.login
}
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "eyes"})
github-token: ${{ secrets.GH_TOKEN }}
- name: Tag Commit
run: |
git clone https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} repo
git -C repo tag $(echo "$BODY" | awk '{print $2" "$3}')
git -C repo push --tags
rm -rf repo
env:
BODY: ${{ github.event.comment.body }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: React Success
uses: actions/github-script@v7
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || github.token }}
- uses: casperdcl/comment-bot@v1
with:
script: |
post = (context.eventName == "issue_comment"
? github.rest.reactions.createForIssueComment
: github.rest.reactions.createForPullRequestReviewComment)
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "rocket"})
github-token: ${{ secrets.GH_TOKEN }}
token: ${{ secrets.GH_TOKEN || github.token }}
26 changes: 12 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- if: github.event_name == 'push' || github.event_name == 'pull_request'
name: comment
run: |
if [[ $EVENT == pull_request ]]; then
if test "$EVENT" = pull_request; then
REPORTER=github-pr-review
else
REPORTER=github-check
Expand All @@ -44,19 +44,14 @@ jobs:
os: [ubuntu]
python: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
include:
- os: macos
python: 3.12
- os: windows
python: 3.12
- {os: macos, python: 3.12}
- {os: windows, python: 3.12}
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 35
defaults:
run:
shell: bash
defaults: {run: {shell: bash}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
with: {fetch-depth: 0}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
Expand All @@ -69,10 +64,13 @@ jobs:
echo "$HOME/bin" >> $GITHUB_PATH
- name: tox
run: |
if [[ "py${{ matrix.python }}-${{ matrix.os }}" = "py3.11-ubuntu" ]]; then
if test "py${{ matrix.python }}" = py3.7; then
sed -i /asyncio_default_fixture_loop_scope/d pyproject.toml
fi
if test "py${{ matrix.python }}-${{ matrix.os }}" = py3.11-ubuntu; then
export TOXENV="py311-tf,py311-tf-keras" # full
fi
if [[ "${{ matrix.os }}" != "ubuntu" ]]; then
if test "${{ matrix.os }}" != ubuntu; then
tox -e py${PYVER/./} # basic
else
timeout 5m tox || timeout 5m tox || timeout 5m tox
Expand Down Expand Up @@ -137,10 +135,10 @@ jobs:
if [[ $GITHUB_REF == refs/tags/v* ]]; then
echo docker_tags=latest,${GITHUB_REF/refs\/tags\/v/} >> $GITHUB_OUTPUT
echo snap_channel=stable,candidate,edge >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/master ]]; then
elif test "$GITHUB_REF" = refs/heads/master; then
echo docker_tags=master >> $GITHUB_OUTPUT
echo snap_channel=candidate,edge >> $GITHUB_OUTPUT
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
elif test "$GITHUB_REF" = refs/heads/devel; then
echo docker_tags=devel >> $GITHUB_OUTPUT
echo snap_channel=edge >> $GITHUB_OUTPUT
fi
Expand Down
4 changes: 2 additions & 2 deletions .meta/.readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1288,5 +1288,5 @@ Citation information: |DOI|
.. |Screenshot-Jupyter1| image:: https://tqdm.github.io/img/jupyter-1.gif
.. |Screenshot-Jupyter2| image:: https://tqdm.github.io/img/jupyter-2.gif
.. |Screenshot-Jupyter3| image:: https://tqdm.github.io/img/jupyter-3.gif
.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif
:target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social
.. |README-Hits| image:: https://cgi.cdcl.ml/hits?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif
:target: https://cgi.cdcl.ml/hits?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social
5 changes: 1 addition & 4 deletions .meta/mksnap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""
import sys
from pathlib import Path
from subprocess import check_output # nosec

sys.path.insert(1, str(Path(__file__).parent.parent))
import tqdm # NOQA
Expand Down Expand Up @@ -52,7 +51,6 @@
tqdm:
plugin: python
source: .
source-commit: '{commit}'
python-packages: [.]
build-packages: [git]
override-build: |
Expand All @@ -62,8 +60,7 @@
tqdm:
command: bin/tqdm
completer: completion.sh
""".format(version=tqdm.__version__, commit=check_output([
'git', 'describe', '--always']).decode('utf-8').strip()) # nosec
""".format(version=tqdm.__version__) # nosec

if __name__ == "__main__":
(Path(__file__).resolve().parent.parent / 'snapcraft.yaml').write_text(
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -37,9 +37,9 @@ repos:
- numpy
- pandas
- pytest-timeout
- pytest-asyncio
- pytest-asyncio>0.21
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8
args: [-j8]
Expand Down
2 changes: 1 addition & 1 deletion DEMO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@
"specify any file-like object using the `file` argument. For example,\n",
"this can be used to redirect the messages writing to a log file or class.\n",
"\n",
"[![README-Hits](https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif)](https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social)|(Since 19 May 2016)\n",
"[![README-Hits](https://cgi.cdcl.ml/hits?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif)](https://cgi.cdcl.ml/hits?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social)|(Since 19 May 2016)\n",
"-|-"
]
},
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ testsetup:
@make help

testnb:
pytest tests_notebook.ipynb --cov=tqdm.notebook --cov-report=term -W=ignore --nbval --current-env --sanitize-with=.meta/nbval.ini
pytest tests_notebook.ipynb --cov=tqdm.notebook --cov-report=term -W=ignore --nbval --nbval-current-env --nbval-sanitize-with=.meta/nbval.ini

testcoverage:
@make coverclean
pytest tests_notebook.ipynb --cov=tqdm --cov-report= -W=ignore --nbval --current-env --sanitize-with=.meta/nbval.ini
pytest tests_notebook.ipynb --cov=tqdm --cov-report= -W=ignore --nbval --nbval-current-env --nbval-sanitize-with=.meta/nbval.ini
pytest -k "not perf" --cov=tqdm --cov-report=xml --cov-report=term --cov-append --cov-fail-under=80

testperf:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1505,5 +1505,5 @@ Citation information: |DOI|
.. |Screenshot-Jupyter1| image:: https://tqdm.github.io/img/jupyter-1.gif
.. |Screenshot-Jupyter2| image:: https://tqdm.github.io/img/jupyter-2.gif
.. |Screenshot-Jupyter3| image:: https://tqdm.github.io/img/jupyter-3.gif
.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif
:target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social
.. |README-Hits| image:: https://cgi.cdcl.ml/hits?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif
:target: https://cgi.cdcl.ml/hits?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social
2 changes: 1 addition & 1 deletion examples/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ @misc{trend-hist
@misc{hits,
year="2019",
title="{tqdm} hits",
url="https://caspersci.uk.to/cgi-bin/hits.cgi?q=tqdm&a=plot",
url="https://cgi.cdcl.ml/hits?q=tqdm&a=plot",
author="Casper O. {da Costa-Luis}"
}
@book{miller,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ readme = "README.rst"
requires-python = ">=3.7"
keywords = ["progressbar", "progressmeter", "progress", "bar", "meter", "rate", "eta", "console", "terminal", "time"]
license = {text = "MPL-2.0 AND MIT"}
# Trove classifiers (https://pypi.org/pypi?%3Aaction=list_classifiers)
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
Expand Down Expand Up @@ -120,6 +121,7 @@ markers = ["asyncio", "slow"]
python_files = ["tests_*.py", "tests_*.ipynb"]
testpaths = ["tests"]
addopts = "-v --tb=short -rxs -W=error --durations=0 --durations-min=0.1 --asyncio-mode=strict"
asyncio_default_fixture_loop_scope = "function"

[tool.coverage.run]
branch = true
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ deps=
tf: tensorflow!=2.5.0
keras: keras
commands=
pytest --cov=tqdm --cov-report= -W=ignore tests_notebook.ipynb --nbval --current-env --sanitize-with=.meta/nbval.ini
pytest --cov=tqdm --cov-report= -W=ignore tests_notebook.ipynb --nbval --nbval-current-env --nbval-sanitize-with=.meta/nbval.ini
pytest --cov=tqdm --cov-report=xml --cov-report=term --cov-append -k "not perf"
{[core]commands}
allowlist_externals=codacy
Expand Down
19 changes: 9 additions & 10 deletions tqdm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,21 @@ def write(_):
stdout = getattr(stdout, 'buffer', stdout)
stdin = getattr(sys.stdin, 'buffer', sys.stdin)
if manpath or comppath:
from importlib import resources
from os import path
from shutil import copyfile
try: # py<3.9
import importlib_resources as resources
except ImportError:
from importlib import resources
from pathlib import Path

def cp(name, dst):
"""copy resource `name` to `dst`"""
if hasattr(resources, 'files'):
copyfile(str(resources.files('tqdm') / name), dst)
else: # py<3.9
with resources.path('tqdm', name) as src:
copyfile(str(src), dst)
fi = resources.files('tqdm') / name
dst.write_bytes(fi.read_bytes())
log.info("written:%s", dst)
if manpath is not None:
cp('tqdm.1', path.join(manpath, 'tqdm.1'))
cp('tqdm.1', Path(manpath) / 'tqdm.1')
if comppath is not None:
cp('completion.sh', path.join(comppath, 'tqdm_completion.sh'))
cp('completion.sh', Path(comppath) / 'tqdm_completion.sh')
sys.exit(0)
if tee:
stdout_write = stdout.write
Expand Down

0 comments on commit 5b84012

Please sign in to comment.