|
1 | 1 | # graspologic-native |
2 | 2 |
|
3 | | -[graspologic](https://github.com/microsoft/graspologic) is a python package for graph statistics. |
| 3 | +[graspologic](https://github.com/graspologic-org/graspologic) is a Python package for graph statistics. |
4 | 4 |
|
5 | | -Some functionality can be best served if compiled into a python native module, both for performance purposes and to |
6 | | -share that functionality with web assembly. |
7 | | - |
8 | | -`graspologic-native` is a repository that holds Rust packages. The core packages will be published as crate libraries, |
9 | | -and a package using [pyo3](https://github.com/pyo3/pyo3) will expose the functionality of that library to Python. |
| 5 | +Some functionality is best served compiled into a native Python extension module for performance. `graspologic-native` holds the Rust implementation of the [Leiden community detection algorithm](https://arxiv.org/abs/1810.08473), exposed to Python via [PyO3](https://github.com/pyo3/pyo3) and built with [maturin](https://github.com/PyO3/maturin). |
10 | 6 |
|
11 | 7 | ## Requirements |
12 | | -- Rust nightly 1.37+ (we are currently using 1.40) |
13 | | -- Python 3.5+ (we are currently using 3.8) |
14 | | -- 64 bit operating system |
| 8 | + |
| 9 | +- Rust stable (edition 2024) |
| 10 | +- Python 3.9+ |
| 11 | +- [uv](https://github.com/astral-sh/uv) |
| 12 | +- 64-bit operating system |
15 | 13 |
|
16 | 14 | ## Published Versions |
17 | | -We currently build for x86_64 platforms only, Windows, macOS, and Ubuntu, for python versions 3.6 - 3.12. |
18 | 15 |
|
19 | | -## Building |
20 | | -If for any reason, the published wheels do not match your architecture or if you have a particularly old version of glibc that isn't sufficiently accounted for in our current build matrix, or you just want to build it yourself, the following build instructions should help. |
| 16 | +We build wheels for x86_64 and aarch64 on Linux, macOS (universal2), and Windows, for Python 3.9–3.13. |
21 | 17 |
|
22 | | -Note that these instructions are for Linux specifically, though they also should work for MacOS. Unfortunately, the instructions for Windows are a bit more convoluted and I will comment the sections that deviate between the three, as I'm aware of issues. |
| 18 | +## Building |
23 | 19 |
|
24 | | -Before running these instructions, ensure you have installed Rust on your system and you have the Python development headers (e.g. `python3.8-dev`) for your system. |
| 20 | +If the published wheels don't match your platform, or you want to build from source: |
25 | 21 |
|
26 | 22 | ```bash |
27 | | -rustup default nightly |
28 | | -git clone git@github.com:microsoft/graspologic-native.git |
29 | | -cd graspologic-native |
30 | | -python3.8 -m venv venv |
31 | | -pip install -U pip setuptools wheel |
32 | | -pip install maturin |
33 | | -cd packages/pyo3 |
34 | | -maturin build --release -i python3.8 # this is where things break on windows. instead of `python3.8` here, you will need the full path to the correct python.exe on your windows machine, something like `-i "C:\python38\bin\python.exe"` |
| 23 | +git clone git@github.com:graspologic-org/graspologic-native.git |
| 24 | +cd graspologic-native/packages/pyo3 |
| 25 | +uv build |
35 | 26 | ``` |
36 | 27 |
|
37 | | -Presuming a successful build, your output wheel should be in: `graspologic-native/target/wheels/` |
| 28 | +The output wheel will be in `dist/`. |
38 | 29 |
|
39 | | -## Contributing |
| 30 | +To install in a local virtual environment for development: |
40 | 31 |
|
41 | | -This project welcomes contributions and suggestions. Most contributions require you to |
42 | | -agree to a Contributor License Agreement (CLA) declaring that you have the right to, |
43 | | -and actually do, grant us the rights to use your contribution. For details, visit |
44 | | -https://cla.microsoft.com. |
| 32 | +```bash |
| 33 | +cd graspologic-native/packages/pyo3 |
| 34 | +uv sync |
| 35 | +uv pip install -e . |
| 36 | +``` |
| 37 | + |
| 38 | +## Testing |
45 | 39 |
|
46 | | -When you submit a pull request, a CLA-bot will automatically determine whether you need |
47 | | -to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the |
48 | | -instructions provided by the bot. You will only need to do this once across all repositories using our CLA. |
| 40 | +```bash |
| 41 | +cd packages/pyo3 |
| 42 | +uv run python -m unittest |
| 43 | +``` |
49 | 44 |
|
50 | | -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). |
51 | | -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) |
52 | | -or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
| 45 | +## Contributing |
53 | 46 |
|
54 | | -# Privacy |
| 47 | +This project welcomes contributions and suggestions. Please open an issue or pull request on GitHub. |
55 | 48 |
|
56 | | -`graspologic-native` does not collect, store, or transmit any information of any kind back to Microsoft. |
| 49 | +## Privacy |
57 | 50 |
|
58 | | -For your convenience, here is the link to the general [Microsoft Privacy Statement](https://privacy.microsoft.com/en-us/privacystatement/). |
| 51 | +`graspologic-native` does not collect, store, or transmit any information of any kind. |
0 commit comments