diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..8a35911b --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +# The GitHub editor is 127 chars wide +max-line-length = 127 +max-complexity = 10 diff --git a/.gitignore b/.gitignore index 721bb86e..45dda35d 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ data/models/ELMo/en/cache data/models/ELMo/fr/cache data/sequenceLabelling/CoNLL-2012-NER/eng.* env +venv dist delft.egg-info build diff --git a/.travis.yml b/.travis.yml index 2f18b3f3..89f18543 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,9 @@ python: - 3.5 install: - pip install --upgrade pip - - pip install -r requirements.txt - - pip install flake8 + - make venv-create dev-install before_script: - # stop the build if there are Python syntax errors or undefined names - - flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - make flake8-syntax flake8-warning-only script: - true # add other tests here notifications: diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..095d8c3b --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +VENV = venv + +PIP = $(VENV)/bin/pip +PYTHON = $(VENV)/bin/python +RUN_GROBID_TAGGER = $(PYTHON) grobidTagger.py +USE_GPU = 0 + +ARGS = + + +venv-clean: + @if [ -d "$(VENV)" ]; then \ + rm -rf "$(VENV)"; \ + fi + + +venv-create: + virtualenv --system-site-packages -p python3 $(VENV) + + +dev-install: + $(PIP) install -r requirements.txt + $(PIP) install -r requirements.dev.txt + @if [ "$(USE_GPU)" -eq "1" ]; then \ + $(PIP) install -r requirements.gpu.txt; \ + else \ + $(PIP) install -r requirements.cpu.txt; \ + fi + + +dev-venv: venv-create dev-install + + +flake8-syntax: + # stop the build if there are Python syntax errors or undefined names + $(PYTHON) -m flake8 delft *.py --count --select=E901,E999,F821,F822,F823 --show-source --statistics + + +flake8-warning-only: + # exit-zero treats all errors as warnings. + $(PYTHON) -m flake8 delft *.py --count --exit-zero --statistics + + +flake8: + $(PYTHON) -m flake8 delft *.py + + +pylint: + $(PYTHON) -m pylint delft *.py + + +tests: flake8 pylint + + +grobid-tagger-train-header: + $(RUN_GROBID_TAGGER) header train $(ARGS) diff --git a/requirements.cpu.txt b/requirements.cpu.txt new file mode 100644 index 00000000..00ff3c23 --- /dev/null +++ b/requirements.cpu.txt @@ -0,0 +1 @@ +tensorflow==1.12.0 diff --git a/requirements.dev.txt b/requirements.dev.txt new file mode 100644 index 00000000..e8f840d5 --- /dev/null +++ b/requirements.dev.txt @@ -0,0 +1,2 @@ +flake8==3.7.7 +pylint==2.3.1 diff --git a/requirements.gpu.txt b/requirements.gpu.txt new file mode 100644 index 00000000..0a04a324 --- /dev/null +++ b/requirements.gpu.txt @@ -0,0 +1 @@ +tensorflow_gpu==1.12.0 diff --git a/requirements.txt b/requirements.txt index 47490656..f701a8f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,6 @@ bleach>=2.1.0 regex==2018.2.21 scikit-learn==0.19.1 tqdm==4.21 -tensorflow_gpu==1.12.0 gensim==3.4.0 langdetect==1.0.7 textblob==0.15.1