Skip to content

Commit a11a216

Browse files
authored
bump version, merge pull request #19 from casperdcl/devel
2 parents a2aeafe + c949636 commit a11a216

File tree

11 files changed

+180
-255
lines changed

11 files changed

+180
-255
lines changed

.github/workflows/comment-bot.yml

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,17 @@
1+
# runs on any comment matching the format `/tag <tagname> <commit>`
12
name: Comment Bot
23
on:
34
issue_comment: {types: [created]}
45
pull_request_review_comment: {types: [created]}
56
jobs:
6-
tag: # /tag <tagname> <commit>
7-
if: startsWith(github.event.comment.body, '/tag ')
7+
tag:
88
runs-on: ubuntu-latest
9+
permissions: {contents: write, pull-requests: write, issues: write}
910
steps:
10-
- uses: actions/checkout@v3
11-
- name: React Seen
12-
uses: actions/github-script@v6
11+
- uses: actions/checkout@v4
1312
with:
14-
script: |
15-
const perm = await github.rest.repos.getCollaboratorPermissionLevel({
16-
owner: context.repo.owner, repo: context.repo.repo,
17-
username: context.payload.comment.user.login})
18-
post = (context.eventName == "issue_comment"
19-
? github.rest.reactions.createForIssueComment
20-
: github.rest.reactions.createForPullRequestReviewComment)
21-
if (!["admin", "write"].includes(perm.data.permission)){
22-
post({
23-
owner: context.repo.owner, repo: context.repo.repo,
24-
comment_id: context.payload.comment.id, content: "laugh"})
25-
throw "Permission denied for user " + context.payload.comment.user.login
26-
}
27-
post({
28-
owner: context.repo.owner, repo: context.repo.repo,
29-
comment_id: context.payload.comment.id, content: "eyes"})
30-
- name: Tag Commit
31-
run: |
32-
git clone https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} repo
33-
git -C repo tag $(echo "$BODY" | awk '{print $2" "$3}')
34-
git -C repo push --tags
35-
rm -rf repo
36-
env:
37-
BODY: ${{ github.event.comment.body }}
38-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
39-
- name: React Success
40-
uses: actions/github-script@v6
13+
fetch-depth: 0
14+
token: ${{ secrets.GH_TOKEN || github.token }}
15+
- uses: casperdcl/comment-bot@v1
4116
with:
42-
script: |
43-
post = (context.eventName == "issue_comment"
44-
? github.rest.reactions.createForIssueComment
45-
: github.rest.reactions.createForPullRequestReviewComment)
46-
post({
47-
owner: context.repo.owner, repo: context.repo.repo,
48-
comment_id: context.payload.comment.id, content: "rocket"})
17+
token: ${{ secrets.GH_TOKEN || github.token }}

.github/workflows/test.yml

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,22 @@ on:
44
pull_request:
55
schedule: [{cron: '3 2 1 * *'}] # M H d m w (monthly at 2:03)
66
jobs:
7-
check:
8-
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
9-
name: Check
10-
runs-on: ubuntu-latest
11-
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v4
14-
with:
15-
python-version: '3.x'
16-
- name: Prepare cache
17-
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
18-
- uses: actions/cache@v3
19-
with:
20-
path: ~/.cache/pre-commit
21-
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
22-
- name: Dependencies
23-
run: pip install -U pre-commit
24-
- uses: reviewdog/action-setup@v1
25-
- if: github.event_name == 'push' || github.event_name == 'pull_request'
26-
name: Comment
27-
run: |
28-
if [[ $EVENT == pull_request ]]; then
29-
REPORTER=github-pr-review
30-
else
31-
REPORTER=github-check
32-
fi
33-
pre-commit run -a todo | reviewdog -efm="%f:%l: %m" -name=TODO -tee -reporter=$REPORTER -filter-mode nofilter
34-
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=$REPORTER -filter-mode nofilter
35-
env:
36-
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
EVENT: ${{ github.event_name }}
38-
- name: Lint
39-
run: pre-commit run -a --show-diff-on-failure
407
test:
418
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
429
name: py${{ matrix.python }}-${{ matrix.os }}
4310
strategy:
4411
matrix:
4512
os: [ubuntu]
46-
python: [3.7, 3.8, 3.9, '3.10', 3.11]
13+
python: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12]
4714
include:
48-
- os: macos
49-
python: 3.11
50-
- os: windows
51-
python: 3.11
52-
runs-on: ${{ matrix.os }}-latest
53-
defaults:
54-
run:
55-
shell: bash
15+
- {os: macos, python: 3.12}
16+
- {os: windows, python: 3.12}
17+
runs-on: ${{ matrix.os }}-${{ matrix.python == 3.7 && '22.04' || 'latest' }}
18+
defaults: {run: {shell: bash}}
5619
steps:
57-
- uses: actions/checkout@v3
58-
with:
59-
fetch-depth: 0
60-
- uses: actions/setup-python@v4
20+
- uses: actions/checkout@v4
21+
with: {fetch-depth: 0}
22+
- uses: actions/setup-python@v5
6123
with:
6224
python-version: ${{ matrix.python }}
6325
- name: Install
@@ -74,13 +36,12 @@ jobs:
7436
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7537
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7638
finish:
77-
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
7839
name: Coverage
7940
continue-on-error: ${{ github.event_name != 'push' }}
8041
needs: test
8142
runs-on: ubuntu-latest
8243
steps:
83-
- uses: actions/setup-python@v4
44+
- uses: actions/setup-python@v5
8445
with:
8546
python-version: '3.x'
8647
- name: Coveralls Finished
@@ -90,20 +51,20 @@ jobs:
9051
env:
9152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9253
deploy:
93-
needs: [check, test]
54+
needs: test
9455
runs-on: ubuntu-latest
56+
environment: pypi
57+
permissions: {contents: write, id-token: write, packages: write}
9558
steps:
96-
- uses: actions/checkout@v3
97-
with:
98-
fetch-depth: 0
99-
- uses: actions/setup-python@v4
59+
- uses: actions/checkout@v4
60+
with: {fetch-depth: 0}
61+
- uses: actions/setup-python@v5
10062
with:
10163
python-version: '3.x'
10264
- id: dist
10365
uses: casperdcl/deploy-pypi@v2
10466
with:
10567
build: true
106-
password: ${{ secrets.PYPI_TOKEN }}
10768
gpg_key: ${{ secrets.GPG_KEY }}
10869
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
10970
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ default_language_version:
22
python: python3
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.4.0
5+
rev: v5.0.0
66
hooks:
77
- id: check-added-large-files
88
- id: check-case-conflict
@@ -35,7 +35,7 @@ repos:
3535
additional_dependencies:
3636
- pytest-timeout
3737
- repo: https://github.com/PyCQA/flake8
38-
rev: 5.0.4
38+
rev: 7.1.2
3939
hooks:
4040
- id: flake8
4141
args: [-j8]
@@ -45,14 +45,15 @@ repos:
4545
- flake8-comprehensions
4646
- flake8-debugger
4747
- flake8-isort
48+
- flake8-pyproject
4849
- flake8-string-format
4950
- repo: https://github.com/google/yapf
50-
rev: v0.32.0
51+
rev: v0.43.0
5152
hooks:
5253
- id: yapf
5354
args: [-i, --exclude=argopt/_docopt.py]
5455
additional_dependencies: [toml]
5556
- repo: https://github.com/PyCQA/isort
56-
rev: 5.12.0
57+
rev: 6.0.1
5758
hooks:
5859
- id: isort

LICENCE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
* files: *
2-
MPLv2.0 2015-2023 (c) Casper da Costa-Luis
2+
MPLv2.0 2015-2025 (c) Casper da Costa-Luis
33
[casperdcl](https://github.com/casperdcl).
44

55

Makefile

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# IMPORTANT: for compatibility with `python setup.py make [alias]`, ensure:
1+
# IMPORTANT: for compatibility with `python -m pymake [alias]`, ensure:
22
# 1. Every alias is preceded by @[+]make (eg: @make alias)
33
# 2. A maximum of one @make alias or command per line
44
# see: https://github.com/tqdm/py-make/issues/1
@@ -8,7 +8,7 @@
88
all
99
flake8
1010
test
11-
testnose
11+
pytest
1212
testsetup
1313
testcoverage
1414
testtimer
@@ -17,15 +17,16 @@
1717
prebuildclean
1818
clean
1919
toxclean
20-
installdev
20+
install_build
21+
install_dev
2122
install
2223
build
2324
buildupload
2425
pypi
2526
none
2627

2728
help:
28-
@python setup.py make -p
29+
@python -m pymake -p
2930

3031
alltests:
3132
@+make testcoverage
@@ -37,24 +38,23 @@ all:
3738
@+make build
3839

3940
flake8:
40-
@+flake8 -j 8 --count --statistics --exit-zero .
41+
@+pre-commit run -a flake8
4142

4243
test:
4344
tox --skip-missing-interpreters -p all
4445

45-
testnose:
46-
nosetests -d -v tests/
46+
pytest:
47+
pytest
4748

4849
testsetup:
49-
python setup.py check --metadata --restructuredtext --strict
50-
python setup.py make none
50+
@make help
5151

5252
testcoverage:
5353
@make coverclean
54-
nosetests --with-coverage --cover-package=argopt --cover-erase --cover-min-percentage=80 -d -v tests/
54+
pytest --cov=argopt --cov-report=xml --cov-report=term --cov-fail-under=80
5555

5656
testtimer:
57-
nosetests --with-timer -d -v tests/
57+
pytest
5858

5959
distclean:
6060
@+make coverclean
@@ -79,22 +79,21 @@ clean:
7979
toxclean:
8080
@+python -c "import shutil; shutil.rmtree('.tox', True)"
8181

82-
83-
installdev:
84-
python setup.py develop --uninstall
85-
python setup.py develop
86-
8782
install:
88-
python setup.py install
83+
python -m pip install .
84+
install_dev:
85+
python -m pip install -e .
86+
install_build:
87+
python -m pip install -r .meta/requirements-build.txt
8988

9089
build:
9190
@make prebuildclean
9291
@make testsetup
93-
python setup.py sdist bdist_wheel
94-
# python setup.py bdist_wininst
92+
python -m build
93+
python -m twine check dist/*
9594

9695
pypi:
97-
twine upload dist/*
96+
python -m twine upload dist/*
9897

9998
buildupload:
10099
@make build

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,5 @@ We are grateful for all |GitHub-Contributions|.
260260
:target: https://www.openhub.net/p/arg-opt?ref=Thin+badge
261261
.. |LICENCE| image:: https://img.shields.io/pypi/l/argopt.svg?color=purple&logo=SPDX
262262
:target: https://raw.githubusercontent.com/casperdcl/argopt/master/LICENCE
263-
.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=argopt&style=social&r=https://github.com/casperdcl/argopt
264-
:target: https://caspersci.uk.to/cgi-bin/hits.cgi?q=argopt&a=plot&r=https://github.com/casperdcl/argopt&style=social
263+
.. |README-Hits| image:: https://cgi.cdcl.ml/hits?q=argopt&style=social&r=https://github.com/casperdcl/argopt
264+
:target: https://cgi.cdcl.ml/hits?q=argopt&a=plot&r=https://github.com/casperdcl/argopt&style=social

argopt/_argopt.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import logging
42
import re
53
from argparse import ArgumentParser, RawDescriptionHelpFormatter

0 commit comments

Comments
 (0)