Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions recipes/recipes_emscripten/rustworkx/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash


export MATURIN_PYTHON_SYSCONFIGDATA_DIR=${PREFIX}/etc/conda/_sysconfigdata__emscripten_wasm32-emscripten.py
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
${PYTHON} -m pip install . -vvv

41 changes: 41 additions & 0 deletions recipes/recipes_emscripten/rustworkx/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
context:
name: rustworkx
version: 0.17.0a3

package:
name: ${{name}}
version: ${{ version }}

source:
- url: https://github.com/IvanIsCoding/rustworkx/releases/download/v0.17.0a3/rustworkx-0.17.0a3.tar.gz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this is one of the few shortfalls of this PR. I hope the forked alpha is OK, we never tried a pre-release on rustworkx's side

sha256: 8bd0c295134e2b0c03808d4e69428b41153849db6488839084a78793c337f191

build:
number: 0

requirements:
build:
- cross-python_${{target_platform}}
- cffi
- setuptools-rust
- rust
- rust-src
- maturin

host:
- python
- openssl
- cffi
run:
- cffi

tests:
- script: pytester
requirements:
build:
- pytester
run:
- pytester-run
files:
recipe:
- test_rustworkx.py
22 changes: 22 additions & 0 deletions recipes/recipes_emscripten/rustworkx/test_rustworkx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import rustworkx

def test_isomorphism():
# Adapted from tests/graph/test_isomorphic.py to work with pytest
n = 15
upper_bound_k = (n - 1) // 2
for k in range(1, upper_bound_k + 1):
for t in range(k, upper_bound_k + 1):
result = rustworkx.is_isomorphic(
rustworkx.generators.generalized_petersen_graph(n, k),
rustworkx.generators.generalized_petersen_graph(n, t),
)
expected = (k == t) or (k == n - t) or (k * t % n == 1) or (k * t % n == n - 1)
assert result == expected

def test_rayon_works():
# This essentially tests that multi-threading is set to one core and does not panic
graph = rustworkx.generators.cycle_graph(10)
path_lenghts_floyd = rustworkx.floyd_warshall(graph)
path_lenghts_no_self = rustworkx.all_pairs_dijkstra_path_lengths(graph, lambda _: 1.0)
path_lenghts_dijkstra = {k: {**v, k: 0.0} for k, v in path_lenghts_no_self.items()}
assert path_lenghts_floyd == path_lenghts_dijkstra