-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (58 loc) · 2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
POETRY = poetry run
PYTHON = $(POETRY) python
MAKE = $(POETRY) make
# Add local bin to path, so we can use poetry
DOTLOCAL := $(HOME)/.local
POETRY_HOME := $(DOTLOCAL)/share/pypoetry
COURSIER_HOME := $(DOTLOCAL)/share/coursier
PATH := $(PATH):$(POETRY_HOME)/bin:$(COURSIER_HOME)
export PATH
export POETRY_HOME
export COURSIER_HOME
ifeq ($(OS),Windows_NT)
error "Windows is not supported"
else
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Linux)
# For Linux with AARCH64 / ARM64 we cannot install JAX yet, as they
# do not provide wheels for this architecture. https://github.com/google/jax/issues/7097
ifeq ($(UNAME_M),x86_64)
# Linux 64-bit
POETRY_FLAGS := --extras "jax"
endif
else
POETRY_FLAGS := --extras "jax"
endif
endif
.PHONY: test docs
clean:
find . -name "*.pyc" -delete
find . -name "__pycache__" -delete
rm -rf .pytest_cache .mypy_cache .coverage || true
rm -rf dist build || true
setup:
test "$$(command -v java)" || (echo "PySpark requires Java 8 or later" && exit 1)
test "$$(command -v sbt)" || \
(./scripts/install-scala.sh $(COURSIER_HOME) || \
(echo "Unable to install Scala compiler. Please install sbt (Scala compiler; please see https://www.scala-lang.org/download/)" && \
exit 1) \
)
test "$$(command -v poetry)" || (mkdir -p $(POETRY_HOME) && curl -sSL https://install.python-poetry.org | python3 -)
poetry install --without docs $(POETRY_FLAGS)
test_ldsc: setup
$(PYTHON) -m pytest -vv --cov=ldsc tests/ldsc
test_funkea: setup
$(PYTHON) -m pytest -vv --cov=funkea tests/funkea
test_scala:
cd scala/spark-udf && sbt clean test
test: test_funkea test_ldsc test_scala
docs: setup
poetry install --only docs
$(MAKE) -C docs/source html
publish:
# we build the wheel first to ensure that we have the latest jars compiled
# then we build the sdist for the actual distribution (containing the jar)
# this is very hacky, but it works
poetry build --format wheel && rm -rf dist && poetry build --format sdist
poetry publish -u __token__