Skip to content

Commit

Permalink
Adds docs tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
HazardDede committed May 4, 2020
1 parent 7a3dc2d commit 3c78618
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 66 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,11 @@

pip install pnp

Optional extras

* dht: Enables `pnp.plugins.pull.sensor.DHT` (temperature and humidity sensor). Only works on ARM-based systems (like raspberry, arduino)
* fswatcher: Enables `pnp.plugins.pull.fs.FileSystemWatcher` (Watch file system for created, modified,
deleted, moved files)
* faceR: Enables `pnp.plugins.push.ml.FaceR` (Screen image files for known faces)

Installation with extras:

pip install pnp[fswatcher,faceR]
# In case of extra 'dht' you have to enable the option --process-dependency-links ...
# ... cause the required adafruit package is not on pypi.
pip install --process-dependency-links pnp[dht]

Please see the component documentation to see if a compponent requires an extra or not.

<a name="gettingstarted"></a>

Expand Down
11 changes: 1 addition & 10 deletions README.mdpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@

pip install pnp

Optional extras

* dht: Enables `pnp.plugins.pull.sensor.DHT` (temperature and humidity sensor). Only works on ARM-based systems (like raspberry, arduino)
* fswatcher: Enables `pnp.plugins.pull.fs.FileSystemWatcher` (Watch file system for created, modified,
deleted, moved files)
* faceR: Enables `pnp.plugins.push.ml.FaceR` (Screen image files for known faces)

Installation with extras:

pip install pnp[fswatcher,faceR]
# In case of extra 'dht' you have to enable the option --process-dependency-links ...
# ... cause the required adafruit package is not on pypi.
pip install --process-dependency-links pnp[dht]

Please see the component documentation to see if a compponent requires an extra or not.

## Getting started

Expand Down
26 changes: 17 additions & 9 deletions tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
from invoke import Collection, task

from tasks import docker
from tasks import linting
from tasks import testing
from tasks import (
docker,
docs,
linting,
testing
)
from tasks.config import VERSION

ns = Collection()

docker = Collection.from_module(docker, name="docker")
linting = Collection.from_module(linting, name="lint")
testing = Collection.from_module(testing, name="test")


@task
def version(ctx):
print(VERSION)


ns = Collection()

docker = Collection.from_module(docker, name="docker")
docs = Collection.from_module(docs, name="docs")
linting = Collection.from_module(linting, name="lint")
testing = Collection.from_module(testing, name="test")

# Subtasks
ns.add_collection(docker)
ns.add_collection(docs)
ns.add_collection(linting)
ns.add_collection(testing)

# Tasks
ns.add_task(version)
1 change: 1 addition & 0 deletions tasks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
DOCS_PATH = os.path.join(PROJECT_ROOT, 'docs')
SCRIPTS_PATH = os.path.join(PROJECT_ROOT, 'scripts')
SOURCE_PATH = os.path.join(PROJECT_ROOT, 'pnp')
TASKS_PATH = os.path.join(PROJECT_ROOT, 'tasks')
TEST_PATH = os.path.join(PROJECT_ROOT, 'tests')

# DOCKER STUFF
Expand Down
30 changes: 30 additions & 0 deletions tasks/docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import glob
import os

import MarkdownPP
from invoke import task


def process_directory(directory):
for file_path in glob.iglob(os.path.join(directory, '**/*.mdpp'), recursive=True):
process_file(file_path)


def process_file(file_path):
modules = MarkdownPP.modules.keys()
with open(file_path, 'r') as mdpp:
# Output file takes filename from input file but has .md extension
with open(os.path.splitext(file_path)[0] + '.md', 'w') as md:
MarkdownPP.MarkdownPP(input=mdpp, output=md, modules=modules)


@task(default=True)
def docs(ctx):
"""Creates the markdown documentation."""
process_directory('docs/plugins/pull')
process_directory('docs/plugins/push')
process_directory('docs/plugins/udf')
process_file('docs/plugins/README.mdpp')
process_file('docs/engines/README.mdpp')
process_file('docs/README.mdpp')
process_file('README.mdpp')
2 changes: 1 addition & 1 deletion tasks/linting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
CONFIGS_PATH,
DOCS_PATH,
SCRIPTS_PATH,
SOURCE_PATH,
SOURCE_PATH
)


Expand Down
23 changes: 0 additions & 23 deletions tasks/release.py
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
# next-version: lint test-configs test
# $(eval NEXT_VERSION := $(shell bumpversion --dry-run --allow-dirty --list $(VERSION_PART) | grep new_version | sed s,"^.*=",,))
# @echo Next version is $(NEXT_VERSION)
# bumpversion $(VERSION_PART)
# @echo "Review your version changes first"
# @echo "Accept your version: \`make accept-version\`"
# @echo "Revoke your version: \`make revoke-version\`"
#
# accept-version:
# git push && git push --tags
#
# revoke-version:
# git tag -d `git describe --tags --abbrev=0` # delete the tag
# git reset --hard HEAD~1 # rollback the commit
#
# dist:
# poetry build
#
# release-test: dist
# poetry publish --repository testpypi
#
# release: dist
# poetry publish
13 changes: 0 additions & 13 deletions tasks/testing.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# pytest:
# pytest --verbose --color=yes \
# --durations=10 \
# --doctest-modules \
# --cov=$(SOURCE_PATH) --cov-report html --cov-report term $(TEST_PATH) \
# $(SOURCE_PATH)
#
# doctest:
# pytest --verbose --color=yes --doctest-modules $(SOURCE_PATH)
#
# test: test-configs pytest


from invoke import task

from tasks.config import (
Expand Down

0 comments on commit 3c78618

Please sign in to comment.