Skip to content

Commit e47b6fa

Browse files
DOC update readme about wasm wheels (#186)
1 parent c1a4e43 commit e47b6fa

File tree

4 files changed

+150
-153
lines changed

4 files changed

+150
-153
lines changed

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,10 @@ For more information about free-threaded CPython, check `how to install a free-t
113113

114114
Support WASM Wheels
115115
-------------------
116-
fastcan is compiled to WebAssembly (WASM) wheels using `pyodide <https://github.com/pyodide/pyodide>`_, and they are available on the assets of GitHub releases.
117-
You can try it in a `REPL <https://pyodide.org/en/stable/console.html>`_ directly in a browser.
116+
fastcan is compiled to WebAssembly (WASM) wheels using `pyodide <https://github.com/pyodide/pyodide>`_.
117+
You can try it in a `REPL <https://pyodide.org/en/stable/console.html>`_ directly in a browser, without installation.
118+
However, the version of fastcan may be delayed in pyodide. If the latest fastcan WASM wheels are required, you can find them
119+
on the assets of GitHub releases, and the installation is required.
118120
The WASM wheels of fastcan can be installed by
119121

120122
>>> import micropip # doctest: +SKIP

pixi.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
[workspace]
2+
channels = ["conda-forge"]
3+
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64", "linux-aarch64"]
4+
5+
[dependencies]
6+
python = ">=3.10"
7+
scikit-learn = ">=1.7.0,!=1.7.1"
8+
cython = ">=3.1.0" # build dependencies
9+
meson-python = ">=0.18.0" # build dependencies
10+
11+
[target.osx-64.dependencies]
12+
compilers = "*" # build dependencies
13+
14+
[target.osx-arm64.dependencies]
15+
compilers = "*" # build dependencies
16+
17+
[pypi-dependencies]
18+
fastcan = { path = ".", editable = true }
19+
20+
[feature.docs.dependencies]
21+
pydata-sphinx-theme = "*"
22+
matplotlib = "*"
23+
pandas = "*"
24+
sphinx-gallery = "*"
25+
sphinx-design = "*"
26+
sphinxcontrib-plantuml = "*"
27+
jupyterlite-sphinx = "*"
28+
jupyterlite-xeus = "*"
29+
pip = "*" # Required by xeus environment creation
30+
graphviz = "<13"
31+
32+
[feature.docs.target.win-64.dependencies]
33+
plantuml = "*"
34+
35+
[feature.docs.target.linux-64.dependencies]
36+
plantuml = "*"
37+
38+
[feature.docs.target.osx-arm64.dependencies]
39+
plantuml = "*"
40+
41+
[feature.docs.target.osx-64.dependencies]
42+
plantuml = "*"
43+
44+
[feature.wasm.dependencies]
45+
pip = "*"
46+
pyodide-build = "*"
47+
prettier = "*"
48+
49+
[feature.asv.dependencies]
50+
asv = "*"
51+
libmambapy = "*"
52+
conda-build = "*"
53+
54+
[feature.jupyter.dependencies]
55+
notebook = "*"
56+
matplotlib = "*"
57+
pyarrow = "*"
58+
59+
[feature.test.dependencies]
60+
pytest = "*"
61+
pytest-cov = "*"
62+
pandas = "*"
63+
64+
[feature.static.dependencies]
65+
# Static analysis tools
66+
ruff = "*"
67+
cython-lint = "*"
68+
mypy = "*"
69+
codespell = "*"
70+
71+
72+
[feature.build.dependencies]
73+
python-build = "*"
74+
pip = "*"
75+
76+
[feature.nogil.dependencies]
77+
python-freethreading = "*"
78+
cython = ">=3.1.0" # build dependencies
79+
meson-python = ">=0.18.0" # build dependencies
80+
81+
[feature.nogil.pypi-dependencies]
82+
scikit-learn = ">=1.7.0,!=1.7.1"
83+
fastcan = { path = ".", editable = true }
84+
85+
[tasks]
86+
time-h = "python -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, verbose=0).fit(X, y)'"
87+
time-eta = "python -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, eta=True, verbose=0).fit(X, y)'"
88+
profile-minibatch = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan import minibatch; X = np.random.rand(100, 3000); y = np.random.rand(100, 20); cProfile.run('minibatch(X, y, 1000, 10, verbose=0)', sort='{{ SORT }}')"''', args = [{ arg = "SORT", default = "cumtime" }] }
89+
time-narx = '''python -m timeit -n 1 -s "import numpy as np; from fastcan.narx import make_narx; rng = np.random.default_rng(5); X = rng.random((1000, 10)); y = rng.random((1000, 2)); m = make_narx(X, y, 10, max_delay=2, poly_degree=2, verbose=0)" "m.fit(X, y, coef_init='one_step_ahead', verbose=1)"'''
90+
profile-narx = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan.narx import make_narx; rng = np.random.default_rng(8); X = rng.random((3000, 3)); y = rng.random((3000, 3)); m = make_narx(X, y, 10, max_delay=10, poly_degree=2, verbose=0); cProfile.run('m.fit(X, y, coef_init=[0]*33)', sort='{{ SORT }}')"''', args = [{ arg = "SORT", default = "tottime" }] }
91+
92+
[feature.asv.tasks]
93+
asv-build = { cmd = "python -m asv machine --machine {{ MACHINE }} --yes && python -m asv run --show-stderr -v --machine {{ MACHINE }} {{ EXTRA_ARGS }}", cwd = "asv_benchmarks", args = [{ arg = "MACHINE", default = "MacOS-M1" }, { arg = "EXTRA_ARGS", default = "" }] }
94+
asv-publish = { cmd = "python -m asv publish", cwd = "asv_benchmarks" }
95+
asv-preview = { cmd = "python -m asv preview", cwd = "asv_benchmarks", depends-on = ["asv-publish"] }
96+
97+
[feature.test.tasks]
98+
test = "pytest"
99+
test-coverage = { cmd = "rm -rf .coverage && pytest --cov-report {{ FMT }} --cov={{ PACKAGE }}", args = [{ arg = "FMT", default = "html" }, { arg = "PACKAGE", default = "fastcan" }] }
100+
101+
[feature.build.tasks]
102+
build-wheel = "rm -rf dist && python -m build -wnx -Cinstall-args=--tags=runtime,python-runtime,devel"
103+
build-sdist = "rm -rf dist && python -m build --sdist"
104+
rebuild = "rm -rf build && pip install --no-deps --force-reinstall -e ."
105+
106+
[feature.static.tasks]
107+
fmt = "ruff format"
108+
lint = "ruff check . --fix"
109+
cython-lint = { cmd = "cython-lint .", cwd = "fastcan" }
110+
type = { cmd = "mypy . --ignore-missing-imports", cwd = "fastcan" }
111+
spell = "codespell fastcan"
112+
113+
[feature.docs.tasks]
114+
doc = { cmd = "{{ SPHINXBUILD }} -M {{ CMD }} {{ SOURCEDIR }} {{ BUILDDIR }} {{ SPHINXOPTS }} --fail-on-warning", cwd = "doc", args = [{ arg = "SPHINXBUILD", default = "sphinx-build" }, { arg = "CMD", default = "html" }, { arg = "SOURCEDIR", default = "." }, { arg = "BUILDDIR", default = "_build" }, { arg = "SPHINXOPTS", default = "" }] }
115+
doc-clean = { cmd = "rm -rf {{ BUILDDIR }} generated auto_examples jupyterlite_contents .jupyterlite.doit.db _contents _output .cache", cwd = "doc", args = [{ arg = "BUILDDIR", default = "_build" }] }
116+
doc-deploy = { cmd = "python -m http.server" , cwd = "doc/_build/html" }
117+
doc-plantuml = { cmd = "plantuml -tsvg {{ SOURCE }} -o {{ OUTPUT }}", cwd = "doc", args = [{ arg = "SOURCE", default = "diagram.puml" }, { arg = "OUTPUT", default = "_build" }] }
118+
# The setting (pixi config set --local run-post-link-scripts insecure) is required before install the environment,
119+
# otherwise graphviz will not generate its plugin config. See:
120+
# https://github.com/prefix-dev/pixi/blob/8aad97b5ac6482cdf0d3167fdaf0cb26328cc9c4/CHANGELOG.md?plain=1#L899
121+
doc-plantuml-test = "plantuml -testdot"
122+
doc-jupyterlite-debug = { cmd = "jupyter-lite build --debug --output-dir {{ OUTPUT }}", cwd = "doc", args = [{ arg = "OUTPUT", default = "_output" }] }
123+
124+
125+
[feature.nogil.tasks]
126+
nogil-h = "python -Xgil=0 -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, verbose=0).fit(X, y)'"
127+
nogil-eta = "python -Xgil=0 -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, eta=True, verbose=0).fit(X, y)'"
128+
129+
[feature.wasm.tasks]
130+
emsdk-clone = "bash -c '[ -d emsdk ] || git clone https://github.com/emscripten-core/emsdk.git emsdk'"
131+
pyodide-compatible = "pyodide xbuildenv search -a"
132+
pyodide-toolchain = { cmd = "LATEST_COMPATIBLE=$(pyodide xbuildenv search -a | grep '│ Yes' | head -n 1 | awk -F '│' '{print $2}' | xargs) && pyodide xbuildenv install $LATEST_COMPATIBLE" }
133+
emsdk-setup = { cmd = "PYODIDE_EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) && ./emsdk install $PYODIDE_EMSCRIPTEN_VERSION && ./emsdk activate $PYODIDE_EMSCRIPTEN_VERSION", cwd = "emsdk", depends-on = ["emsdk-clone", "pyodide-toolchain"] }
134+
pyodide-build = { cmd = "bash -c 'source emsdk/emsdk_env.sh && pyodide build'", depends-on = ["emsdk-setup"] }
135+
pyodide-create-recipe = "rm -rf packages && pyodide skeleton pypi fastcan"
136+
pyodide-build-recipe = { cmd = "rm -rf dist && bash -c 'source emsdk/emsdk_env.sh && pyodide build-recipes fastcan --install'", depends-on = ["emsdk-setup"] }
137+
pyodide-download = '''bash -c "[ -d pyodide ] || (LATEST_TAG=$(curl -s https://api.github.com/repos/pyodide/pyodide/releases/latest | grep \"tag_name\" | cut -d \" -f4) && curl -L https://github.com/pyodide/pyodide/releases/download/${LATEST_TAG}/pyodide-${LATEST_TAG}.tar.bz2 | tar -xjf -)"'''
138+
pyodide-test-recipe = { cmd = "mv ../dist/* . && python -m http.server --directory .", cwd = "pyodide", depends-on = ["pyodide-download", "pyodide-build-recipe"] }
139+
140+
[environments]
141+
dev = ["test", "build", "jupyter", "asv"]
142+
docs = ["docs"]
143+
static = { features = ["static"], no-default-feature = true }
144+
nogil = { features = ["nogil"], no-default-feature = true }
145+
wasm = { features = ["wasm"], no-default-feature = true }

pyproject.toml

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -42,156 +42,6 @@ build-backend = "mesonpy"
4242
[tool.meson-python.args]
4343
setup = ['--vsenv']
4444

45-
[tool.pixi.project]
46-
channels = ["conda-forge"]
47-
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64", "linux-aarch64"]
48-
49-
[tool.pixi.dependencies]
50-
python = ">=3.10"
51-
scikit-learn = ">=1.7.0,!=1.7.1"
52-
53-
[tool.pixi.pypi-dependencies]
54-
fastcan = { path = ".", editable = true }
55-
56-
[tool.pixi.build-dependencies]
57-
cython = ">=3.1.0"
58-
meson-python = ">=0.18.0"
59-
60-
[tool.pixi.feature.docs.dependencies]
61-
pydata-sphinx-theme = "*"
62-
matplotlib = "*"
63-
pandas = "*"
64-
sphinx-gallery = "*"
65-
sphinx-design = "*"
66-
sphinxcontrib-plantuml = "*"
67-
jupyterlite-sphinx = "*"
68-
jupyterlite-xeus = "*"
69-
pip = "*" # Required by xeus environment creation
70-
graphviz = "<13"
71-
72-
[tool.pixi.feature.docs.target.win-64.dependencies]
73-
plantuml = "*"
74-
75-
[tool.pixi.feature.docs.target.linux-64.dependencies]
76-
plantuml = "*"
77-
78-
[tool.pixi.feature.docs.target.osx-arm64.dependencies]
79-
plantuml = "*"
80-
81-
[tool.pixi.feature.docs.target.osx-64.dependencies]
82-
plantuml = "*"
83-
84-
[tool.pixi.feature.wasm.dependencies]
85-
pip = "*"
86-
pyodide-build = "*"
87-
prettier = "*"
88-
89-
[tool.pixi.feature.asv.dependencies]
90-
asv = "*"
91-
libmambapy = "*"
92-
conda-build = "*"
93-
94-
[tool.pixi.feature.jupyter.dependencies]
95-
notebook = "*"
96-
matplotlib = "*"
97-
pyarrow = "*"
98-
99-
[tool.pixi.feature.test.dependencies]
100-
pytest = "*"
101-
pytest-cov = "*"
102-
pandas = "*"
103-
104-
[tool.pixi.feature.static.dependencies]
105-
# Static analysis tools
106-
ruff = "*"
107-
cython-lint = "*"
108-
mypy = "*"
109-
codespell = "*"
110-
111-
112-
[tool.pixi.feature.build.dependencies]
113-
python-build = "*"
114-
pip = "*"
115-
116-
[tool.pixi.feature.nogil.dependencies]
117-
python-freethreading = "*"
118-
119-
[tool.pixi.feature.nogil.pypi-dependencies]
120-
scikit-learn = ">=1.7.0,!=1.7.1"
121-
fastcan = { path = ".", editable = true }
122-
123-
[tool.pixi.feature.nogil.build-dependencies]
124-
cython = ">=3.1.0"
125-
meson-python = ">=0.18.0"
126-
127-
[tool.pixi.target.osx-64.build-dependencies]
128-
compilers = "*"
129-
130-
[tool.pixi.target.osx-arm64.build-dependencies]
131-
compilers = "*"
132-
133-
[tool.pixi.tasks]
134-
time-h = "python -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, verbose=0).fit(X, y)'"
135-
time-eta = "python -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, eta=True, verbose=0).fit(X, y)'"
136-
profile-minibatch = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan import minibatch; X = np.random.rand(100, 3000); y = np.random.rand(100, 20); cProfile.run('minibatch(X, y, 1000, 10, verbose=0)', sort='{{ SORT }}')"''', args = [{ arg = "SORT", default = "cumtime" }] }
137-
time-narx = '''python -m timeit -n 1 -s "import numpy as np; from fastcan.narx import make_narx; rng = np.random.default_rng(5); X = rng.random((1000, 10)); y = rng.random((1000, 2)); m = make_narx(X, y, 10, max_delay=2, poly_degree=2, verbose=0)" "m.fit(X, y, coef_init='one_step_ahead', verbose=1)"'''
138-
profile-narx = { cmd = '''python -c "import cProfile; import numpy as np; from fastcan.narx import make_narx; rng = np.random.default_rng(8); X = rng.random((3000, 3)); y = rng.random((3000, 3)); m = make_narx(X, y, 10, max_delay=10, poly_degree=2, verbose=0); cProfile.run('m.fit(X, y, coef_init=[0]*33)', sort='{{ SORT }}')"''', args = [{ arg = "SORT", default = "tottime" }] }
139-
140-
[tool.pixi.feature.asv.tasks]
141-
asv-build = { cmd = "python -m asv machine --machine {{ MACHINE }} --yes && python -m asv run --show-stderr -v --machine {{ MACHINE }} {{ EXTRA_ARGS }}", cwd = "asv_benchmarks", args = [{ arg = "MACHINE", default = "MacOS-M1" }, { arg = "EXTRA_ARGS", default = "" }] }
142-
asv-publish = { cmd = "python -m asv publish", cwd = "asv_benchmarks" }
143-
asv-preview = { cmd = "python -m asv preview", cwd = "asv_benchmarks", depends-on = ["asv-publish"] }
144-
145-
[tool.pixi.feature.test.tasks]
146-
test = "pytest"
147-
test-coverage = { cmd = "rm -rf .coverage && pytest --cov-report {{ FMT }} --cov={{ PACKAGE }}", args = [{ arg = "FMT", default = "html" }, { arg = "PACKAGE", default = "fastcan" }] }
148-
149-
[tool.pixi.feature.build.tasks]
150-
build-wheel = "rm -rf dist && python -m build -wnx -Cinstall-args=--tags=runtime,python-runtime,devel"
151-
build-sdist = "rm -rf dist && python -m build --sdist"
152-
rebuild = "rm -rf build && pip install --no-deps --force-reinstall -e ."
153-
154-
[tool.pixi.feature.static.tasks]
155-
fmt = "ruff format"
156-
lint = "ruff check . --fix"
157-
cython-lint = { cmd = "cython-lint .", cwd = "fastcan" }
158-
type = { cmd = "mypy . --ignore-missing-imports", cwd = "fastcan" }
159-
spell = "codespell fastcan"
160-
161-
[tool.pixi.feature.docs.tasks]
162-
doc = { cmd = "{{ SPHINXBUILD }} -M {{ CMD }} {{ SOURCEDIR }} {{ BUILDDIR }} {{ SPHINXOPTS }} --fail-on-warning", cwd = "doc", args = [{ arg = "SPHINXBUILD", default = "sphinx-build" }, { arg = "CMD", default = "html" }, { arg = "SOURCEDIR", default = "." }, { arg = "BUILDDIR", default = "_build" }, { arg = "SPHINXOPTS", default = "" }] }
163-
doc-clean = { cmd = "rm -rf {{ BUILDDIR }} generated auto_examples jupyterlite_contents .jupyterlite.doit.db _contents _output .cache", cwd = "doc", args = [{ arg = "BUILDDIR", default = "_build" }] }
164-
doc-deploy = { cmd = "python -m http.server" , cwd = "doc/_build/html" }
165-
doc-plantuml = { cmd = "plantuml -tsvg {{ SOURCE }} -o {{ OUTPUT }}", cwd = "doc", args = [{ arg = "SOURCE", default = "diagram.puml" }, { arg = "OUTPUT", default = "_build" }] }
166-
# The setting (pixi config set --local run-post-link-scripts insecure) is required before install the environment,
167-
# otherwise graphviz will not generate its plugin config. See:
168-
# https://github.com/prefix-dev/pixi/blob/8aad97b5ac6482cdf0d3167fdaf0cb26328cc9c4/CHANGELOG.md?plain=1#L899
169-
doc-plantuml-test = "plantuml -testdot"
170-
doc-jupyterlite-debug = { cmd = "jupyter-lite build --debug --output-dir {{ OUTPUT }}", cwd = "doc", args = [{ arg = "OUTPUT", default = "_output" }] }
171-
172-
173-
[tool.pixi.feature.nogil.tasks]
174-
nogil-h = "python -Xgil=0 -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, verbose=0).fit(X, y)'"
175-
nogil-eta = "python -Xgil=0 -m timeit -n 5 -s 'import numpy as np; from fastcan import FastCan; X = np.random.rand(3000, 100); y = np.random.rand(3000, 20)' 's = FastCan(100, eta=True, verbose=0).fit(X, y)'"
176-
177-
[tool.pixi.feature.wasm.tasks]
178-
emsdk-clone = "bash -c '[ -d emsdk ] || git clone https://github.com/emscripten-core/emsdk.git emsdk'"
179-
pyodide-compatible = "pyodide xbuildenv search -a"
180-
pyodide-toolchain = { cmd = "LATEST_COMPATIBLE=$(pyodide xbuildenv search -a | grep '│ Yes' | head -n 1 | awk -F '│' '{print $2}' | xargs) && pyodide xbuildenv install $LATEST_COMPATIBLE" }
181-
emsdk-setup = { cmd = "PYODIDE_EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) && ./emsdk install $PYODIDE_EMSCRIPTEN_VERSION && ./emsdk activate $PYODIDE_EMSCRIPTEN_VERSION", cwd = "emsdk", depends-on = ["emsdk-clone", "pyodide-toolchain"] }
182-
pyodide-build = { cmd = "bash -c 'source emsdk/emsdk_env.sh && pyodide build'", depends-on = ["emsdk-setup"] }
183-
pyodide-create-recipe = "rm -rf packages && pyodide skeleton pypi fastcan"
184-
pyodide-build-recipe = { cmd = "rm -rf dist && bash -c 'source emsdk/emsdk_env.sh && pyodide build-recipes fastcan --install'", depends-on = ["emsdk-setup"] }
185-
pyodide-download = '''bash -c "[ -d pyodide ] || (LATEST_TAG=$(curl -s https://api.github.com/repos/pyodide/pyodide/releases/latest | grep \"tag_name\" | cut -d \" -f4) && curl -L https://github.com/pyodide/pyodide/releases/download/${LATEST_TAG}/pyodide-${LATEST_TAG}.tar.bz2 | tar -xjf -)"'''
186-
pyodide-test-recipe = { cmd = "mv ../dist/* . && python -m http.server --directory .", cwd = "pyodide", depends-on = ["pyodide-download", "pyodide-build-recipe"] }
187-
188-
[tool.pixi.environments]
189-
dev = ["test", "build", "jupyter", "asv"]
190-
docs = ["docs"]
191-
static = { features = ["static"], no-default-feature = true }
192-
nogil = { features = ["nogil"], no-default-feature = true }
193-
wasm = { features = ["wasm"], no-default-feature = true }
194-
19545
[tool.pytest.ini_options]
19646
testpaths = [
19747
"./tests",

0 commit comments

Comments
 (0)