forked from nautechsystems/nautilus_trader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
170 lines (132 loc) · 4.45 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
PROJECT?=nautechsystems/nautilus_trader
REGISTRY?=ghcr.io/
IMAGE?=${REGISTRY}${PROJECT}
GIT_TAG:=$(shell git rev-parse --abbrev-ref HEAD)
IMAGE_FULL?=${IMAGE}:${GIT_TAG}
.PHONY: install
install:
BUILD_MODE=release poetry install --with dev,test --all-extras
.PHONY: install-debug
install-debug:
BUILD_MODE=debug poetry install --with dev,test --all-extras --sync
.PHONY: install-docs
install-docs:
BUILD_MODE=debug poetry install --with docs
.PHONY: install-just-deps
install-just-deps:
poetry install --with dev,test --all-extras --no-root
.PHONY: install-just-deps-all
install-just-deps-all:
poetry install --with dev,test,docs --all-extras --no-root
.PHONY: build
build:
BUILD_MODE=release poetry run python build.py
.PHONY: build-debug
build-debug:
BUILD_MODE=debug poetry run python build.py
.PHONY: build-wheel
build-wheel:
BUILD_MODE=release poetry build --format wheel
.PHONY: build-wheel-debug
build-wheel-debug:
BUILD_MODE=debug poetry build --format wheel
.PHONY: clean
clean:
git clean -fxd
.PHONY: format
format:
(cd nautilus_core && cargo +nightly fmt)
.PHONY: pre-commit
pre-commit:
pre-commit run --all-files
.PHONY: ruff
ruff:
ruff check . --fix
.PHONY: outdated
outdated:
(cd nautilus_core && cargo outdated && poetry show --outdated)
.PHONY: update cargo-update
update: cargo-update
poetry update
poetry install --with dev,test --all-extras --no-root
.PHONY: docs
docs: docs-python docs-rust
.PHONY: docs-python
docs-python: install-docs
poetry run sphinx-build -M markdown ./docs/api_reference ./api_reference
.PHONY: docs-rust
docs-rust:
(cd nautilus_core && RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo +nightly doc --all-features --no-deps --workspace --exclude tokio-tungstenite)
.PHONY: clippy
clippy:
(cd nautilus_core && cargo clippy --fix --all-targets --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used -W clippy::expect_used)
.PHONY: clippy-nightly
clippy-nightly:
(cd nautilus_core && cargo +nightly clippy --fix --all-targets --all-features --allow-dirty --allow-staged -- -D warnings -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used -W clippy::expect_used)
.PHONY: cargo-build
cargo-build:
(cd nautilus_core && cargo build --release --all-features)
.PHONY: cargo-update
cargo-update:
(cd nautilus_core && cargo update && cargo install cargo-nextest && cargo install cargo-llvm-cov)
.PHONY: cargo-test
cargo-test:
@if ! cargo nextest --version >/dev/null 2>&1; then \
echo "cargo-nextest is not installed. You can install it using 'cargo install cargo-nextest'"; \
exit 1; \
fi
RUST_BACKTRACE=1 && (cd nautilus_core && cargo nextest run --workspace --exclude tokio-tungstenite)
.PHONY: cargo-test-coverage
cargo-test-coverage:
@if ! cargo nextest --version >/dev/null 2>&1; then \
echo "cargo-nextest is not installed. You can install it using 'cargo install cargo-nextest'"; \
exit 1; \
fi
@if ! cargo llvm-cov --version >/dev/null 2>&1; then \
echo "cargo-llvm-cov is not installed. You can install it using 'cargo install cargo-llvm-cov'"; \
exit 1; \
fi
RUST_BACKTRACE=1 && (cd nautilus_core && cargo llvm-cov nextest run --workspace --exclude tokio-tungstenite)
.PHONY: cargo-bench
cargo-bench:
(cd nautilus_core && cargo bench)
.PHONY: cargo-doc
cargo-doc:
(cd nautilus_core && cargo doc)
.PHONY: docker-build
docker-build: clean
docker pull ${IMAGE_FULL} || docker pull ${IMAGE}:nightly || true
docker build -f .docker/nautilus_trader.dockerfile --platform linux/x86_64 -t ${IMAGE_FULL} .
.PHONY: docker-build-force
docker-build-force:
docker build --no-cache -f .docker/nautilus_trader.dockerfile -t ${IMAGE_FULL} .
.PHONY: docker-push
docker-push:
docker push ${IMAGE_FULL}
.PHONY: docker-build-jupyter
docker-build-jupyter:
docker build --build-arg GIT_TAG=${GIT_TAG} -f .docker/jupyterlab.dockerfile --platform linux/x86_64 -t ${IMAGE}:jupyter .
.PHONY: docker-push-jupyter
docker-push-jupyter:
docker push ${IMAGE}:jupyter
.PHONY: start-services
start-services:
docker-compose -f .docker/docker-compose.yml up -d
.PHONY: stop-services
stop-services:
docker-compose -f .docker/docker-compose.yml down
.PHONY: pytest
pytest:
bash scripts/test.sh
.PHONY: pytest-coverage
pytest-coverage:
bash scripts/test-coverage.sh
.PHONY: test-examples
test-examples:
bash scripts/test-examples.sh
.PHONY: install-talib
install-talib:
bash scripts/install-talib.sh
.PHONY: install-cli
install-cli:
(cd nautilus_core && cargo install --path cli --bin nautilus)