Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Add a Windows specific Makefile and some instructions #302

Merged
merged 5 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ logs/*
.tox/
.python-version

sent2vec
41 changes: 26 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
.DEFAULT_GOAL := all

VIRTUALENV := build/virtualenv
PYTHON_VERSION := python3.8

ifeq ($(OS), Windows_NT)
# for CYGWIN*|MINGW32*|MSYS*|MINGW*
PYTHON_VERSION := C://Python38/python
VENV_BIN := $(VIRTUALENV)/Scripts
else
PYTHON_VERSION := python3.8
VENV_BIN := $(VIRTUALENV)/bin
endif

$(VIRTUALENV)/.installed:
@if [ -d $(VIRTUALENV) ]; then rm -rf $(VIRTUALENV); fi
@mkdir -p $(VIRTUALENV)
virtualenv --python $(PYTHON_VERSION) $(VIRTUALENV)
$(VIRTUALENV)/bin/pip3 install -r requirements_test.txt
$(VIRTUALENV)/bin/pip3 install -r docs/requirements.txt # Installs requirements to docs
$(VIRTUALENV)/bin/pip3 install -e .[deep-learning]
$(VIRTUALENV)/bin/pip3 install hdbscan --no-cache-dir --no-binary :all: --no-build-isolation
$(PYTHON_VERSION) -m venv $(VIRTUALENV)
$(VENV_BIN)/pip3 install -r requirements_test.txt
$(VENV_BIN)/pip3 install -r docs/requirements.txt # Installs requirements to docs
$(VENV_BIN)/pip3 install -e .[deep-learning]
$(VENV_BIN)/pip3 install hdbscan --no-cache-dir --no-binary :all: --no-build-isolation
touch $@

.PHONY: update-docs
update-docs:
$(VIRTUALENV)/bin/sphinx-apidoc --no-toc -d 5 -H WellcomeML -o ./docs -f wellcomeml
. $(VIRTUALENV)/bin/activate && cd docs && make html
$(VENV_BIN)/sphinx-apidoc --no-toc -d 5 -H WellcomeML -o ./docs -f wellcomeml
. $(VENV_BIN)/activate && cd docs && make html

.PHONY: virtualenv
virtualenv: $(VIRTUALENV)/.installed
Expand All @@ -28,15 +36,18 @@ dist: update-docs
# Spacy is require for testing spacy_to_prodigy

$(VIRTUALENV)/.models:
$(VIRTUALENV)/bin/python -m spacy download en_core_web_sm
$(VENV_BIN)/python -m spacy download en_core_web_sm
touch $@

$(VIRTUALENV)/.deep_learning_models:
# $(VIRTUALENV)/bin/python -m spacy download en_trf_bertbaseuncased_lg
# $(VENV_BIN)/python -m spacy download en_trf_bertbaseuncased_lg
touch $@

$(VIRTUALENV)/.non_pypi_packages:
$(VIRTUALENV)/bin/pip install git+https://github.com/epfml/sent2vec.git
# Install from local git directory - pip install [address] fails on Windows
git clone https://github.com/epfml/sent2vec.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nightmare! :S I am not sure how much we use sent2vec at the moment, maybe we should drop it. @nsorros ?

$(VENV_BIN)/pip install sent2vec
@rm -rf sent2vec
touch $@

.PHONY: download_models
Expand All @@ -50,14 +61,14 @@ download_nonpypi_packages: $(VIRTUALENV)/.installed $(VIRTUALENV)/.non_pypi_pack

.PHONY: test
test: $(VIRTUALENV)/.models $(VIRTUALENV)/.deep_learning_models $(VIRTUALENV)/.non_pypi_packages
$(VIRTUALENV)/bin/tox
$(VENV_BIN)/tox

.PHONY: test-integrations
test-integrations:
$(VIRTUALENV)/bin/pytest -m "integration" -s -v --disable-warnings --tb=line ./tests
$(VENV_BIN)/pytest -m "integration" -s -v --disable-warnings --tb=line ./tests

.PHONY: run_codecov
run_codecov:
$(VIRTUALENV)/bin/python -m codecov
$(VENV_BIN)/python -m codecov

all: virtualenv
all: virtualenv test
19 changes: 19 additions & 0 deletions WINDOWS_USERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Installation on Windows machines
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


## Requirements
This package requires an up to date Windows 10, as well as the following:
- Visual Studio Build tools 2019 with `Desktop Development with C++` installed
- Python 3.8 installed at the root of your machine (the Makefile will look for it in C://Python38)
- Administration rights
- GNU Make
- The Makefile will assume the `OS` environment variable is set to its default value
- (Optional but recommended) Cygwin


## Installation
Run the following Makefile:
`make virtualenv`

## Tests
Running tests might take a bit of time on the first run, as you will need to download some models and build a few libraries.
`make test`