Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrogr committed Sep 22, 2017
0 parents commit 48b48bc
Show file tree
Hide file tree
Showing 61 changed files with 1,895 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[run]
branch = True

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

ignore_errors = True
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

# Docstrings and comments use max_line_length = 79
[*.py]
max_line_length = 119

# Makefiles always use tabs for indentation
[Makefile]
indent_style = tab
indent_size = 8
54 changes: 54 additions & 0 deletions .env.gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

show_help () {
cat <<-HELP
usage: ${0##*/} [options] filename required_vars
options:
-h, --help Show this document
params:
filename The file name to be written
required_vars The file that list the variables checked and/or created
HELP
exit 1
}


create_file () {
[ ! -f $filename ] && touch $filename
# INFO: It needs to read in first place the file so we need to redirect the stdin to /dev/fd/3 for user input
{ cat $required_vars | while IFS= read line; do
# INFO: ${VAR%%PATTERN} removes from the end, so you can list required variables with help texts
varname=${line%% *}
if [[ ! -e "${varname}" ]] && ! grep "^${varname}" $filename; then
cat <<-hint >&2
please set $line:
hint
read -u 3 question
echo "${varname}=${question}" >> $filename
echo >&2
fi
done } 3<&0
exit 0
}

# Parse args
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
show_help
;;

*)
[ "${1##-*}" != "" ] && filename="$1" && \
[ "${2##-*}" != "" ] && [ -f $2 ] && required_vars="$2" \
&& shift && shift
;;
esac
shift
done

[[ -n ${required_vars} && -n ${filename} ]] && create_file

show_help
3 changes: 3 additions & 0 deletions .env.required
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BROKER_URI
DATABASE_URI
SCAN_PATH
142 changes: 142 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@

# Created by https://www.gitignore.io/api/python,pycharm

### IntelliJ ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea/

# CMake
cmake-build-debug/

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### PyCharm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# *.ipr

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
coverage-reports/
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env*
!.env.gen
!.env.required

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# End of https://www.gitignore.io/api/python,pycharm
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing

Want to hack on deeptracy Director? Awesome! Here are instructions to get you
started. They are probably not perfect, please let us know if anything
feels wrong or incomplete.

In general, we follow the "fork-and-pull" Git workflow.

1. **Fork** this repo
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull request** so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

If your pull request is not accepted on the first try, don't be
discouraged! If there's a problem with the implementation, hopefully you
received feedback on what to improve.

Submit unit tests for your changes. Python has a great test framework built
in; use it! Take a look at existing tests for inspiration. Run the full
test suite on your branch before submitting a pull request.

Make sure you include relevant updates or additions to documentation
when creating or modifying features.

## Before Pull Request
Please, run tox :)
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.6

# install docker
RUN curl -sSL https://get.docker.com/ | /bin/bash

# add sources
RUN mkdir /tmp/install
ADD . /tmp/install

# install sources and romove them
WORKDIR /tmp/install
RUN pip install -U .
RUN rm -rf /tmp/install

# add run script
RUN mkdir /opt/deeptracy
ADD run.sh /opt/deeptracy
RUN chmod +x /opt/deeptracy/run.sh

CMD ["/opt/deeptracy/run.sh"]
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BBVA
85 changes: 85 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.DEFAULT_GOAL := help

# AutoEnv
ENV ?= .env
ENV_GEN := $(shell ./.env.gen ${ENV} .env.required)
include ${ENV}
export $(shell sed 's/=.*//' ${ENV})


# AutoDoc
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

.PHONY: help
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

.PHONY: clean
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

.PHONY: clean-build
clean-build: ## remove build artifacts
rm -rf build dist .eggs .cache
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

.PHONY: clean-pyc
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 {} +

.PHONY: clean-test
clean-test: ## remove test and coverage artifacts
rm -rf .tox .coverage htmlcov coverage-reports

.PHONY: test
test: install ## run tests quickly with the default Python
python -m unittest discover -s tests/unit

.PHONY: test-all
test-all: ## run tests on every Python version with tox
tox

install-%:
pip install -r $*.txt -U

.PHONY: lint
lint: ## check style with flake8
flake8 deeptracy

.PHONY: coverage
coverage: install ## check code coverage
coverage run --source=deeptracy -m unittest discover -s tests/unit
coverage report -m --fail-under 80
coverage xml -o coverage-reports/report.xml

.PHONY: install
install:
pip install -U .

.PHONY: docs
docs: ## generate and shows documentation
@make -C docs spelling html

.PHONY: run
run: ## local run the app
./run.sh

.PHONY: demo
demo: ## local run the app
python demo.py

.PHONY: behave
behave: ## run behave tests
behave tests/behave/features
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# deeptracy Worker
2 changes: 2 additions & 0 deletions deeptracy/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

__version__ = '0.0.1'

0 comments on commit 48b48bc

Please sign in to comment.