Skip to content

Commit

Permalink
Merge pull request #27 from iterative/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Dec 28, 2020
2 parents 1dc36c7 + 6b0eef8 commit 2cd1933
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 215 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/comment-bot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Comment Bot
on:
issue_comment:
types: [created, edited]
types: [created]
pull_request_review_comment:
types: [created, edited]

types: [created]
jobs:
tag: # /tag <tagname> <commit>
if: startsWith(github.event.comment.body, '/tag ')
Expand All @@ -21,7 +20,6 @@ jobs:
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
if (!["admin", "write"].includes(perm.data.permission)){
post({
owner: context.repo.owner, repo: context.repo.repo,
Expand Down Expand Up @@ -50,7 +48,3 @@ jobs:
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "rocket"})
always:
runs-on: ubuntu-latest
steps:
- run: echo prevent failure when other jobs are skipped
36 changes: 27 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,42 @@ name: Test
on: [push, pull_request]
jobs:
check:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install -U -r requirements-dev.txt twine
- run: python setup.py check -mrs
- run: pre-commit run --all-files
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- run: pip install -U -r requirements-dev.txt
- run: python setup.py sdist bdist_wheel
- run: twine check dist/*
- uses: reviewdog/action-setup@v1
- run: |
pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=github-check -filter-mode nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: pre-commit run -a --show-diff-on-failure
test:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
name: Test py${{ matrix.python }}
needs: check
runs-on: ubuntu-latest
strategy:
matrix:
python: [2.7, 3.8]
python: [2.7, 3.6, 3.9]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
Expand All @@ -30,28 +47,29 @@ jobs:
deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
name: PyPI Deploy
needs: test
needs: [check, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: casperdcl/deploy-pypi@v1
with:
password: ${{ secrets.pypi_token }}
password: ${{ secrets.PYPI_TOKEN }}
build: true
- id: collect_assets
name: Collect assets
run: |
echo "::set-output name=asset_path::$(ls dist/*.whl)"
echo "::set-output name=asset_name::$(basename dist/*.whl)"
git fetch --unshallow --tags
git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD > _CHANGES.md
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: shtab ${{ github.ref }} alpha
release_name: shtab ${{ github.ref }} beta
body_path: _CHANGES.md
draft: true
- uses: actions/upload-release-asset@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.py[cod]
/shtab/_dist_ver.py

# Packages
shtab.egg-info/
Expand Down
43 changes: 25 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-string-format
repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- hooks:
- args:
- -l
- '79'
- -t
- py27
id: black
language_version: python3
- id: black
repo: https://github.com/psf/black
rev: 19.10b0
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- hooks:
- id: isort
language_version: python3
repo: https://github.com/timothycrosley/isort
rev: 4.3.21
- hooks:
- id: flake8
language_version: python3
repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
rev: 5.6.4
10 changes: 0 additions & 10 deletions MANIFEST.in

This file was deleted.

6 changes: 5 additions & 1 deletion examples/docopt-greeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
<you> : Your name [default: Anon]
<me> : My name [default: Casper]
"""
import sys, argopt, shtab # NOQA
import sys # NOQA

import argopt

import shtab

parser = argopt.argopt(__doc__)
shtab.add_argument_to(parser, ["-s", "--print-completion"]) # magic!
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "shtab/_dist_ver.py"
write_to_template = "__version__ = '{version}'\n"

[tool.black]
target-version = ['py27', 'py36']
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pre-commit
twine
wheel
pytest
pytest-cov
87 changes: 76 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,18 +1,83 @@
[metadata]
name=shtab
description=Automatically generate shell tab completion scripts for python CLI apps
long_description=file: README.rst
long_description_content_type=text/x-rst
license=Apache-2.0
license_file=LICENCE
url=https://github.com/iterative/shtab
project_urls=
Changelog=https://github.com/iterative/shtab/releases
Documentation=https://github.com/iterative/shtab/#shtab
maintainer=Casper da Costa-Luis
maintainer_email[email protected]
keywords=tab, complete, completion, shell, bash, zsh, argparse
platforms=any
provides=shtab
classifiers=
Development Status :: 4 - Beta
Environment :: Console
Environment :: MacOS X
Environment :: Other Environment
Intended Audience :: Developers
Intended Audience :: Education
Intended Audience :: End Users/Desktop
Intended Audience :: Other Audience
Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License
Operating System :: MacOS
Operating System :: MacOS :: MacOS X
Operating System :: POSIX
Operating System :: POSIX :: BSD
Operating System :: POSIX :: BSD :: FreeBSD
Operating System :: POSIX :: Linux
Operating System :: POSIX :: SunOS/Solaris
Operating System :: Unix
Programming Language :: Other Scripting Engines
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: Implementation
Programming Language :: Python :: Implementation :: IronPython
Programming Language :: Python :: Implementation :: PyPy
Programming Language :: Unix Shell
Topic :: Desktop Environment
Topic :: Education :: Computer Aided Instruction (CAI)
Topic :: Education :: Testing
Topic :: Office/Business
Topic :: Other/Nonlisted Topic
Topic :: Software Development :: Build Tools
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules
Topic :: Software Development :: Pre-processors
Topic :: Software Development :: User Interfaces
Topic :: System :: Installation/Setup
Topic :: System :: Shells
Topic :: System :: System Shells
Topic :: Terminals
Topic :: Utilities
[options]
setup_requires=setuptools>=42; setuptools_scm[toml]>=3.4
install_requires=
argparse; python_version < "2.7" or ("3.0" <= python_version and python_version < "3.2")
python_requires= >=2.7, !=3.0.*, !=3.1.*
packages=find:
[options.entry_points]
console_scripts=
shtab=shtab.main:main
[bdist_wheel]
universal=1

[flake8]
max_line_length=79
ignore=
W503
D100
D103
D105
exclude=.tox,build,dist,.git,__pycache__
max_line_length=88
extend-ignore=E203,P1
exclude=build,dist,.eggs,.git,__pycache__

[isort]
include_trailing_comma=true
profile=black
known_first_party=shtab
known_third_party=argopt,pytest
line_length=79
multi_line_output=3
Loading

0 comments on commit 2cd1933

Please sign in to comment.