[![PyPI version](https://badge.fury.io/py/bool-to-int8-ray.svg)](https://badge.fury.io/py/bool-to-int8-ray)
[![PyPi downloads](https://img.shields.io/pypi/dm/bool-to-int8-ray)](https://img.shields.io/pypi/dm/bool-to-int8-ray)
# bool-to-int8-ray
bool to int8 serialization with ray.io
## Installation
```
pip install bool-to-int8-ray
```
## Usage
```sh
export B2I8_PCT_CPU=0.6
```
```py
from bool_to_int8_ray import bool_to_int8_batch, int8_to_bool_batch
import numpy as np
# given lists of binary hashes
hashvalues = np.array([
[1, 0, 1, 0, 1, 1, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 1]
])
# convert to list of int8 values
serialized = bool_to_int8_batch(hashvalues)
# convert back
deserialized = int8_to_bool_batch(serialized)
```
## Speed Test
```sh
source .venv/bin/activate
export B2I8_PCT_CPU=0.6
python test/speedtest.py
```
Results
```
4.776991 -- numpy version, hash to int8
6.031101 -- numpy version, int8 to hash
2.308446 -- ray.io version, hash to int8
3.023865 -- ray.io version, int8 to hash
```
## Appendix
### Installation
The `bool-to-int8-ray` [git repo](http://github.com/ulf1/bool-to-int8-ray) is available as [PyPi package](https://pypi.org/project/bool-to-int8-ray)
```sh
pip install bool-to-int8-ray
pip install git+ssh://git@github.com/ulf1/bool-to-int8-ray.git
```
### Install a virtual environment
```sh
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt --no-cache-dir
pip install -r requirements-dev.txt --no-cache-dir
```
(If your git repo is stored in a folder with whitespaces, then don't use the subfolder `.venv`. Use an absolute path without whitespaces.)
### Python commands
* Jupyter for the examples: `jupyter lab`
* Check syntax: `flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')`
* Run Unit Tests: `PYTHONPATH=. pytest`
* Run Speed Test: `python test/speedtest.py`
Publish
```sh
# pandoc README.md --from markdown --to rst -s -o README.rst
python setup.py sdist
twine upload -r pypi dist/*
```
### Clean up
```sh
find . -type f -name "*.pyc" | xargs rm
find . -type d -name "__pycache__" | xargs rm -r
rm -r .pytest_cache
rm -r .venv
```
### Support
Please [open an issue](https://github.com/ulf1/bool-to-int8-ray/issues/new) for support.
### Contributing
Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/ulf1/bool-to-int8-ray/compare/).
### Acknowledgements
The "Evidence" project was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - [433249742](https://gepris.dfg.de/gepris/projekt/433249742) (GU 798/27-1; GE 1119/11-1).
### Maintenance
- till 31.Aug.2023 (v0.1.1) the code repository was maintained within the DFG project [433249742](https://gepris.dfg.de/gepris/projekt/433249742)
- since 01.Sep.2023 (v0.2.0) the code repository is maintained by [@ulf1](https://github.com/ulf1).
Raw data
{
"_id": null,
"home_page": "http://github.com/ulf1/bool-to-int8-ray",
"name": "bool-to-int8-ray",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Ulf Hamster",
"author_email": "554c46@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9a/8e/87d82d5937fa1c808f904e5ee0079dfe478a926b47bea22521459aea8e7a/bool-to-int8-ray-0.2.0.tar.gz",
"platform": null,
"description": "[![PyPI version](https://badge.fury.io/py/bool-to-int8-ray.svg)](https://badge.fury.io/py/bool-to-int8-ray)\n[![PyPi downloads](https://img.shields.io/pypi/dm/bool-to-int8-ray)](https://img.shields.io/pypi/dm/bool-to-int8-ray)\n\n# bool-to-int8-ray\nbool to int8 serialization with ray.io\n\n## Installation\n\n```\npip install bool-to-int8-ray\n```\n\n## Usage\n\n```sh\nexport B2I8_PCT_CPU=0.6\n```\n\n```py\nfrom bool_to_int8_ray import bool_to_int8_batch, int8_to_bool_batch\nimport numpy as np\n\n# given lists of binary hashes\nhashvalues = np.array([\n [1, 0, 1, 0, 1, 1, 0, 0],\n [1, 1, 0, 0, 0, 0, 0, 1]\n])\n# convert to list of int8 values\nserialized = bool_to_int8_batch(hashvalues)\n# convert back\ndeserialized = int8_to_bool_batch(serialized)\n```\n\n## Speed Test\n\n```sh\nsource .venv/bin/activate\nexport B2I8_PCT_CPU=0.6\npython test/speedtest.py\n```\n\nResults\n```\n 4.776991 -- numpy version, hash to int8\n 6.031101 -- numpy version, int8 to hash\n 2.308446 -- ray.io version, hash to int8\n 3.023865 -- ray.io version, int8 to hash\n```\n\n## Appendix\n\n### Installation\nThe `bool-to-int8-ray` [git repo](http://github.com/ulf1/bool-to-int8-ray) is available as [PyPi package](https://pypi.org/project/bool-to-int8-ray)\n\n```sh\npip install bool-to-int8-ray\npip install git+ssh://git@github.com/ulf1/bool-to-int8-ray.git\n```\n\n### Install a virtual environment\n\n```sh\npython3 -m venv .venv\nsource .venv/bin/activate\npip install --upgrade pip\npip install -r requirements.txt --no-cache-dir\npip install -r requirements-dev.txt --no-cache-dir\n```\n\n(If your git repo is stored in a folder with whitespaces, then don't use the subfolder `.venv`. Use an absolute path without whitespaces.)\n\n### Python commands\n\n* Jupyter for the examples: `jupyter lab`\n* Check syntax: `flake8 --ignore=F401 --exclude=$(grep -v '^#' .gitignore | xargs | sed -e 's/ /,/g')`\n* Run Unit Tests: `PYTHONPATH=. pytest`\n* Run Speed Test: `python test/speedtest.py`\n\nPublish\n\n```sh\n# pandoc README.md --from markdown --to rst -s -o README.rst\npython setup.py sdist \ntwine upload -r pypi dist/*\n```\n\n### Clean up \n\n```sh\nfind . -type f -name \"*.pyc\" | xargs rm\nfind . -type d -name \"__pycache__\" | xargs rm -r\nrm -r .pytest_cache\nrm -r .venv\n```\n\n\n### Support\nPlease [open an issue](https://github.com/ulf1/bool-to-int8-ray/issues/new) for support.\n\n\n### Contributing\nPlease contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/ulf1/bool-to-int8-ray/compare/).\n\n### Acknowledgements\nThe \"Evidence\" project was funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) - [433249742](https://gepris.dfg.de/gepris/projekt/433249742) (GU 798/27-1; GE 1119/11-1).\n\n### Maintenance\n- till 31.Aug.2023 (v0.1.1) the code repository was maintained within the DFG project [433249742](https://gepris.dfg.de/gepris/projekt/433249742)\n- since 01.Sep.2023 (v0.2.0) the code repository is maintained by [@ulf1](https://github.com/ulf1).\n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "bool to int8 serialization with ray.io",
"version": "0.2.0",
"project_urls": {
"Homepage": "http://github.com/ulf1/bool-to-int8-ray"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9a8e87d82d5937fa1c808f904e5ee0079dfe478a926b47bea22521459aea8e7a",
"md5": "6abd17e39620d22256428f8c3ef0498f",
"sha256": "4bbbc4e4fe45cfd066f06040c6fc2cd8ebaa2546170b2c843827a0c7d3f40dbb"
},
"downloads": -1,
"filename": "bool-to-int8-ray-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "6abd17e39620d22256428f8c3ef0498f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 8218,
"upload_time": "2023-07-10T08:31:21",
"upload_time_iso_8601": "2023-07-10T08:31:21.913032Z",
"url": "https://files.pythonhosted.org/packages/9a/8e/87d82d5937fa1c808f904e5ee0079dfe478a926b47bea22521459aea8e7a/bool-to-int8-ray-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-10 08:31:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ulf1",
"github_project": "bool-to-int8-ray",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"<",
"2"
],
[
">=",
"1.19.5"
]
]
},
{
"name": "ray",
"specs": [
[
">=",
"2"
],
[
"<",
"3"
]
]
},
{
"name": "psutil",
"specs": [
[
">=",
"5"
]
]
}
],
"lcname": "bool-to-int8-ray"
}