Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc framework updates #139

Merged
merged 5 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
with:
python-version: ${{ matrix.python }}
- name: Install
run: pip install -U -r requirements-dev.txt
run: pip install -U -e .[dev]
- run: pytest
- uses: codecov/codecov-action@v3
deploy:
Expand All @@ -70,7 +70,6 @@ jobs:
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
requirements: twine setuptools wheel setuptools_scm[toml]
build: true
password: ${{ secrets.PYPI_TOKEN }}
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
__pycache__/

# Packages
/shtab/_dist_ver.py
/MANIFEST.in
/*.egg*/
/shtab/_dist_ver.py
/build/
/dist/
/docs/build/
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ repos:
- flake8-comprehensions
- flake8-debugger
- flake8-isort
- flake8-pyproject
- flake8-string-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies: [types-setuptools]
- repo: https://github.com/google/yapf
rev: v0.32.0
rev: v0.33.0
hooks:
- id: yapf
args: [-i]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When contributing pull requests, it's a good idea to run basic checks locally:

```bash
# install development dependencies
shtab (main)$ pip install pre-commit -r requirements-dev.txt
shtab (main)$ pip install pre-commit -e .[dev]
shtab (main)$ pre-commit install # install pre-commit checks
shtab (main)$ pytest # run all tests
```
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkdocs-material
git+https://github.com/tqdm/jsmin@python3-only#egg=jsmin
mkdocs-minify-plugin
pydoc-markdown>=4
pydoc-markdown>=4,!=4.8.0
pygments
pymdown-extensions>=9
112 changes: 112 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,115 @@ requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
[tool.setuptools_scm]
write_to = "shtab/_dist_ver.py"
write_to_template = "__version__ = '{version}'\n"

[tool.setuptools.packages.find]
exclude = ["docs", "tests", "examples"]

[tool.setuptools.exclude-package-data]
"*" = ["logo.png"]

[project.urls]
documentation = "https://docs.iterative.ai/shtab"
repository = "https://github.com/iterative/shtab"
changelog = "https://github.com/iterative/shtab/releases"

[project]
name = "shtab"
dynamic = ["version"]
authors = [{name = "Casper da Costa-Luis", email = "casper.dcl@physics.org"}]
maintainers = [{name = "Iterative", email = "support@iterative.ai"}]
description = "Automagic shell tab completion for Python CLI applications"
readme = "README.rst"
requires-python = ">=3.7"
keywords = ["tab", "complete", "completion", "shell", "bash", "zsh", "argparse"]
license = {text = "Apache-2.0"}
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 :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"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",
"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",
"Topic :: System :: Installation/Setup",
"Topic :: System :: Shells",
"Topic :: System :: System Shells",
"Topic :: Terminals",
"Topic :: Utilities"]

[project.optional-dependencies]
dev = ["pytest>=6", "pytest-cov", "pytest-timeout"]

[project.scripts]
shtab = "shtab.main:main"

[tool.flake8]
max_line_length = 99
extend_ignore = ["E261", "P101"]
exclude = [".git", "__pycache__", "build", "dist", ".eggs"]

[tool.yapf]
spaces_before_comment = [15, 20]
arithmetic_precedence_indication = true
allow_split_before_dict_value = false
coalesce_brackets = true
column_limit = 99
each_dict_entry_on_separate_line = false
space_between_ending_comma_and_closing_bracket = false
split_before_named_assigns = false
split_before_closing_bracket = false
blank_line_before_nested_class_or_def = false

[tool.isort]
profile = "black"
line_length = 99
known_first_party = ["shtab", "tests"]

[tool.mypy]
warn_unused_configs = true
warn_unused_ignores = true
show_error_codes = true

[tool.pytest.ini_options]
minversion = "6.0"
timeout = 5
log_level = "DEBUG"
python_files = ["test_*.py"]
testpaths = ["tests"]
addopts = "-v --tb=short -rxs -W=error --durations=0 --cov=shtab --cov-report=term-missing --cov-report=xml"
3 changes: 0 additions & 3 deletions requirements-dev.txt

This file was deleted.

115 changes: 0 additions & 115 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

5 changes: 2 additions & 3 deletions shtab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,8 @@ def format_optional(opt):
return (('{nargs}{options}"[{help}]"' if isinstance(
opt, FLAG_OPTION) else '{nargs}{options}"[{help}]:{dest}:{pattern}"').format(
nargs=('"(- : *)"' if is_opt_end(opt) else '"*"' if is_opt_multiline(opt) else ""),
options=("{{{}}}".format(",".join(opt.option_strings))
if len(opt.option_strings) > 1 else '"{}"'.format("".join(
opt.option_strings))),
options=("{{{}}}".format(",".join(opt.option_strings)) if len(opt.option_strings)
> 1 else '"{}"'.format("".join(opt.option_strings))),
help=escape_zsh(opt.help or ""),
dest=opt.dest,
pattern=complete2pattern(opt.complete, "zsh", choice_type2fn) if hasattr(
Expand Down