From 5dec8a26c9fd1e643333ae132a2dc0e897f0fb11 Mon Sep 17 00:00:00 2001 From: Gyeongjae Choi Date: Wed, 27 Nov 2024 10:46:22 +0000 Subject: [PATCH] Sync recipes --- packages/Cartopy/test_cartopy.py | 34 +++---- packages/altair/meta.yaml | 10 +- packages/altair/test_altair.py | 18 ++-- packages/clingo/meta.yaml | 21 ++++ packages/clingo/test_clingo.py | 25 +++++ packages/crc32c/meta.yaml | 6 +- packages/duckdb/meta.yaml | 6 +- packages/lakers-python/meta.yaml | 6 +- packages/libzfp/meta.yaml | 34 +++++++ packages/micropip/meta.yaml | 8 +- packages/msprime/meta.yaml | 6 +- packages/pydantic/meta.yaml | 6 +- packages/pydantic_core/meta.yaml | 9 +- packages/pygame-ce/meta.yaml | 1 + packages/rateslib/meta.yaml | 23 +++++ packages/rateslib/test_rateslib.py | 17 ++++ packages/rebound/meta.yaml | 8 +- .../patches/0001-fix-install_name.patch | 38 ++++--- .../rebound/patches/0002-fix-output.patch | 57 +++++++++++ .../rebound/patches/0003-no-emscripten.patch | 49 +++++++++ packages/reboundx/meta.yaml | 6 +- packages/soxr/meta.yaml | 25 +++++ .../0001-Fix-function-signatures.patch | 99 +++++++++++++++++++ packages/soxr/test_soxr.py | 24 +++++ packages/test/meta.yaml | 1 + packages/tree-sitter-go/meta.yaml | 6 +- packages/tree-sitter-java/meta.yaml | 6 +- packages/tree-sitter-python/meta.yaml | 6 +- packages/tree-sitter/meta.yaml | 6 +- packages/tskit/meta.yaml | 6 +- packages/vega-datasets/meta.yaml | 19 ++++ packages/vega-datasets/test_vega_datasets.py | 23 +++++ packages/zfpy/meta.yaml | 37 +++++++ .../zfpy/patches/Modernise-packaging.patch | 69 +++++++++++++ packages/zfpy/test_zfpy.py | 74 ++++++++++++++ 35 files changed, 695 insertions(+), 94 deletions(-) create mode 100644 packages/clingo/meta.yaml create mode 100644 packages/clingo/test_clingo.py create mode 100644 packages/libzfp/meta.yaml create mode 100644 packages/rateslib/meta.yaml create mode 100644 packages/rateslib/test_rateslib.py create mode 100644 packages/rebound/patches/0002-fix-output.patch create mode 100644 packages/rebound/patches/0003-no-emscripten.patch create mode 100644 packages/soxr/meta.yaml create mode 100644 packages/soxr/patches/0001-Fix-function-signatures.patch create mode 100644 packages/soxr/test_soxr.py create mode 100644 packages/vega-datasets/meta.yaml create mode 100644 packages/vega-datasets/test_vega_datasets.py create mode 100644 packages/zfpy/meta.yaml create mode 100644 packages/zfpy/patches/Modernise-packaging.patch create mode 100644 packages/zfpy/test_zfpy.py diff --git a/packages/Cartopy/test_cartopy.py b/packages/Cartopy/test_cartopy.py index dd88d4b..bb32c30 100644 --- a/packages/Cartopy/test_cartopy.py +++ b/packages/Cartopy/test_cartopy.py @@ -3,8 +3,6 @@ import pytest from pytest_pyodide import run_in_pyodide -from conftest import package_is_built - DECORATORS = [ pytest.mark.xfail_browsers(node="No supported matplotlib backends on node"), pytest.mark.skip_refcount_check, @@ -27,28 +25,22 @@ def test_imports(selenium): @matplotlib_test_decorator +@run_in_pyodide(packages=["Cartopy", "matplotlib", "pyodide-http"]) def test_matplotlib(selenium): - if not package_is_built("pyodide-http"): - pytest.skip("pyodide-http is not built") - - @run_in_pyodide(packages=["Cartopy", "matplotlib", "pyodide-http"]) - def run(selenium): - import io - - import cartopy.crs as ccrs - import matplotlib.pyplot as plt - import pyodide_http + import io - pyodide_http.patch_all() + import cartopy.crs as ccrs + import matplotlib.pyplot as plt + import pyodide_http - ax = plt.axes(projection=ccrs.PlateCarree()) - ax.coastlines() + pyodide_http.patch_all() - fd = io.BytesIO() - plt.savefig(fd, format="svg") + ax = plt.axes(projection=ccrs.PlateCarree()) + ax.coastlines() - content = fd.getvalue().decode("utf8") - assert len(content) > 100000 - assert content.startswith(" 100000 + assert content.startswith(" +Date: Wed, 6 Nov 2024 17:37:22 -0500 +Subject: [PATCH 3/3] install_name + +--- + setup.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index 6443cb27..965b2fc9 100644 +--- a/setup.py ++++ b/setup.py +@@ -23,8 +23,8 @@ except: + extra_link_args=[] if sys.platform == 'darwin': - from distutils import sysconfig - vars = sysconfig.get_config_vars() -- vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-shared') + config_vars = sysconfig.get_config_vars() +- config_vars['LDSHARED'] = config_vars['LDSHARED'].replace('-bundle', '-shared') - extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix] -+ # vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-shared') -+ # extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix] - - libreboundmodule = Extension('librebound', - sources = [ 'src/rebound.c', ++ #config_vars['LDSHARED'] = config_vars['LDSHARED'].replace('-bundle', '-shared') ++ #extra_link_args=['-Wl,-install_name,@rpath/librebound'+suffix] + if sys.platform == 'win32': + extra_compile_args=[ghash_arg, '-DLIBREBOUND', '-D_GNU_SOURCE', '-DSERVER'] + else: +-- +2.39.5 (Apple Git-154) + diff --git a/packages/rebound/patches/0002-fix-output.patch b/packages/rebound/patches/0002-fix-output.patch new file mode 100644 index 0000000..1b7bc32 --- /dev/null +++ b/packages/rebound/patches/0002-fix-output.patch @@ -0,0 +1,57 @@ +From f875c41a58ae4b3d59d97a5787ec3e546c737860 Mon Sep 17 00:00:00 2001 +From: Hanno Rein +Date: Wed, 6 Nov 2024 17:21:47 -0500 +Subject: [PATCH] output + +--- + src/output.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/output.c b/src/output.c +index e897743a..fdd4ea45 100644 +--- a/src/output.c ++++ b/src/output.c +@@ -349,7 +349,7 @@ void reb_simulation_output_timing(struct reb_simulation* r, const double tmax){ + r->output_timing_last = temp; + }else{ + #ifdef __EMSCRIPTEN__ +- reb_remove_last_line(); ++ // reb_remove_last_line(); + #else + printf("\r"); + #endif +--- a/src/output.c ++++ b/src/output.c +@@ -257,17 +257,17 @@ void profiling_stop(int cat){ + + #ifdef __EMSCRIPTEN__ + // fflush does not work in emscripten. Workaround. +-EM_JS(void, reb_remove_last_line, (), { +- var output = document.getElementById("output"); +- if (output){ +- const lastIndex1 = output.value.lastIndexOf("\n"); +- const lastIndex2 = output.value.lastIndexOf("\n",lastIndex1-1); +- const lastIndexNtot = output.value.lastIndexOf("N_tot="); +- if(lastIndex1>0 && lastIndex20 && lastIndex2 +Date: Thu, 7 Nov 2024 09:40:09 -0500 +Subject: [PATCH 4/4] no emscripten + +--- + src/rebound.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/rebound.c b/src/rebound.c +index 82f6ac60..accea978 100644 +--- a/src/rebound.c ++++ b/src/rebound.c +@@ -665,7 +665,7 @@ int reb_check_exit(struct reb_simulation* const r, const double tmax, double* la + while(r->status == REB_STATUS_PAUSED || r->status == REB_STATUS_SCREENSHOT){ + // Wait for user to disable paused simulation + #ifdef __EMSCRIPTEN__ +- emscripten_sleep(100); ++ // emscripten_sleep(100); + #else + usleep(1000); + #endif +@@ -820,16 +820,16 @@ static void* reb_simulation_integrate_raw(void* args){ + } + reb_run_heartbeat(r); + #ifdef __EMSCRIPTEN__ +- double t0 = emscripten_performance_now(); ++// double t0 = emscripten_performance_now(); + #endif + while(reb_check_exit(r,thread_info->tmax,&last_full_dt)<0){ + #ifdef __EMSCRIPTEN__ +- double t1 = emscripten_performance_now(); +- if (t1-t0>1000./120.){ // max framerate 120Hz +- t0 = t1; +- emscripten_sleep(0); // allow drawing and event handling +- } +- ++// double t1 = emscripten_performance_now(); ++// if (t1-t0>1000./120.){ // max framerate 120Hz ++// t0 = t1; ++// emscripten_sleep(0); // allow drawing and event handling ++// } ++// + #endif + #ifdef OPENGL + if (r->display_data){ +-- +2.39.5 (Apple Git-154) + diff --git a/packages/reboundx/meta.yaml b/packages/reboundx/meta.yaml index fa52882..1ff8261 100644 --- a/packages/reboundx/meta.yaml +++ b/packages/reboundx/meta.yaml @@ -1,6 +1,6 @@ package: name: reboundx - version: 3.10.1 + version: 4.3.0 top-level: - reboundx build: @@ -10,8 +10,8 @@ build: ldflags: | -L$(WASM_LIBRARY_DIR)/lib/ source: - url: https://files.pythonhosted.org/packages/14/08/c1c0b83c90ea43ea8e218beadb13332259e930a2ca62f85024be89d811f3/reboundx-3.10.1.tar.gz - sha256: 65b2fcecf296661aad15a81a8d7d7b7b96cc2ba834c89e49dba24445f146d642 + url: https://files.pythonhosted.org/packages/2c/c2/32bb671c3f6944755b90c75d20f387daf4b9fc1e6919264cb0e9e26af8d7/reboundx-4.3.0.tar.gz + sha256: 94fc5b0993b623faa9964800f87fbc97236f7f12cb639c659d25702f1e0ac0ec requirements: run: - rebound diff --git a/packages/soxr/meta.yaml b/packages/soxr/meta.yaml new file mode 100644 index 0000000..3eabecd --- /dev/null +++ b/packages/soxr/meta.yaml @@ -0,0 +1,25 @@ +package: + name: soxr + version: 0.5.0.post1 + top-level: + - soxr +source: + url: https://files.pythonhosted.org/packages/02/c0/4429bf9b3be10e749149e286aa5c53775399ec62891c6b970456c6dca325/soxr-0.5.0.post1.tar.gz + sha256: 7092b9f3e8a416044e1fa138c8172520757179763b85dc53aa9504f4813cff73 + patches: + # Can be removed once the PR chirlu/soxr#13 (dead upstream) or dofuuz/soxr#3 (python soxr fork) is merged and released + - patches/0001-Fix-function-signatures.patch +requirements: + run: + - numpy +about: + home: https://github.com/dofuuz/python-soxr + PyPI: https://pypi.org/project/soxr + summary: High quality, one-dimensional sample-rate conversion library + license: LGPLv2+ +test: + imports: + - soxr +extra: + recipe-maintainers: + - swnf diff --git a/packages/soxr/patches/0001-Fix-function-signatures.patch b/packages/soxr/patches/0001-Fix-function-signatures.patch new file mode 100644 index 0000000..3761033 --- /dev/null +++ b/packages/soxr/patches/0001-Fix-function-signatures.patch @@ -0,0 +1,99 @@ +From 983ea3d49b2834e044ca5b492cfb80181e49666f Mon Sep 17 00:00:00 2001 +From: swnf <50806201+swnf@users.noreply.github.com> +Date: Sun, 3 Nov 2024 10:36:47 +0100 +Subject: [PATCH] Fix function signature mismatches + + +diff --git a/libsoxr/src/fft4g32.c b/libsoxr/src/fft4g32.c +index 7a31ba4..31aebca 100644 +--- a/libsoxr/src/fft4g32.c ++++ b/libsoxr/src/fft4g32.c +@@ -9,11 +9,12 @@ + + #if WITH_CR32 + #include "rdft_t.h" +-static void * null(void) {return 0;} +-static void forward (int length, void * setup, double * H) {lsx_safe_rdft_f(length, 1, H); (void)setup;} +-static void backward(int length, void * setup, double * H) {lsx_safe_rdft_f(length, -1, H); (void)setup;} ++static void * null(int length) {return 0; (void)length;} ++static void nothing(void * setup) {(void)setup;} ++static void forward(int length, void * setup, void * H, void * scratch) {lsx_safe_rdft_f(length, 1, (double * ) H); (void)setup; (void)scratch;} ++static void backward(int length, void * setup, void * H, void * scratch) {lsx_safe_rdft_f(length, -1, (double * ) H); (void)setup; (void)scratch;} + static int multiplier(void) {return 2;} +-static void nothing(void) {} ++static void nothing2(int length, void * setup, void * H, void * scratch) {(void)length; (void)setup; (void)H; (void)scratch;} + static int flags(void) {return 0;} + + fn_t _soxr_rdft32_cb[] = { +@@ -27,7 +28,7 @@ fn_t _soxr_rdft32_cb[] = { + (fn_t)_soxr_ordered_convolve_f, + (fn_t)_soxr_ordered_partial_convolve_f, + (fn_t)multiplier, +- (fn_t)nothing, ++ (fn_t)nothing2, + (fn_t)malloc, + (fn_t)calloc, + (fn_t)free, +diff --git a/libsoxr/src/fft4g32s.c b/libsoxr/src/fft4g32s.c +index 8ce9726..f00c97c 100644 +--- a/libsoxr/src/fft4g32s.c ++++ b/libsoxr/src/fft4g32s.c +@@ -5,11 +5,12 @@ + #include "util32s.h" + #include "rdft_t.h" + +-static void * null(void) {return 0;} +-static void nothing(void) {} +-static void forward (int length, void * setup, float * H) {lsx_safe_rdft_f(length, 1, H); (void)setup;} +-static void backward(int length, void * setup, float * H) {lsx_safe_rdft_f(length, -1, H); (void)setup;} ++static void * null(int length) {return 0; (void)length;} ++static void nothing(void * setup) {(void)setup;} ++static void forward (int length, void * setup, void * H, void * scratch) {lsx_safe_rdft_f(length, 1, (float*)H); (void)setup; (void)scratch;} ++static void backward(int length, void * setup, void * H, void * scratch) {lsx_safe_rdft_f(length, -1, (float*)H); (void)setup; (void)scratch;} + static int multiplier(void) {return 2;} ++static void nothing2(int length, void * setup, void * H, void * scratch) {(void)length; (void)setup; (void)H; (void)scratch;} + static int flags(void) {return RDFT_IS_SIMD;} + + fn_t _soxr_rdft32s_cb[] = { +@@ -23,7 +24,7 @@ fn_t _soxr_rdft32s_cb[] = { + (fn_t)ORDERED_CONVOLVE_SIMD, + (fn_t)ORDERED_PARTIAL_CONVOLVE_SIMD, + (fn_t)multiplier, +- (fn_t)nothing, ++ (fn_t)nothing2, + (fn_t)SIMD_ALIGNED_MALLOC, + (fn_t)SIMD_ALIGNED_CALLOC, + (fn_t)SIMD_ALIGNED_FREE, +diff --git a/libsoxr/src/fft4g64.c b/libsoxr/src/fft4g64.c +index 0018516..5798fd7 100644 +--- a/libsoxr/src/fft4g64.c ++++ b/libsoxr/src/fft4g64.c +@@ -7,11 +7,12 @@ + #include "soxr-config.h" + + #if WITH_CR64 +-static void * null(void) {return 0;} +-static void nothing(void) {} +-static void forward (int length, void * setup, double * H) {lsx_safe_rdft(length, 1, H); (void)setup;} +-static void backward(int length, void * setup, double * H) {lsx_safe_rdft(length, -1, H); (void)setup;} ++static void * null(int length) {return 0; (void)length;} ++static void nothing(void * setup) {(void)setup;} ++static void forward (int length, void * setup, void * H, void * scratch) {lsx_safe_rdft(length, 1, (double*)H); (void)setup; (void)scratch;} ++static void backward(int length, void * setup, void * H, void * scratch) {lsx_safe_rdft(length, -1, (double*)H); (void)setup; (void)scratch;} + static int multiplier(void) {return 2;} ++static void nothing2(int length, void * setup, void * H, void * scratch) {(void)length; (void)setup; (void)H; (void)scratch;} + static int flags(void) {return 0;} + + typedef void (* fn_t)(void); +@@ -26,7 +27,7 @@ fn_t _soxr_rdft64_cb[] = { + (fn_t)_soxr_ordered_convolve, + (fn_t)_soxr_ordered_partial_convolve, + (fn_t)multiplier, +- (fn_t)nothing, ++ (fn_t)nothing2, + (fn_t)malloc, + (fn_t)calloc, + (fn_t)free, +-- +2.43.0 + diff --git a/packages/soxr/test_soxr.py b/packages/soxr/test_soxr.py new file mode 100644 index 0000000..9c8a667 --- /dev/null +++ b/packages/soxr/test_soxr.py @@ -0,0 +1,24 @@ +import pytest +from pytest_pyodide import run_in_pyodide + + +@pytest.mark.parametrize("input_sr, output_sr", [(44100, 22050), (22050, 44100)]) +@run_in_pyodide(packages=["soxr", "numpy"]) +def test_resample(selenium, input_sr, output_sr): + import numpy as np + import soxr + + # Signal length in seconds + length = 5.0 + # Frequency in Hz + frequency = 42 + + input_sample_positions = np.arange(0, length, 1 / input_sr) + output_sample_positions = np.arange(0, length, 1 / output_sr) + + input_signal = np.sin(2 * np.pi * frequency * input_sample_positions) + predicted_output_signal = np.sin(2 * np.pi * frequency * output_sample_positions) + + output_signal = soxr.resample(input_signal, input_sr, output_sr) + + np.testing.assert_allclose(predicted_output_signal, output_signal, atol=0.0015) diff --git a/packages/test/meta.yaml b/packages/test/meta.yaml index 5af447f..0f20fff 100644 --- a/packages/test/meta.yaml +++ b/packages/test/meta.yaml @@ -51,6 +51,7 @@ build: _testcapi/code.c \ _testcapi/buffer.c \ _testcapi/pyos.c \ + _testcapi/run.c \ _testcapi/file.c \ _testcapi/codec.c \ _testcapi/immortal.c \ diff --git a/packages/tree-sitter-go/meta.yaml b/packages/tree-sitter-go/meta.yaml index 303a1bf..77196c5 100644 --- a/packages/tree-sitter-go/meta.yaml +++ b/packages/tree-sitter-go/meta.yaml @@ -1,13 +1,13 @@ package: name: tree-sitter-go - version: 0.23.1 + version: 0.23.3 top-level: - tree_sitter_go source: # Have to use github source to work around broken sdist # https://github.com/tree-sitter/tree-sitter-go/pull/151 - url: https://github.com/tree-sitter/tree-sitter-go/archive/refs/tags/v0.23.1.tar.gz - sha256: 4173bafc4c59be78642a0faf1bed8cb3854458aa59c506e8f51001a9f28da09b + url: https://github.com/tree-sitter/tree-sitter-go/archive/refs/tags/v0.23.3.tar.gz + sha256: 41c2fddeca168237b0889de124630d391ef74a053f5b38c5b64b919230f3e82e requirements: run: - tree-sitter diff --git a/packages/tree-sitter-java/meta.yaml b/packages/tree-sitter-java/meta.yaml index b8c479d..a842b42 100644 --- a/packages/tree-sitter-java/meta.yaml +++ b/packages/tree-sitter-java/meta.yaml @@ -1,13 +1,13 @@ package: name: tree-sitter-java - version: 0.23.2 + version: 0.23.4 top-level: - tree_sitter_java source: # Have to use github url to work around broken sdist: # https://github.com/tree-sitter/tree-sitter-java/pull/188 - url: https://github.com/tree-sitter/tree-sitter-java/archive/refs/tags/v0.23.2.tar.gz - sha256: 062fe5746deb4e362ccb987228e7b41bfc017eb2b91a0413a7447719abaa07b2 + url: https://github.com/tree-sitter/tree-sitter-java/archive/refs/tags/v0.23.4.tar.gz + sha256: f255c5f53c8c550c77993fb129bf50a99732850ae0a3031bec148106a8ea5596 requirements: run: - tree-sitter diff --git a/packages/tree-sitter-python/meta.yaml b/packages/tree-sitter-python/meta.yaml index 655178f..2a73302 100644 --- a/packages/tree-sitter-python/meta.yaml +++ b/packages/tree-sitter-python/meta.yaml @@ -1,13 +1,13 @@ package: name: tree-sitter-python - version: 0.23.2 + version: 0.23.4 top-level: - tree_sitter_python source: # Have to use github url to work around broken sdist: # https://github.com/tree-sitter/tree-sitter-python/pull/285 - url: https://github.com/tree-sitter/tree-sitter-python/archive/refs/tags/v0.23.2.tar.gz - sha256: b38e5b1f5237377b506109978af76422975bda5859165835e3c7b5afee987383 + url: https://github.com/tree-sitter/tree-sitter-python/archive/refs/tags/v0.23.4.tar.gz + sha256: e35497b22cb61803862a36b49d4632649f8f2e1e5edd555beec0ff4189f019f0 requirements: run: - tree-sitter diff --git a/packages/tree-sitter/meta.yaml b/packages/tree-sitter/meta.yaml index 0ff2bdc..d08483b 100644 --- a/packages/tree-sitter/meta.yaml +++ b/packages/tree-sitter/meta.yaml @@ -1,11 +1,11 @@ package: name: tree-sitter - version: 0.23.1 + version: 0.23.2 top-level: - tree_sitter source: - url: https://files.pythonhosted.org/packages/01/23/e001538062ece748d7ab1fcfbcd9fa766d85f60f0d5ae014a7caf4f07c70/tree-sitter-0.23.1.tar.gz - sha256: 28fe02aff6676b203cbe4213ca7116db0aaac08d6ca4c0b1f1af038991631838 + url: https://files.pythonhosted.org/packages/0f/50/fd5fafa42b884f741b28d9e6fd366c3f34e15d2ed3aa9633b34e388379e2/tree-sitter-0.23.2.tar.gz + sha256: 66bae8dd47f1fed7bdef816115146d3a41c39b5c482d7bad36d9ba1def088450 about: home: https://tree-sitter.github.io/tree-sitter PyPI: https://pypi.org/project/tree-sitter diff --git a/packages/tskit/meta.yaml b/packages/tskit/meta.yaml index 2e865c1..b68dd79 100644 --- a/packages/tskit/meta.yaml +++ b/packages/tskit/meta.yaml @@ -1,11 +1,11 @@ package: name: tskit - version: 0.5.6 + version: 0.6.0 top-level: - tskit source: - url: https://files.pythonhosted.org/packages/aa/cc/6bdd65802bda99d758ced40c0204885d7c3ac8667e24be125fc72660c5bf/tskit-0.5.6.tar.gz - sha256: ddfe213f1cb063cdb6982177230a2805ecd7dfc7ccd73026e13878abffd2ce46 + url: https://files.pythonhosted.org/packages/01/dc/6962a28d6e2eac38f088fced8b0e62fff683bd5fa7e6c25bd38306ea6433/tskit-0.6.0.tar.gz + sha256: 9dda2acc84ae8dab3484dfedcb721807a4efe48e159f74f24b07789404b54106 requirements: run: - numpy diff --git a/packages/vega-datasets/meta.yaml b/packages/vega-datasets/meta.yaml new file mode 100644 index 0000000..c6d6f5d --- /dev/null +++ b/packages/vega-datasets/meta.yaml @@ -0,0 +1,19 @@ +package: + name: vega-datasets + version: 0.9.0 + top-level: + - vega_datasets +source: + url: https://files.pythonhosted.org/packages/e6/9f/ca52771fe972e0dcc5167fedb609940e01516066938ff2ee28b273ae4f29/vega_datasets-0.9.0-py3-none-any.whl + sha256: 3d7c63917be6ca9b154b565f4779a31fedce57b01b5b9d99d8a34a7608062a1d +about: + home: http://github.com/altair-viz/vega_datasets + PyPI: https://pypi.org/project/vega-datasets + summary: A Python package for offline access to Vega datasets + license: MIT +requirements: + run: + - pandas +extra: + recipe-maintainers: + - peter-gy diff --git a/packages/vega-datasets/test_vega_datasets.py b/packages/vega-datasets/test_vega_datasets.py new file mode 100644 index 0000000..894c527 --- /dev/null +++ b/packages/vega-datasets/test_vega_datasets.py @@ -0,0 +1,23 @@ +import pytest +from pytest_pyodide import run_in_pyodide + + +@pytest.mark.driver_timeout(30) +@run_in_pyodide(packages=["vega_datasets"]) +def test_vega_datasets(selenium): + from vega_datasets import data + + assert len(data.list_datasets()) > 0 + + df = data.iris() + + assert set(df.columns) == { + "species", + "petalLength", + "sepalLength", + "petalWidth", + "sepalWidth", + } + assert data.iris.url is not None + assert data.iris.filepath is not None + assert data.iris.description is not None diff --git a/packages/zfpy/meta.yaml b/packages/zfpy/meta.yaml new file mode 100644 index 0000000..b883a3a --- /dev/null +++ b/packages/zfpy/meta.yaml @@ -0,0 +1,37 @@ +package: + name: zfpy + version: 1.0.1 + top-level: + - zfpy + +source: + # There's no sdist for zfpy on PyPI, so we get the tarball from the GitHub release instead + url: https://github.com/LLNL/zfp/archive/refs/tags/1.0.1.tar.gz + sha256: 4984db6a55bc919831966dd17ba5e47ca7ac58668f4fd278ebd98cd2200da66f + patches: + - patches/Modernise-packaging.patch + +build: + exports: requested + cflags: | + -I$(PYTHONINCLUDE) + -I$(WASM_LIBRARY_DIR)/include + ldflags: | + -L$(WASM_LIBRARY_DIR)/lib + +requirements: + host: + - libzfp + - numpy + run: + - numpy + +test: + imports: + - zfpy + +about: + home: https://zfp.llnl.gov/ + PyPI: https://pypi.org/project/zfpy/ + summary: zfp compression in Python + license: BSD-3-Clause diff --git a/packages/zfpy/patches/Modernise-packaging.patch b/packages/zfpy/patches/Modernise-packaging.patch new file mode 100644 index 0000000..411f783 --- /dev/null +++ b/packages/zfpy/patches/Modernise-packaging.patch @@ -0,0 +1,69 @@ +From f36ef86e67185b16b65445092c40a3d75d0be45c Mon Sep 17 00:00:00 2001 +From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> +Date: Fri, 8 Nov 2024 02:46:00 +0530 +Subject: [PATCH] Modernise packaging + +This patch introduces a PEP 517/518 compliant build system using setuptools and +declarative metadata in pyproject.toml, and fixes syntax errors in setup.py. The +sources for the extension module are correctly specified as Cython source files. + +Some part of the credits go to the upstream +PR at https://github.com/LLNL/zfp/pull/234 + +Co-Authored-By: David M. Rogers <2243447+frobnitzem@users.noreply.github.com> +--- + pyproject.toml | 13 +++++++++++++ + setup.py | 18 +++++++++--------- + 2 files changed, 22 insertions(+), 9 deletions(-) + create mode 100644 pyproject.toml + +diff --git a/pyproject.toml b/pyproject.toml +new file mode 100644 +index 0000000..88adcc8 +--- /dev/null ++++ b/pyproject.toml +@@ -0,0 +1,13 @@ ++[build-system] ++requires = ["setuptools", "cython", "numpy"] ++build-backend = "setuptools.build_meta" ++ ++[project] ++name = "zfpy" ++version = "1.0.1" ++authors = [ ++ { name = "Peter Lindstrom", email = "zfp@llnl.gov" }, ++ { name = "Danielle Asher", email = "zfp@llnl.gov" }, ++] ++description = "zfp compression in Python" ++requires-python = ">=3.0" +diff --git a/setup.py b/setup.py +index fa2da6e..919fa7c 100644 +--- a/setup.py ++++ b/setup.py +@@ -2,14 +2,14 @@ from setuptools import setup, Extension + import numpy as np + + setup( +- name="zfpy", +- version="1.0.1", +- author="Peter Lindstrom, Danielle Asher", +- author_email="zfp@llnl.gov", + url="https://zfp.llnl.gov", +- description="zfp compression in Python", +- long_description="zfp is a compressed format for representing multidimensional floating-point and integer arrays. zfp provides compressed-array classes that support high throughput read and write random access to individual array elements. zfp also supports serial and parallel compression of whole arrays using both lossless and lossy compression with error tolerances. zfp is primarily written in C and C++ but also includes Python and Fortran bindings.", +- ext_modules=[Extension("zfpy", ["build/python/zfpy.c"], +- include_dirs=["include", np.get_include()], +- libraries=["zfp"], library_dirs=["build/lib64", "build/lib/Release"]), language_level = "3"] ++ ext_modules= ++ [ ++ Extension( ++ name="zfpy", ++ sources=["python/zfpy.pyx"], ++ include_dirs=["include", np.get_include()], ++ libraries=["zfp"], ++ library_dirs=["build/lib64", "build/lib"]) ++ ], + ) +-- +2.39.3 (Apple Git-146) + diff --git a/packages/zfpy/test_zfpy.py b/packages/zfpy/test_zfpy.py new file mode 100644 index 0000000..0896f32 --- /dev/null +++ b/packages/zfpy/test_zfpy.py @@ -0,0 +1,74 @@ +from pytest_pyodide import run_in_pyodide + + +@run_in_pyodide(packages=["zfpy", "numpy"]) +def test_compression(selenium): + import numpy as np + import zfpy + + my_array = np.arange(1, 20) + compressed_data = zfpy.compress_numpy(my_array) + decompressed_array = zfpy.decompress_numpy(compressed_data) + np.testing.assert_array_equal(my_array, decompressed_array) + + +@run_in_pyodide(packages=["zfpy", "numpy"]) +def test_compression_with_tolerance(selenium): + import numpy as np + import zfpy + + my_array = np.linspace(0, 1, 1000) + compressed_data = zfpy.compress_numpy(my_array, tolerance=1e-3) + decompressed_array = zfpy.decompress_numpy(compressed_data) + np.testing.assert_allclose(my_array, decompressed_array, atol=1e-3) + + +@run_in_pyodide(packages=["zfpy", "numpy"]) +def test_different_dimensions(selenium) -> None: + import numpy as np + import zfpy + + np.random.seed(42) + + # Test arrays; from 1D to 4D + for dimensions in range(1, 5): + # 1. test with uniform dimensions + shape1 = tuple([5] * dimensions) + array = np.random.rand(*shape1).astype(np.float64) + compressed1 = zfpy.compress_numpy(array, write_header=True) + decompressed1 = zfpy.decompress_numpy(compressed1) + np.testing.assert_array_equal(decompressed1, array) + + # 2. test with increasing dimensions + shape2 = tuple(range(2, 2 + dimensions)) + array = np.random.rand(*shape2).astype(np.float64) + compressed2 = zfpy.compress_numpy(array, write_header=True) + decompressed2 = zfpy.decompress_numpy(compressed2) + np.testing.assert_array_equal(decompressed2, array) + + +@run_in_pyodide(packages=["zfpy", "numpy"]) +def test_different_dtypes(selenium) -> None: + """Test ZFP compression/decompression with different numeric dtypes.""" + import numpy as np + import zfpy + + np.random.seed(42) + + shape = (5, 5) + num_elements = np.prod(shape) + + # Test floating-point types + for dtype in [np.float32, np.float64]: + elements = np.random.random_sample(num_elements) + array = np.reshape(elements, shape).astype(dtype) + compressed1 = zfpy.compress_numpy(array, write_header=True) + decompressed1 = zfpy.decompress_numpy(compressed1) + np.testing.assert_array_equal(decompressed1, array) + + # Test integer types + for dtype in [np.int32, np.int64]: + array = np.random.randint(low=-(2**30), high=2**30, size=shape, dtype=dtype) + compressed2 = zfpy.compress_numpy(array, write_header=True) + decompressed2 = zfpy.decompress_numpy(compressed2) + np.testing.assert_array_equal(decompressed2, array)