-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add project automation, fix tests, update package setup, add contribu…
…ting guidelines
- Loading branch information
Florimond Manca
committed
Jun 4, 2020
1 parent
6e33c3a
commit eddf26c
Showing
21 changed files
with
176 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Contributing guidelines | ||
|
||
To install development dependencies, run: | ||
|
||
```bash | ||
scripts/install | ||
``` | ||
|
||
Once this is done, you should be able to run the test suite: | ||
|
||
```bash | ||
scripts/test | ||
``` | ||
|
||
Code auto formatting can be run with: | ||
|
||
```bash | ||
scripts/format | ||
``` | ||
|
||
To run style checks, use: | ||
|
||
```bash | ||
scripts/style | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include README.md | ||
include CHANGELOG.md | ||
include LICENSE | ||
include mkdocs_click/py.typed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
# mkdocs-ext-click | ||
Extensions for mkdocs to read and parse click commands. | ||
# mkdocs-click | ||
|
||
## Usage | ||
An MkDocs extension to generate documentation for Click command line applications. | ||
|
||
Install the extension from the repo. At the moment there is no version of it on PyPI. | ||
## Installation | ||
|
||
```bash | ||
git clone https://github.com/DataDog/mkdocs-click.git | ||
cd mkdocs-click | ||
pip install . | ||
``` | ||
This package is not available on PyPI yet, but you can install it from git: | ||
|
||
If you use tox or a dynamic environment, you can add the following line to your requirements: | ||
```bash | ||
git+https://github.com/DataDog/mkdocs-click.git | ||
pip install git+https://github.com/DataDog/mkdocs-click.git | ||
``` | ||
|
||
Adds this to the `markdown_extensions` in your mkdocs.yml file: | ||
## Quickstart | ||
|
||
Register the extension in your `mkdocs.yml` configuration: | ||
|
||
```yaml | ||
# mkdocs.yml | ||
markdown_extensions: | ||
- mkdocs-click | ||
``` | ||
And finally to document a given click method, add this to any of your markdown file: | ||
To document a given Click command, add this in the body of a Markdown file: | ||
```markdown | ||
:::click module=<MODULE_PATH>:<CLICK_FUNCTION>::: | ||
:::click module=<MODULE_PATH>:<COMMAND>::: | ||
``` | ||
replacing `<MODULE_PATH>` and `<CLICK_METHOD>` as needed. | ||
Be sure to replace `<MODULE_PATH>` and `<COMMAND>` as appropriate. | ||
|
||
Example: | ||
|
||
```markdown | ||
:::click module=app.cli:build::: | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from .__version__ import __version__ | ||
from .extension import MKClickExtension, makeExtension | ||
|
||
__version__ = "0.0.1" | ||
__all__ = ["MKClickExtension", "makeExtension"] | ||
__all__ = ["__version__", "MKClickExtension", "makeExtension"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[tool.black] | ||
line-length = 120 | ||
target-version = ["py37"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-e . | ||
|
||
# Linters | ||
black | ||
flake8 | ||
mypy | ||
|
||
# Testing | ||
mock==4.* | ||
pytest==5.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#! /bin/sh -e | ||
|
||
BIN="venv/bin/" | ||
FILES="mkdocs_click tests" | ||
|
||
set -x | ||
|
||
${BIN}black $FILES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#! /bin/sh -e | ||
|
||
VENV="venv" | ||
BIN="$VENV/bin/" | ||
|
||
set -x | ||
|
||
python -m venv $VENV | ||
|
||
${BIN}pip install -U pip | ||
${BIN}pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/sh -e | ||
|
||
BIN="venv/bin/" | ||
FILES="mkdocs_click tests" | ||
|
||
set -x | ||
|
||
${BIN}black --check --diff $FILES | ||
${BIN}flake8 $FILES | ||
${BIN}mypy $FILES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#! /bin/sh -e | ||
|
||
VENV="venv" | ||
BIN="$VENV/bin/" | ||
|
||
set -x | ||
|
||
${BIN}pytest "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[flake8] | ||
ignore = E203,E722,E741,W503 | ||
max-line-length = 120 | ||
|
||
[mypy] | ||
disallow_untyped_defs = True | ||
ignore_missing_imports = True | ||
|
||
[mypy-tests.*] | ||
disallow_untyped_defs = False | ||
check_untyped_defs = True | ||
|
||
[tool:pytest] | ||
addopts = -rxXs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,47 @@ | ||
# (C) Datadog, Inc. 2020-present | ||
# All rights reserved | ||
# Licensed under the Apache license (see LICENSE) | ||
import re | ||
from pathlib import Path | ||
from setuptools import setup | ||
|
||
VERSION = "0.1.0" | ||
|
||
with open("requirements.in", 'r') as req: | ||
REQUIRES = req.read().splitlines() | ||
def get_version(package: str) -> str: | ||
text = Path(package, "__version__.py").read_text() | ||
match = re.search('__version__ = "([^"]+)"', text) | ||
assert match is not None | ||
return match.group(1) | ||
|
||
|
||
def get_long_description() -> str: | ||
readme = Path("README.md").read_text() | ||
changelog = Path("CHANGELOG.md").read_text() | ||
return f"{readme}\n\n{changelog}" | ||
|
||
|
||
setup( | ||
name="mkdocs_click", | ||
version=VERSION, | ||
description="An mkdocs extension to document click methods", | ||
version=get_version("mkdocs_click"), | ||
description="An MkDocs extension to generate documentation for Click command line applications", | ||
long_description=get_long_description(), | ||
long_description_content_type="text/markdown", | ||
keywords="mkdocs datadog click", | ||
url="https://github.com/DataDog/mkdocs-click", | ||
author="Datadog", | ||
author_email="[email protected]", | ||
license="Apache", | ||
packages=["mkdocs_click"], | ||
install_requires=REQUIRES, | ||
python_requires=">=3.0", | ||
install_requires=["click", "markdown"], | ||
python_requires=">=3.7", | ||
include_package_data=True, | ||
zip_safe=False, | ||
entry_points={"markdown.extensions": ["mkdocs-click = mkdocs_click:MKClickExtension"]}, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.