Skip to content

Commit 574a905

Browse files
authored
Fix running VIZ=1 after package installation + test (tinygrad#9183)
* test running viz from pip install * add pkg * do 10 connection attempts * include assets in package_data * quiet curl * better print
1 parent 1692087 commit 574a905

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/test.yml

+5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ jobs:
5353
source venv/bin/activate
5454
pip install $GITHUB_WORKSPACE
5555
python -c "from tinygrad.tensor import Tensor; print(Tensor([1,2,3,4,5]))"
56+
# Test using VIZ=1 after package installation
57+
VIZ=1 python -c "from tinygrad.tensor import Tensor; Tensor([1,2,3,4,5]).realize()" & VIZ_PID=$!
58+
echo "started VIZ server at: $(ps -p "$VIZ_PID" -o pid=)"
59+
i=0; while ((i++ < 10)); do curl -sSf localhost:8000 > /dev/null && break || { echo "VIZ verification attempt $i/10"; sleep 1; }; done; ((i > 10)) && echo "Could not verify VIZ server" && exit 1
60+
kill $VIZ_PID
5661
pip install mypy
5762
mypy -c "from tinygrad.tensor import Tensor; print(Tensor([1,2,3,4,5]))"
5863
- name: Run beautiful_mnist with tinygrad only

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
license='MIT',
1515
long_description=long_description,
1616
long_description_content_type='text/markdown',
17-
packages = ['tinygrad', 'tinygrad.runtime.autogen', 'tinygrad.codegen', 'tinygrad.nn', 'tinygrad.renderer', 'tinygrad.engine',
17+
packages = ['tinygrad', 'tinygrad.runtime.autogen', 'tinygrad.codegen', 'tinygrad.nn', 'tinygrad.renderer', 'tinygrad.engine', 'tinygrad.viz',
1818
'tinygrad.runtime', 'tinygrad.runtime.support', 'tinygrad.runtime.support.am', 'tinygrad.runtime.graph', 'tinygrad.shape'],
19-
package_data = {'tinygrad': ['py.typed']},
19+
package_data = {'tinygrad': ['py.typed'], 'tinygrad.viz': ['index.html', 'perfetto.html', 'assets/**/*']},
2020
classifiers=[
2121
"Programming Language :: Python :: 3",
2222
"License :: OSI Approved :: MIT License"

0 commit comments

Comments
 (0)