Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daphnelib: improve pyproject.toml and readme #743

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 64 additions & 3 deletions src/api/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,62 @@ limitations under the License.

# DaphneLib

Refer to the [online docs](https://daphne-eu.github.io/daphne/) for documentation.
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.

## Build
```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:

Expand All @@ -31,7 +80,7 @@ pip install build
./clean.sh && python3 -m build --wheel
```

## Dev Setup
### Dev Setup

With editable install

Expand All @@ -40,3 +89,15 @@ 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
3 changes: 2 additions & 1 deletion src/api/python/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
# limitations under the License.

rm -rf build
rm -rf dist
rm -rf dist
rm -rf *.egg-info
20 changes: 15 additions & 5 deletions src/api/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "daphne"
name = "daphne-lib"
authors = [
{name = "The DAPHNE Consortium", email = "daphne_dev@know-center.at"},
]
Expand All @@ -12,18 +12,28 @@ readme = "README.md"
requires-python = ">=3.8"
license = {text = "Apache v2.0"}
classifiers = [
"License :: Apache v2.0",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: Apache Software License",
"Operating System :: POSIX :: Linux",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Distributed Computing",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Mathematics",
]
keywords = [
"DAPHNE",
"Integrated Data Analysis Pipelines",
]
dependencies = [
"pandas",
]
version = "0.2.0"
version = "0.3.0-alpha.1"

[project.urls]
Homepage = "https://daphne-eu.eu/"
Documentation = "https://daphne-eu.github.io/daphne/"
Documentation = "https://daphne-eu.github.io/daphne/DaphneLib/Overview/"
Repository = "https://github.com/daphne-eu/daphne"
Issues = "https://github.com/daphne-eu/daphne/issues"
Changelog = "https://github.com/daphne-eu/daphne/releases"
Expand Down
Loading