Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
rth committed Nov 26, 2018
1 parent 495cec1 commit 750d739
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
31 changes: 16 additions & 15 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# py-text-vectorize

This is a Python
This is a Python wrapper for the Rust text-vectorize crate.

- Prerequirement
WIP.

```
sudo pip3 install -r requirements.txt
docker build -t py-text-vectorize-env .
./start_docker_env.sh
```
## Installation

### Manual install

- Build
This requires Python 3.5+ as well as Rust nightly >=1.30.0
(due to [rust-numpy](https://github.com/rust-numpy/rust-numpy) and
[pyo3](https://github.com/PyO3/pyo3) requirements),

To build the Python package, run,
```
pip install -r requirements.txt
python3 setup.py develop --user
```

- Run
### Docker environment

```python
import numpy as np
import rust_ext
The easiest might be to use docker to setup a build environment,

a = np.array([0.0, 1.0])
b = np.array([2.0, 3.0])
rust_ext(2.0, a, b)
```
docker build -t py-text-vectorize-env .
./start_docker_env.sh
python3 setup.py develop --user
```
2 changes: 2 additions & 0 deletions python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ fn _lib(_py: Python, m: &PyModule) -> PyResult<()> {
indptr.push(1);
values.push(1);

// XXX: add actual call to text_vectorize


(indices.into_pyarray(_py).to_owned(),
values.into_pyarray(_py).to_owned(),
Expand Down

0 comments on commit 750d739

Please sign in to comment.