Metadata-Version: 2.3
Name: navis-fastcore
Version: 0.0.3
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: numpy >=1.21.0
License-File: LICENSE
Summary: NAVis core functions reimplemented in Rust.
Author-email: Philipp Schlegel <pms70@cam.ac.uk>
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://schlegelp.github.io/fastcore-rs/
Project-URL: Repository, https://github.com/schlegelp/fastcore-rs
Project-URL: Issues, https://github.com/schlegelp/fastcore-rs/issues
Project-URL: Changelog, https://github.com/schlegelp/fastcore-rs/blob/master/CHANGELOG.md

[![docs](https://github.com/schlegelp/fastcore-rs/actions/workflows/docs.yaml/badge.svg)](https://schlegelp.github.io/fastcore-rs/)

# fastcore-rs
Rust re-implementation of `navis` core functions. Check out the [documentation](https://schlegelp.github.io/fastcore-rs/) for details.

## TO-DOs
- [x] geodesic distances
- [x] connected components
- [x] generation of linear segments
- [x] synapse flow centrality
- [x] Strahler index
- [x] classify nodes
- [ ] flow centrality
- [ ] CI tests
- [ ] NBLAST (started a prototype)
- [ ] shortest paths
- [ ] cater for `i32` node IDs which are currently cast up to `i64`
- [ ] faster version of `navis.connected_subgraph`

### Additional Notes
- internally, we use `i32` to represent node indices which means we can't
  process neurons with more than 2,147,483,647 nodes (should be fine though)

## Install

We provide precompiled binaries for all major Python versions, CPU architectures and operating systems.

From [PyPI](https://pypi.org/project/navis-fastcore):

```bash
pip install navis-fastcore
```

If that fails, try building from source (see below).

## Usage

`navis` will automatically use `fastcore` if it is available.
The integration is still work in progress, so for now you
should install `navis` from Github to make sure you have the
latest version.

## Build

1. [Install rust](https://www.rust-lang.org/tools/install)
2. Clone this repository
3. `cd` into `fastcore-rs` directory
4. Create a virtual environment: `python3 -m venv .venv`
5. Activate virtual environment: `source .venv/bin/activate`
6. Compile via either:
   - `maturin develop --release` which will compile the
     extension into the `fastcore/` directory
   - `maturin build --release` to build wheel in `/target/wheels`
7. To install the Python package either do:
  -  `pip install -e .` to install in editable mode
  - `pip install targets/wheels/navis_fastcore....whl`

Note that unless you compiled with the `--release` flag,
timings will be much slower (up to 10x) than in a release build!

## Test
First make sure `pytest` is installed:
```
pip install pytest -U
```

Then run the test-suite like so:
```
pytest --verbose -s
```

