-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
143 lines (104 loc) · 4.96 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
# system python interpreter. used only to create virtual environment
PY = python3
VENV = venv
BIN=$(VENV)/bin
SHELL=/bin/bash
# make it work on windows too
ifeq ($(OS), Windows_NT)
BIN=$(VENV)/Scripts
PY=python
endif
all: venv run
venv:
: # Create venv if it doesn't exist
test -d $(VENV) || ($(PY) -m venv $(VENV) && $(BIN)/pip install -r requirements.txt)
install: venv
. $(BIN)/activate && pip install -r requirements.txt
examples-install: venv
. $(BIN)/activate && pip install -r examples/requirements.txt --quiet
develop: venv
. $(BIN)/activate && maturin develop
build: venv
. $(BIN)/activate && maturin build
run: develop
. $(BIN)/activate && ./examples/ngrok-http-minimal.py
run-aio: develop examples-install
. $(BIN)/activate && python ./examples/aiohttp-ngrok.py
run-http2: develop examples-install
. $(BIN)/activate && python ./examples/hypercorn-http2-ngrok.py
run-forward-full: develop
. $(BIN)/activate && python ./examples/ngrok-forward-full.py
run-forward-minimal: develop
. $(BIN)/activate && python ./examples/ngrok-forward-minimal.py
run-django: develop examples-install
. $(BIN)/activate && python ./examples/django-single-file.py
# Run django using the manage.py which is auto-generated by "django-admin startproject"
# The manage.py file has the ngrok listener setup code.
run-djangosite: develop examples-install
. $(BIN)/activate && python ./examples/djangosite/manage.py runserver localhost:1234
# Run django ASGI via uvicorn. The ngrok-asgi.py file has the ngrok listener setup code.
run-django-uvicorn: develop examples-install
. $(BIN)/activate && pushd ./examples/djangosite && python -m uvicorn djangosite.ngrok-asgi:application
# Run django ASGI via gunicorn. The ngrok-asgi.py file has the ngrok listener setup code.
run-django-gunicorn: develop examples-install
. $(BIN)/activate && pushd ./examples/djangosite && python -m gunicorn djangosite.ngrok-asgi:application -k uvicorn.workers.UvicornWorker
# Run ngrok ASGI via uvicorn. The python/ngrok/__main__.py file has the ngrok listener setup code.
run-ngrok-uvicorn: develop examples-install
. $(BIN)/activate && pushd ./examples/djangosite && python -m ngrok uvicorn djangosite.asgi:application $(args)
# Run ngrok ASGI via gunicorn. The python/ngrok/__main__.py file has the ngrok listener setup code.
run-ngrok-gunicorn: develop examples-install
. $(BIN)/activate && pushd ./examples/djangosite && python -m ngrok gunicorn djangosite.asgi:application -k uvicorn.workers.UvicornWorker $(args)
# Run ngrok-asgi script via uvicorn. The python/ngrok/__main__.py file has the ngrok listener setup code.
run-ngrok-asgi: develop examples-install
. $(BIN)/activate && pushd ./examples/djangosite && ngrok-asgi uvicorn djangosite.asgi:application $(args)
run-flask: develop examples-install
. $(BIN)/activate && python ./examples/flask-ngrok.py
run-gradio: develop
. $(BIN)/activate && pip install -r examples/gradio/requirements.txt
. $(BIN)/activate && gradio ./examples/gradio/gradio-ngrok.py
run-gradio-asgi: develop
. $(BIN)/activate && pip install -r examples/gradio/requirements.txt
. $(BIN)/activate && ngrok-asgi uvicorn examples.gradio.gradio-asgi:demo.app --port 7860 --reload
run-tornado: develop examples-install
. $(BIN)/activate && python ./examples/tornado-ngrok.py
run-streamlit: develop examples-install
. $(BIN)/activate && pushd ./examples/streamlit && python streamlit-ngrok.py
run-full: develop
. $(BIN)/activate && ./examples/ngrok-http-full.py
run-labeled: develop
. $(BIN)/activate && ./examples/ngrok-labeled.py
run-openplayground: develop
. $(BIN)/activate && pip install -r examples/openplayground/requirements.txt
. $(BIN)/activate && python examples/openplayground/run.py
run-gpt4all: develop
. $(BIN)/activate && pip install -r examples/gpt4all/requirements.txt --quiet
. $(BIN)/activate && python examples/gpt4all/run.py
run-tcp: develop
. $(BIN)/activate && ./examples/ngrok-tcp.py
run-tls: develop
. $(BIN)/activate && ./examples/ngrok-tls.py
run-uvicorn: develop examples-install
. $(BIN)/activate && python ./examples/uvicorn-ngrok.py
mypy: develop
. $(BIN)/activate && mypy ./examples/ngrok-forward-minimal.py
. $(BIN)/activate && mypy ./examples/ngrok-forward-full.py
. $(BIN)/activate && mypy ./examples/ngrok-http-minimal.py
. $(BIN)/activate && mypy ./examples/ngrok-http-full.py
. $(BIN)/activate && mypy ./examples/ngrok-labeled.py
. $(BIN)/activate && mypy ./examples/ngrok-tcp.py
. $(BIN)/activate && mypy ./examples/ngrok-tls.py
# e.g.: make test='-k TestNgrok.test_gzip_listener' test
test: develop
. $(BIN)/activate && python -m unittest discover test $(test)
# testfast is called by github workflow in ci.yml
testfast: develop
. $(BIN)/activate && py.test -n 4 ./test/test*.py
testpublish:
. $(BIN)/activate && maturin publish --repository testpypi
docs: clean develop black docsfast
docsfast : develop
. $(BIN)/activate && sphinx-build -a -E -b html doc_source/ docs/
black: develop
. $(BIN)/activate && black examples/ test/ python/
clean:
rm -rf $(VENV) target/