Skip to content

Commit e5a5182

Browse files
committed
Base skeleton
Signed-off-by: Bernát Gábor <[email protected]>
0 parents  commit e5a5182

File tree

14 files changed

+457
-0
lines changed

14 files changed

+457
-0
lines changed

.github/workflows/check.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: check
2+
on:
3+
push:
4+
pull_request:
5+
schedule:
6+
- cron: "0 8 * * *"
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v1
13+
- uses: actions/setup-python@v1
14+
- uses: pre-commit/[email protected]
15+
16+
test:
17+
name: test ${{ matrix.py }} - ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os:
23+
- Ubuntu
24+
py:
25+
- 3.9
26+
- 3.8
27+
- 3.7
28+
steps:
29+
- name: setup python for tox
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: 3.9
33+
- name: install tox
34+
run: python -m pip install tox
35+
- uses: actions/checkout@v2
36+
- name: setup python for test ${{ matrix.py }}
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.py }}
40+
- name: pick environment to run
41+
run: |
42+
import subprocess; import json; import os
43+
major, minor, impl = json.loads(subprocess.check_output(["python", "-c", "import json; import sys; import platform; print(json.dumps([sys.version_info[0], sys.version_info[1], platform.python_implementation()]));"], universal_newlines=True))
44+
with open(os.environ['GITHUB_ENV'], 'a') as file_handler:
45+
file_handler.write('TOXENV=' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else ("3" if major == 3 else "")) + "\n")
46+
shell: python
47+
- name: setup test suite
48+
run: tox -vv --notest
49+
- name: run test suite
50+
run: tox --skip-pkg-install
51+
env:
52+
PYTEST_ADDOPTS: "-vv --durations=20"
53+
CI_RUN: "yes"
54+
DIFF_AGAINST: HEAD
55+
- name: rename coverage report file
56+
run: |
57+
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
58+
shell: python
59+
- uses: codecov/codecov-action@v1
60+
with:
61+
file: ./.tox/coverage.xml
62+
flags: tests
63+
name: ${{ matrix.py }} - ${{ matrix.os }}
64+
65+
check:
66+
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
67+
runs-on: ${{ matrix.os }}-latest
68+
strategy:
69+
fail-fast: false
70+
matrix:
71+
os:
72+
- Ubuntu
73+
tox_env:
74+
- type
75+
- dev
76+
- pkg_check
77+
steps:
78+
- uses: actions/checkout@v2
79+
- name: setup Python 3.9
80+
uses: actions/setup-python@v2
81+
with:
82+
python-version: 3.9
83+
- name: install tox
84+
run: python -m pip install tox
85+
- name: run check for ${{ matrix.tox_env }}
86+
run: python -m tox -e ${{ matrix.tox_env }}
87+
env:
88+
UPGRADE_ADVISORY: "yes"
89+
90+
publish:
91+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
92+
needs: [check, test, pre-commit]
93+
runs-on: ubuntu-latest
94+
steps:
95+
- name: setup python to build package
96+
uses: actions/setup-python@v2
97+
with:
98+
python-version: 3.9
99+
- name: install build
100+
run: python -m pip install build
101+
- uses: actions/checkout@v2
102+
- name: build package
103+
run: python -m build --sdist --wheel . -o dist
104+
- name: publish to PyPI
105+
uses: pypa/gh-action-pypi-publish@master
106+
with:
107+
skip_existing: true
108+
user: __token__
109+
password: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea
2+
*.egg-info/
3+
.tox/
4+
.coverage*
5+
coverage.xml
6+
.*_cache
7+
__pycache__
8+
**.pyc
9+
build
10+
dist
11+
src/sphinx_argparse_cli/version.py

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.4.0
4+
hooks:
5+
- id: check-builtin-literals
6+
- id: check-docstring-first
7+
- id: check-yaml
8+
- id: check-toml
9+
- id: debug-statements
10+
- id: end-of-file-fixer
11+
- id: trailing-whitespace
12+
- repo: https://github.com/asottile/pyupgrade
13+
rev: v2.9.0
14+
hooks:
15+
- id: pyupgrade
16+
- repo: https://github.com/PyCQA/isort
17+
rev: 5.7.0
18+
hooks:
19+
- id: isort
20+
- repo: https://github.com/psf/black
21+
rev: 20.8b1
22+
hooks:
23+
- id: black
24+
args: [--safe]
25+
language_version: python3.9
26+
- repo: https://github.com/asottile/setup-cfg-fmt
27+
rev: v1.16.0
28+
hooks:
29+
- id: setup-cfg-fmt
30+
- repo: https://github.com/tox-dev/tox-ini-fmt
31+
rev: "0.5.0"
32+
hooks:
33+
- id: tox-ini-fmt
34+
- repo: https://github.com/PyCQA/flake8
35+
rev: "3.8.4"
36+
hooks:
37+
- id: flake8
38+
additional_dependencies: ["flake8-bugbear == 20.1.4"]

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## unreleased
6+
7+
- First version.

CODE_OF_CONDUCT.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making
6+
participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7+
disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race,
8+
religion, or sexual identity and orientation.
9+
10+
## Our Standards
11+
12+
Examples of behavior that contributes to creating a positive environment include:
13+
14+
- Using welcoming and inclusive language
15+
- Being respectful of differing viewpoints and experiences
16+
- Gracefully accepting constructive criticism
17+
- Focusing on what is best for the community
18+
- Showing empathy towards other community members
19+
20+
Examples of unacceptable behavior by participants include:
21+
22+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
23+
- Trolling, insulting/derogatory comments, and personal or political attacks
24+
- Public or private harassment
25+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
26+
- Other conduct which could reasonably be considered inappropriate in a professional setting
27+
28+
## Our Responsibilities
29+
30+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31+
appropriate and fair corrective action in response to any instances of unacceptable behavior.
32+
33+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34+
issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35+
contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
36+
37+
## Scope
38+
39+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
40+
project or its community. Examples of representing a project or community include using an official project e-mail
41+
address, posting via an official social media account, or acting as an appointed representative at an online or offline
42+
event. Representation of a project may be further defined and clarified by project maintainers.
43+
44+
## Enforcement
45+
46+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47+
[email protected]. The project team will review and investigate all complaints, and will respond in a way that it
48+
deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the
49+
reporter of an incident. Further details of specific enforcement policies may be posted separately.
50+
51+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
52+
repercussions as determined by other members of the project's leadership.
53+
54+
## Attribution
55+
56+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
57+
[https://www.contributor-covenant.org/version/1/4/code-of-conduct.html][version]
58+
59+
[homepage]: https://www.contributor-covenant.org/
60+
[version]: https://www.contributor-covenant.org/version/1/4/

LICENSE.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Permission is hereby granted, free of charge, to any person obtaining a
2+
copy of this software and associated documentation files (the
3+
"Software"), to deal in the Software without restriction, including
4+
without limitation the rights to use, copy, modify, merge, publish,
5+
distribute, sublicense, and/or sell copies of the Software, and to
6+
permit persons to whom the Software is furnished to do so, subject to
7+
the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included
10+
in all copies or substantial portions of the Software.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
16+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
17+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
18+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# sphinx-argparse-cli
2+
3+
[![PyPI](https://img.shields.io/pypi/v/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
4+
[![PyPI - Implementation](https://img.shields.io/pypi/implementation/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
5+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/sphinx-argparse-cli?style=flat-square)](https://pypi.org/project/sphinx-argparse-cli)
6+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/sphinx-argparse-cli?style=flat-square)](https://pypistats.org/packages/sphinx-argparse-cli)
7+
[![PyPI - License](https://img.shields.io/pypi/l/sphinx-argparse-cli?style=flat-square)](https://opensource.org/licenses/MIT)
8+
![check](https://github.com/gaborbernat/sphinx-argparse-cli/workflows/check/badge.svg?branch=main)
9+
[![codecov](https://codecov.io/gh/gaborbernat/sphinx-argparse-cli/branch/main/graph/badge.svg)](https://codecov.io/gh/pypa/virtualenv)
10+
[![Code style:
11+
black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
12+
13+
Render CLI arguments (sub-commands friendly) defined by argparse module.
14+
15+
## installation
16+
17+
`pip install sphinx-argparse-cli`

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build-system]
2+
requires = ["setuptools >= 44", "wheel >= 0.30", "setuptools_scm[toml]>=3.4"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.black]
6+
line-length = 120
7+
8+
[tool.isort]
9+
profile = "black"
10+
known_first_party = ["sphinx_argparse_cli"]
11+
12+
[tool.setuptools_scm]
13+
write_to = "src/sphinx_argparse_cli/version.py"
14+
write_to_template = """
15+
\"\"\" Version information \"\"\"
16+
17+
__version__ = "{version}"
18+
"""

setup.cfg

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[metadata]
2+
name = sphinx_argparse_cli
3+
description = render CLI arguments (sub-commands friendly) defined by argparse module
4+
long_description = file: README.md
5+
long_description_content_type = text/markdown
6+
url = https://github.com/gaborbernat/sphinx-argparse-cli
7+
author = Bernat Gabor
8+
author_email = [email protected]
9+
maintainer = Bernat Gabor
10+
maintainer_email = [email protected]
11+
license = MIT
12+
license_file = LICENSE.txt
13+
platforms = any
14+
classifiers =
15+
Development Status :: 5 - Production/Stable
16+
Framework :: tox
17+
Intended Audience :: Developers
18+
License :: OSI Approved :: MIT License
19+
Programming Language :: Python :: 3
20+
Programming Language :: Python :: 3 :: Only
21+
Programming Language :: Python :: 3.6
22+
Programming Language :: Python :: 3.7
23+
Programming Language :: Python :: 3.8
24+
Programming Language :: Python :: 3.9
25+
Programming Language :: Python :: Implementation :: CPython
26+
Programming Language :: Python :: Implementation :: PyPy
27+
Topic :: Utilities
28+
keywords = tox, formatter
29+
project_urls =
30+
Source=https://github.com/gaborbernat/sphinx-argparse-cli
31+
Tracker=https://github.com/gaborbernat/sphinx-argparse-cli/issues
32+
33+
[options]
34+
packages = find:
35+
install_requires =
36+
sphinx>=3
37+
python_requires = >=3.6
38+
include_package_data = True
39+
package_dir =
40+
=src
41+
zip_safe = True
42+
43+
[options.extras_require]
44+
test =
45+
pytest>=4
46+
pytest-cov>=2.7
47+
48+
[options.package_data]
49+
sphinx_argparse_cli = py.typed
50+
51+
[options.packages.find]
52+
where = src
53+
54+
[flake8]
55+
max-line-length = 120
56+
ignore = F401, H301, E203
57+
58+
[coverage:report]
59+
show_missing = True
60+
exclude_lines =
61+
\#\s*pragma: no cover
62+
^\s*raise AssertionError\b
63+
^\s*raise NotImplementedError\b
64+
^\s*raise$
65+
^if __name__ == ['"]__main__['"]:$
66+
67+
[coverage:paths]
68+
source =
69+
src
70+
.tox/*/lib/python*/site-packages
71+
.tox/pypy*/site-packages
72+
.tox\*\Lib\site-packages\
73+
*/src
74+
*\src
75+
76+
[coverage:run]
77+
branch = true
78+
parallel = true
79+
dynamic_context = test_function
80+
source =
81+
${_COVERAGE_SRC}
82+
83+
[coverage:html]
84+
show_contexts = true
85+
skip_covered = false
86+
skip_empty = true

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from setuptools import setup
2+
3+
setup()

0 commit comments

Comments
 (0)