Skip to content

Commit bbcef72

Browse files
committed
Add fastcan
1 parent 6c447d6 commit bbcef72

4 files changed

Lines changed: 94 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
export CFLAGS="$CFLAGS -sWASM_BIGINT -s SIDE_MODULE=1 -Wno-implicit-function-declaration -fwasm-exceptions"
4+
export CXXFLAGS="$CXXFLAGS -sWASM_BIGINT -s SIDE_MODULE=1 -fwasm-exceptions"
5+
export LDFLAGS="$LDFLAGS -sWASM_BIGINT -s SIDE_MODULE=1 -fwasm-exceptions"
6+
7+
# otherwise "cython" is not properly executable
8+
echo "add shebang to cython file"
9+
sed -i '1i#!/usr/bin/env python' $BUILD_PREFIX/bin/cython
10+
11+
cp $RECIPE_DIR/emscripten.meson.cross $SRC_DIR
12+
echo "python = '${PYTHON}'" >> $SRC_DIR/emscripten.meson.cross
13+
14+
${PYTHON} -m pip install . -vvv --no-deps --no-build-isolation \
15+
-Csetup-args="--cross-file=$SRC_DIR/emscripten.meson.cross"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# binaries section is at the end as may want to append python binary.
2+
3+
[properties]
4+
needs_exe_wrapper = true
5+
skip_sanity_check = true
6+
longdouble_format = 'IEEE_QUAD_LE' # for numpy
7+
8+
[host_machine]
9+
system = 'emscripten'
10+
cpu_family = 'wasm32'
11+
cpu = 'wasm'
12+
endian = 'little'
13+
14+
[binaries]
15+
exe_wrapper = 'node'
16+
pkgconfig = 'pkg-config'
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
context:
2+
name: fastcan
3+
version: 0.5.0
4+
5+
package:
6+
name: ${{ name }}
7+
version: ${{ version }}
8+
9+
source:
10+
url: https://pypi.io/packages/source/${{ name[0] }}/${{ name }}/${{ name }}-${{ version }}.tar.gz
11+
sha256: f096487acc9898c4a9af4906bffeb9fd2203a277a3e94c0fc586097cc0e769dd
12+
13+
build:
14+
number: 0
15+
16+
requirements:
17+
build:
18+
- ${{ compiler('c') }}
19+
- cross-python_${{ target_platform }}
20+
- python
21+
- cython
22+
- meson-python
23+
- pip
24+
host:
25+
- python
26+
- scikit-learn >=1.6.0
27+
run:
28+
- python
29+
- scikit-learn >=1.6.0
30+
31+
tests:
32+
- script:
33+
- echo "FIXME:"
34+
# The tests for v0.5.0 pass. This has been tested with xeus-python.
35+
# The following fails because of issues with the test environment.
36+
# See https://github.com/emscripten-forge/recipes/issues/4364
37+
# tests:
38+
# - script: pytester
39+
# files:
40+
# recipe:
41+
# - test_fastcan.py
42+
# requirements:
43+
# build:
44+
# - pytester
45+
# run:
46+
# - pytester-run
47+
48+
about:
49+
license: MIT
50+
license_file: LICENSE
51+
summary: A fast canonical-correlation-based search algorithm
52+
homepage: https://fastcan.readthedocs.io/en/latest/
53+
repository: https://github.com/scikit-learn-contrib/fastcan/
54+
55+
extra:
56+
recipe-maintainers:
57+
- MatthewSZhang
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def test_fastcan():
2+
from fastcan import FastCan
3+
X = [[1, 0], [0, 1]]
4+
y = [1, 0]
5+
s = FastCan(verbose=0).fit(X, y).get_support()
6+
assert (s == [True, False]).all()

0 commit comments

Comments
 (0)