Skip to content

Commit 2cd1933

Browse files
authored
Merge pull request #27 from iterative/devel
2 parents 1dc36c7 + 6b0eef8 commit 2cd1933

File tree

13 files changed

+173
-215
lines changed

13 files changed

+173
-215
lines changed

.github/workflows/comment-bot.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: Comment Bot
22
on:
33
issue_comment:
4-
types: [created, edited]
4+
types: [created]
55
pull_request_review_comment:
6-
types: [created, edited]
7-
6+
types: [created]
87
jobs:
98
tag: # /tag <tagname> <commit>
109
if: startsWith(github.event.comment.body, '/tag ')
@@ -21,7 +20,6 @@ jobs:
2120
post = (context.eventName == "issue_comment"
2221
? github.reactions.createForIssueComment
2322
: github.reactions.createForPullRequestReviewComment)
24-
2523
if (!["admin", "write"].includes(perm.data.permission)){
2624
post({
2725
owner: context.repo.owner, repo: context.repo.repo,
@@ -50,7 +48,3 @@ jobs:
5048
post({
5149
owner: context.repo.owner, repo: context.repo.repo,
5250
comment_id: context.payload.comment.id, content: "rocket"})
53-
always:
54-
runs-on: ubuntu-latest
55-
steps:
56-
- run: echo prevent failure when other jobs are skipped

.github/workflows/test.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,42 @@ name: Test
22
on: [push, pull_request]
33
jobs:
44
check:
5+
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
56
name: Check
67
runs-on: ubuntu-latest
78
steps:
89
- uses: actions/checkout@v2
10+
with:
11+
fetch-depth: 0
912
- uses: actions/setup-python@v2
1013
with:
1114
python-version: '3.x'
12-
- run: pip install -U -r requirements-dev.txt twine
13-
- run: python setup.py check -mrs
14-
- run: pre-commit run --all-files
15+
- name: set PYSHA
16+
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
17+
- uses: actions/cache@v1
18+
with:
19+
path: ~/.cache/pre-commit
20+
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
21+
- run: pip install -U -r requirements-dev.txt
22+
- run: python setup.py sdist bdist_wheel
23+
- run: twine check dist/*
24+
- uses: reviewdog/action-setup@v1
25+
- run: |
26+
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=github-check -filter-mode nofilter
27+
env:
28+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- run: pre-commit run -a --show-diff-on-failure
1530
test:
31+
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
1632
name: Test py${{ matrix.python }}
17-
needs: check
1833
runs-on: ubuntu-latest
1934
strategy:
2035
matrix:
21-
python: [2.7, 3.8]
36+
python: [2.7, 3.6, 3.9]
2237
steps:
2338
- uses: actions/checkout@v2
39+
with:
40+
fetch-depth: 0
2441
- uses: actions/setup-python@v2
2542
with:
2643
python-version: ${{ matrix.python }}
@@ -30,28 +47,29 @@ jobs:
3047
deploy:
3148
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
3249
name: PyPI Deploy
33-
needs: test
50+
needs: [check, test]
3451
runs-on: ubuntu-latest
3552
steps:
3653
- uses: actions/checkout@v2
54+
with:
55+
fetch-depth: 0
3756
- uses: casperdcl/deploy-pypi@v1
3857
with:
39-
password: ${{ secrets.pypi_token }}
58+
password: ${{ secrets.PYPI_TOKEN }}
4059
build: true
4160
- id: collect_assets
4261
name: Collect assets
4362
run: |
4463
echo "::set-output name=asset_path::$(ls dist/*.whl)"
4564
echo "::set-output name=asset_name::$(basename dist/*.whl)"
46-
git fetch --unshallow --tags
4765
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
4866
- id: create_release
4967
uses: actions/create-release@v1
5068
env:
5169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5270
with:
5371
tag_name: ${{ github.ref }}
54-
release_name: shtab ${{ github.ref }} alpha
72+
release_name: shtab ${{ github.ref }} beta
5573
body_path: _CHANGES.md
5674
draft: true
5775
- uses: actions/upload-release-asset@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.py[cod]
2+
/shtab/_dist_ver.py
23

34
# Packages
45
shtab.egg-info/

.pre-commit-config.yaml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1+
default_language_version:
2+
python: python3
13
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v2.4.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-case-conflict
9+
- id: check-docstring-first
10+
- id: check-executables-have-shebangs
11+
- id: check-toml
12+
- id: check-yaml
13+
- id: end-of-file-fixer
14+
- id: mixed-line-ending
15+
- id: trailing-whitespace
16+
- hooks:
17+
- id: flake8
18+
additional_dependencies:
19+
- flake8-bugbear
20+
- flake8-comprehensions
21+
- flake8-debugger
22+
- flake8-string-format
23+
repo: https://gitlab.com/pycqa/flake8
24+
rev: 3.8.4
225
- hooks:
3-
- args:
4-
- -l
5-
- '79'
6-
- -t
7-
- py27
8-
id: black
9-
language_version: python3
26+
- id: black
1027
repo: https://github.com/psf/black
1128
rev: 19.10b0
12-
- repo: https://github.com/asottile/seed-isort-config
13-
rev: v2.2.0
14-
hooks:
15-
- id: seed-isort-config
1629
- hooks:
1730
- id: isort
18-
language_version: python3
1931
repo: https://github.com/timothycrosley/isort
20-
rev: 4.3.21
21-
- hooks:
22-
- id: flake8
23-
language_version: python3
24-
repo: https://gitlab.com/pycqa/flake8
25-
rev: 3.8.3
32+
rev: 5.6.4

MANIFEST.in

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/docopt-greeter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
<you> : Your name [default: Anon]
1212
<me> : My name [default: Casper]
1313
"""
14-
import sys, argopt, shtab # NOQA
14+
import sys # NOQA
15+
16+
import argopt
17+
18+
import shtab
1519

1620
parser = argopt.argopt(__doc__)
1721
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
write_to = "shtab/_dist_ver.py"
7+
write_to_template = "__version__ = '{version}'\n"
8+
9+
[tool.black]
10+
target-version = ['py27', 'py36']

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
pre-commit
2+
twine
3+
wheel
24
pytest
35
pytest-cov

setup.cfg

Lines changed: 76 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,83 @@
1+
[metadata]
2+
name=shtab
3+
description=Automatically generate shell tab completion scripts for python CLI apps
4+
long_description=file: README.rst
5+
long_description_content_type=text/x-rst
6+
license=Apache-2.0
7+
license_file=LICENCE
8+
url=https://github.com/iterative/shtab
9+
project_urls=
10+
Changelog=https://github.com/iterative/shtab/releases
11+
Documentation=https://github.com/iterative/shtab/#shtab
12+
maintainer=Casper da Costa-Luis
13+
maintainer_email[email protected]
14+
keywords=tab, complete, completion, shell, bash, zsh, argparse
15+
platforms=any
16+
provides=shtab
17+
classifiers=
18+
Development Status :: 4 - Beta
19+
Environment :: Console
20+
Environment :: MacOS X
21+
Environment :: Other Environment
22+
Intended Audience :: Developers
23+
Intended Audience :: Education
24+
Intended Audience :: End Users/Desktop
25+
Intended Audience :: Other Audience
26+
Intended Audience :: System Administrators
27+
License :: OSI Approved :: Apache Software License
28+
Operating System :: MacOS
29+
Operating System :: MacOS :: MacOS X
30+
Operating System :: POSIX
31+
Operating System :: POSIX :: BSD
32+
Operating System :: POSIX :: BSD :: FreeBSD
33+
Operating System :: POSIX :: Linux
34+
Operating System :: POSIX :: SunOS/Solaris
35+
Operating System :: Unix
36+
Programming Language :: Other Scripting Engines
37+
Programming Language :: Python
38+
Programming Language :: Python :: 2
39+
Programming Language :: Python :: 2.7
40+
Programming Language :: Python :: 3
41+
Programming Language :: Python :: 3.6
42+
Programming Language :: Python :: 3.7
43+
Programming Language :: Python :: 3.8
44+
Programming Language :: Python :: 3.9
45+
Programming Language :: Python :: Implementation
46+
Programming Language :: Python :: Implementation :: IronPython
47+
Programming Language :: Python :: Implementation :: PyPy
48+
Programming Language :: Unix Shell
49+
Topic :: Desktop Environment
50+
Topic :: Education :: Computer Aided Instruction (CAI)
51+
Topic :: Education :: Testing
52+
Topic :: Office/Business
53+
Topic :: Other/Nonlisted Topic
54+
Topic :: Software Development :: Build Tools
55+
Topic :: Software Development :: Libraries
56+
Topic :: Software Development :: Libraries :: Python Modules
57+
Topic :: Software Development :: Pre-processors
58+
Topic :: Software Development :: User Interfaces
59+
Topic :: System :: Installation/Setup
60+
Topic :: System :: Shells
61+
Topic :: System :: System Shells
62+
Topic :: Terminals
63+
Topic :: Utilities
64+
[options]
65+
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
66+
install_requires=
67+
argparse; python_version < "2.7" or ("3.0" <= python_version and python_version < "3.2")
68+
python_requires= >=2.7, !=3.0.*, !=3.1.*
69+
packages=find:
70+
[options.entry_points]
71+
console_scripts=
72+
shtab=shtab.main:main
173
[bdist_wheel]
274
universal=1
375

476
[flake8]
5-
max_line_length=79
6-
ignore=
7-
W503
8-
D100
9-
D103
10-
D105
11-
exclude=.tox,build,dist,.git,__pycache__
77+
max_line_length=88
78+
extend-ignore=E203,P1
79+
exclude=build,dist,.eggs,.git,__pycache__
1280

1381
[isort]
14-
include_trailing_comma=true
82+
profile=black
1583
known_first_party=shtab
16-
known_third_party=argopt,pytest
17-
line_length=79
18-
multi_line_output=3

0 commit comments

Comments
 (0)