<!--
Copyright 2024 The DAPHNE Consortium
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# DaphneLib
DaphneLib is a Python wrapper for DAPHNE. Refer to the [online documentation](https://daphne-eu.github.io/daphne/).
## Compatibility
Make sure to use the __same version numbers on minor granularity__ for DAPHNE and DaphneLib to ensure compatibility. E.g., using the DAPHNE v0.3 release for DaphneLib v0.3.0.
## Prerequisites
Before starting with DaphneLib, it is necessary to obtain the DAPHNE system (binaries) separately. Follow the instructions at [Quickstart for Users](https://daphne-eu.github.io/daphne/GettingStarted/#quickstart-for-users) to obtain DAPHNE. Make sure that DAPHNE is running on it's own before using DaphneLib by executing the DAPHNE binary (`path-to/daphne/bin/daphne --help`). Depending on how you obtained DAPHNE, it could be that you need to extend the `LD_LIBRARY_PATH` environment variable:
```sh
export LD_LIBRARY_PATH=path-to/daphne/lib:path-to/daphne/thirdparty/installed/lib:$LD_LIBRARY_PATH
```
## Installation
`pip install daphne-lib`
## Setup
The environment variable `DAPHNELIB_DIR_PATH` must be set to the directory with `libdaphnelib.so` and `libAllKernels.so` in it.
```sh
export DAPHNELIB_DIR_PATH='path-to/daphne/lib'
```
## Usage
More script examples on [github](https://github.com/daphne-eu/daphne/tree/main/scripts/examples/daphnelib) and usage guide in the [online docs](https://daphne-eu.github.io/daphne/DaphneLib/Overview/).
```python
from daphne.context.daphne_context import DaphneContext
import numpy as np
dc = DaphneContext()
# Create data in numpy.
a = np.arange(8.0).reshape((2, 4))
# Transfer data to DaphneLib (lazily evaluated).
X = dc.from_numpy(a)
print("How DAPHNE sees the data from numpy:")
X.print().compute()
# Add 100 to each value in X.
X = X + 100.0
# Compute in DAPHNE, transfer result back to Python.
print("\nResult of adding 100 to each value, back in Python:")
print(X.compute())
```
## For Developers
### Build
Build Python wheel package:
```sh
pip install build
./clean.sh && python3 -m build --wheel
```
### Dev Setup
With editable install
```sh
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```
### Publish
Use [twine](https://twine.readthedocs.io/en/stable/) for publishing to [PyPI](https://pypi.org/project/daphne-lib/). Install via `pip install twine`.
1. Set `version` in `pyproject.toml` according to the DAPHNE version and [semver](https://semver.org/)
1. Build according to __Build__ section
1. `twine check dist/daphne_lib-<version>-py3-none-any.whl`
- checks the wheel file
1. `twine upload -u __token__ dist/daphne_lib-<version>-py3-none-any.whl`
- to publish to PyPI
- twine prompts for your PyPI token
Raw data
{
"_id": null,
"home_page": null,
"name": "daphne-lib",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "DAPHNE, Integrated Data Analysis Pipelines",
"author": null,
"author_email": "The DAPHNE Consortium <daphne_dev@know-center.at>",
"download_url": null,
"platform": null,
"description": "<!--\nCopyright 2024 The DAPHNE Consortium\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-->\n\n# DaphneLib\n\nDaphneLib is a Python wrapper for DAPHNE. Refer to the [online documentation](https://daphne-eu.github.io/daphne/).\n\n## Compatibility\n\nMake sure to use the __same version numbers on minor granularity__ for DAPHNE and DaphneLib to ensure compatibility. E.g., using the DAPHNE v0.3 release for DaphneLib v0.3.0.\n\n## Prerequisites\n\nBefore starting with DaphneLib, it is necessary to obtain the DAPHNE system (binaries) separately. Follow the instructions at [Quickstart for Users](https://daphne-eu.github.io/daphne/GettingStarted/#quickstart-for-users) to obtain DAPHNE. Make sure that DAPHNE is running on it's own before using DaphneLib by executing the DAPHNE binary (`path-to/daphne/bin/daphne --help`). Depending on how you obtained DAPHNE, it could be that you need to extend the `LD_LIBRARY_PATH` environment variable:\n\n```sh\nexport LD_LIBRARY_PATH=path-to/daphne/lib:path-to/daphne/thirdparty/installed/lib:$LD_LIBRARY_PATH\n```\n\n## Installation\n\n`pip install daphne-lib`\n\n## Setup\n\nThe environment variable `DAPHNELIB_DIR_PATH` must be set to the directory with `libdaphnelib.so` and `libAllKernels.so` in it.\n\n```sh\nexport DAPHNELIB_DIR_PATH='path-to/daphne/lib'\n```\n\n## Usage\n\nMore script examples on [github](https://github.com/daphne-eu/daphne/tree/main/scripts/examples/daphnelib) and usage guide in the [online docs](https://daphne-eu.github.io/daphne/DaphneLib/Overview/).\n\n```python\nfrom daphne.context.daphne_context import DaphneContext\nimport numpy as np\n\ndc = DaphneContext()\n\n# Create data in numpy.\na = np.arange(8.0).reshape((2, 4))\n\n# Transfer data to DaphneLib (lazily evaluated).\nX = dc.from_numpy(a)\n\nprint(\"How DAPHNE sees the data from numpy:\")\nX.print().compute()\n\n# Add 100 to each value in X.\nX = X + 100.0\n\n# Compute in DAPHNE, transfer result back to Python.\nprint(\"\\nResult of adding 100 to each value, back in Python:\")\nprint(X.compute())\n```\n\n## For Developers\n\n### Build\n\nBuild Python wheel package:\n\n```sh\npip install build\n./clean.sh && python3 -m build --wheel\n```\n\n### Dev Setup\n\nWith editable install\n\n```sh\npython3 -m venv .venv\nsource .venv/bin/activate\npip install -e .\n```\n\n### Publish\n\nUse [twine](https://twine.readthedocs.io/en/stable/) for publishing to [PyPI](https://pypi.org/project/daphne-lib/). Install via `pip install twine`.\n\n1. Set `version` in `pyproject.toml` according to the DAPHNE version and [semver](https://semver.org/)\n1. Build according to __Build__ section\n1. `twine check dist/daphne_lib-<version>-py3-none-any.whl`\n - checks the wheel file\n1. `twine upload -u __token__ dist/daphne_lib-<version>-py3-none-any.whl`\n - to publish to PyPI\n - twine prompts for your PyPI token\n",
"bugtrack_url": null,
"license": "Apache v2.0",
"summary": "DaphneLib: Python API for DAPHNE",
"version": "0.3.0",
"project_urls": {
"Changelog": "https://github.com/daphne-eu/daphne/releases",
"Documentation": "https://daphne-eu.github.io/daphne/DaphneLib/Overview/",
"Homepage": "https://daphne-eu.eu/",
"Issues": "https://github.com/daphne-eu/daphne/issues",
"Repository": "https://github.com/daphne-eu/daphne"
},
"split_keywords": [
"daphne",
" integrated data analysis pipelines"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "25f262a9e43d67469e14eed4427b3d11746c036d87df05af545e618e4fbee021",
"md5": "c78835832254b8df46dce6529c6e55f7",
"sha256": "d7be6d9f53aab6936da798bd1ae44d4253dd5c032f53baa7256b3d30a91a894a"
},
"downloads": -1,
"filename": "daphne_lib-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c78835832254b8df46dce6529c6e55f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 53317,
"upload_time": "2024-08-22T21:30:08",
"upload_time_iso_8601": "2024-08-22T21:30:08.091426Z",
"url": "https://files.pythonhosted.org/packages/25/f2/62a9e43d67469e14eed4427b3d11746c036d87df05af545e618e4fbee021/daphne_lib-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 21:30:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "daphne-eu",
"github_project": "daphne",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "daphne-lib"
}