-
Notifications
You must be signed in to change notification settings - Fork 58
Add rustworkx alpha recipe
#90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
agriyakhetarpal
merged 7 commits into
pyodide:main
from
IvanIsCoding:add-rustworkx-recipe
May 16, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
83394c6
Add meta.yaml for rustworkx
IvanIsCoding 50327af
Add first test
IvanIsCoding 2470c25
Add second test to check Rayon works
IvanIsCoding dad1b13
Remove unnecessary stuff from RUSTFLAGS
IvanIsCoding 8cf50ff
Restore emscripten-wasm-eh
IvanIsCoding 6166a8e
Reuse default RUSTFLAGS
IvanIsCoding 4e7a4d3
Use correct identifier for Apache
IvanIsCoding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package: | ||
| name: rustworkx | ||
| version: 0.17.0a3 | ||
| top-level: | ||
| - rustworkx | ||
| tag: | ||
| - rust | ||
| source: | ||
| url: https://github.com/IvanIsCoding/rustworkx/releases/download/v0.17.0a3/rustworkx-0.17.0a3.tar.gz | ||
| sha256: 8bd0c295134e2b0c03808d4e69428b41153849db6488839084a78793c337f191 | ||
| build: | ||
| script: export RUSTFLAGS="$RUSTFLAGS -C target-feature=+atomics,+bulk-memory,+mutable-globals" | ||
| requirements: | ||
| executable: | ||
| - rustup | ||
| test: | ||
| imports: | ||
| - rustworkx | ||
| about: | ||
| home: https://github.com/Qiskit/rustworkx | ||
| PyPI: https://pypi.org/project/rustworkx | ||
| summary: A python graph library implemented in Rust | ||
| license: Apache-2.0 | ||
| extra: | ||
| recipe-maintainers: | ||
| - IvanIsCoding | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| from pytest_pyodide import run_in_pyodide | ||
|
|
||
|
|
||
| @run_in_pyodide(packages=["rustworkx"]) | ||
| def test_isomorphism(selenium): | ||
| # Adapted from tests/graph/test_isomorphic.py to work with pytest | ||
| import rustworkx | ||
|
|
||
| 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 | ||
|
|
||
| @run_in_pyodide(packages=["rustworkx"]) | ||
| def test_rayon_works(selenium): | ||
| # This essentially tests that multi-threading is set to one core and does not panic | ||
| import rustworkx | ||
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.