From 36f229449f31dc140ee286043ea5f1f0d90ce394 Mon Sep 17 00:00:00 2001 From: Malar Kannan Date: Fri, 4 Oct 2019 16:22:30 +0530 Subject: [PATCH] 1. remove unneeded files 2. add Makefile --- Makefile | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ __init__.py | 0 __main__.py | 4 --- common.mk | 33 ++++++++++++++++++ corpus.txt | 4 --- requirements.txt | 2 -- 6 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 Makefile delete mode 100644 __init__.py delete mode 100644 __main__.py create mode 100644 common.mk delete mode 100644 corpus.txt delete mode 100644 requirements.txt diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a157e33 --- /dev/null +++ b/Makefile @@ -0,0 +1,89 @@ +# Suitable for python monorepo with packages in subdirectories(contains project.mk) +.PHONY : _forward Makefile common.mk +.DEFAULT_GOAL := help +MAKE_PATH := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include ${MAKE_PATH}/common.mk + +clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts + +clean-build: ## remove build artifacts + rm -fr build/ + rm -fr dist/ + rm -fr .eggs/ + find . -name '*.egg-info' -exec rm -fr {} + + find . -name '*.egg' -exec rm -f {} + + +clean-pyc: ## remove Python file artifacts + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '*~' -exec rm -f {} + + find . -name '__pycache__' -exec rm -fr {} + + +clean-test: ## remove test and coverage artifacts + rm -fr .tox/ + rm -f .coverage + rm -fr htmlcov/ + rm -fr .pytest_cache + +lint: ## check style with flake8 + flake8 sia tests + +test: ## run tests quickly with the default Python + python setup.py test + +test-all: ## run tests on every Python version with tox + tox + +coverage: ## check code coverage quickly with the default Python + coverage run --source sia -m pytest + coverage report -m + coverage html + $(BROWSER) htmlcov/index.html + +docs: ## generate Sphinx HTML documentation, including API docs + rm -f docs/sia.rst + rm -f docs/modules.rst + sphinx-apidoc -o docs/ sia + $(MAKE) -C docs clean + $(MAKE) -C docs html + $(BROWSER) docs/_build/html/index.html + +servedocs: docs ## compile the docs watching for changes + watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . + +release: dist pypi ## package and upload a release to local pypi server + twine upload -u "" -p "" --repository-url http://localhost:8080 dist/* + +dist: clean ## builds source and wheel package + python setup.py sdist + python setup.py bdist_wheel + ls -l dist + +install: clean pypi ## install the package to the active Python's site-packages + python setup.py install + +check: ## lint project using pre-commit hooks installed for git + pre-commit run --all-files + +setup: + python -m nltk.downloader stopwords + rm -rf logs + mkdir logs + +install-reqs: + pip install -r requirements.txt + +install-dev-reqs: + pip install -r requirements_dev.txt + +install: uninstall pypi install-reqs setup ## installs the requirements and download components + +uninstall: ## uninstalls the pip dependencies + pip uninstall -y -r requirements.txt + +deploy: ## deploys the services by starting supervisord + supervisord + +develop: uninstall pypi install-dev-reqs setup ## installs the requirements and setup development hooks + pre-commit install diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/__main__.py b/__main__.py deleted file mode 100644 index 920c67a..0000000 --- a/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .taco2.tts import main - -if __name__ == '__main__': - main() diff --git a/common.mk b/common.mk new file mode 100644 index 0000000..013d2ad --- /dev/null +++ b/common.mk @@ -0,0 +1,33 @@ +# Contains automatic help generator based comments on target +# and other utilities + +define BROWSER_PYSCRIPT +import os, webbrowser, sys + +try: + from urllib import pathname2url +except: + from urllib.request import pathname2url + +webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) +endef +export BROWSER_PYSCRIPT + +define PRINT_HELP_PYSCRIPT +import re, sys + +for line in sys.stdin: + match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) + if match: + target, help = match.groups() + print("%-20s %s" % (target, help)) +endef +export PRINT_HELP_PYSCRIPT + +BROWSER := python -c "$$BROWSER_PYSCRIPT" + + + + +help: ## make TARGET forwards the TARGET to sub packages + @cat $(MAKEFILE_LIST) | python -c "$$PRINT_HELP_PYSCRIPT" diff --git a/corpus.txt b/corpus.txt deleted file mode 100644 index 64314d7..0000000 --- a/corpus.txt +++ /dev/null @@ -1,4 +0,0 @@ -Hello world! -How have you been? -Today is a good day. -This seems to be working good diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ba4d322..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy==1.17.2 -torch==1.2.0