appose


Nameappose JSON
Version 0.7.0 PyPI version JSON
download
home_pageNone
SummaryAppose: multi-language interprocess cooperation with shared memory.
upload_time2025-07-18 22:19:05
maintainerNone
docs_urlNone
authorAppose developers
requires_python>=3.10
licenseNone
keywords java javascript python cross-language interprocess
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Appose Python

***WARNING: Appose is currently in incubation.
Not all features described below are functional.
This document has some aspirational aspects!***

## What is Appose?

Appose is a library for interprocess cooperation with shared memory.
The guiding principles are *simplicity* and *efficiency*.

Appose was written to enable **easy execution of Python-based deep learning
from Java without copying tensors**, but its utility extends beyond that.
The steps for using Appose are:

* Build an Environment with the dependencies you need.
* Create a Service linked to a *worker*, which runs in its own process.
* Execute scripts on the worker by launching Tasks.
* Receive status updates from the task asynchronously via callbacks.

For more about Appose as a whole, see https://apposed.org.

## What is this project?

This is the **Python implementation of Appose**.

## How do I use it?

The name of the package is `appose`.

### PyPI/Pip

To use [the PyPI package](https://pypi.org/project/appose),
add `appose` to your project dependencies.

Depending on how your project is set up, this might entail editing
`requirements.txt`, `setup.py`, `setup.cfg`, and/or `pyproject.toml`.

If you are just starting out, we recommend using `pyproject.toml` (see
[this guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/#creating-pyproject-toml)):

```toml
dependencies = [
  "appose"
]
```

### Conda/Mamba

To use [the conda-forge package](https://anaconda.org/conda-forge/appose),
add `appose` to your `environment.yml`'s `dependencies` section:

```yaml
dependencies:
  - appose
```

## Examples

Here is a minimal example for calling into Java from Python:

```python
import appose
env = appose.java(vendor="zulu", version="17").build()
with env.groovy() as groovy:
    task = groovy.task("5 + 6")
    task.wait_for()
    result = task.outputs["result"]
    assert 11 == result
```

*Note: The `appose.java` builder is planned, but not yet implemented.*

Here is an example using a few more of Appose's features:

```python
import appose
from time import sleep

golden_ratio_in_groovy = """
// Approximate the golden ratio using the Fibonacci sequence.
previous = 0
current = 1
for (i=0; i<iterations; i++) {
    if (task.cancelRequested) {
        task.cancel()
        break
    }
    task.update(null, i, iterations)
    v = current
    current += previous
    previous = v
}
task.outputs["numer"] = current
task.outputs["denom"] = previous
"""

env = appose.java(vendor="zulu", version="17").build()
with env.groovy() as groovy:
    task = groovy.task(golden_ratio_in_groovy)

    def task_listener(event):
        match event.responseType:
            case ResponseType.UPDATE:
                print(f"Progress {task.current}/{task.maximum}")
            case ResponseType.COMPLETION:
                numer = task.outputs["numer"]
                denom = task.outputs["denom"]
                ratio = numer / denom
                print(f"Task complete. Result: {numer}/{denom} =~ {ratio}");
            case ResponseType.CANCELATION:
                print("Task canceled")
            case ResponseType.FAILURE:
                print(f"Task failed: {task.error}")

    task.listen(task_listener)

    task.start()
    sleep(1)
    if not task.status.is_finished():
        # Task is taking too long; request a cancelation.
        task.cancel()

    task.wait_for()
```

Of course, the above examples could have been done all in one language. But
hopefully they hint at the possibilities of easy cross-language integration.

## Issue tracker

All implementations of Appose use the same issue tracker:

https://github.com/apposed/appose/issues

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "appose",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "java, javascript, python, cross-language, interprocess",
    "author": "Appose developers",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/b6/c1/eee6eb172991b48a2361875a97951de5f33e5edf1dbc1c8a89c7382597cb/appose-0.7.0.tar.gz",
    "platform": null,
    "description": "# Appose Python\n\n***WARNING: Appose is currently in incubation.\nNot all features described below are functional.\nThis document has some aspirational aspects!***\n\n## What is Appose?\n\nAppose is a library for interprocess cooperation with shared memory.\nThe guiding principles are *simplicity* and *efficiency*.\n\nAppose was written to enable **easy execution of Python-based deep learning\nfrom Java without copying tensors**, but its utility extends beyond that.\nThe steps for using Appose are:\n\n* Build an Environment with the dependencies you need.\n* Create a Service linked to a *worker*, which runs in its own process.\n* Execute scripts on the worker by launching Tasks.\n* Receive status updates from the task asynchronously via callbacks.\n\nFor more about Appose as a whole, see https://apposed.org.\n\n## What is this project?\n\nThis is the **Python implementation of Appose**.\n\n## How do I use it?\n\nThe name of the package is `appose`.\n\n### PyPI/Pip\n\nTo use [the PyPI package](https://pypi.org/project/appose),\nadd `appose` to your project dependencies.\n\nDepending on how your project is set up, this might entail editing\n`requirements.txt`, `setup.py`, `setup.cfg`, and/or `pyproject.toml`.\n\nIf you are just starting out, we recommend using `pyproject.toml` (see\n[this guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/#creating-pyproject-toml)):\n\n```toml\ndependencies = [\n  \"appose\"\n]\n```\n\n### Conda/Mamba\n\nTo use [the conda-forge package](https://anaconda.org/conda-forge/appose),\nadd `appose` to your `environment.yml`'s `dependencies` section:\n\n```yaml\ndependencies:\n  - appose\n```\n\n## Examples\n\nHere is a minimal example for calling into Java from Python:\n\n```python\nimport appose\nenv = appose.java(vendor=\"zulu\", version=\"17\").build()\nwith env.groovy() as groovy:\n    task = groovy.task(\"5 + 6\")\n    task.wait_for()\n    result = task.outputs[\"result\"]\n    assert 11 == result\n```\n\n*Note: The `appose.java` builder is planned, but not yet implemented.*\n\nHere is an example using a few more of Appose's features:\n\n```python\nimport appose\nfrom time import sleep\n\ngolden_ratio_in_groovy = \"\"\"\n// Approximate the golden ratio using the Fibonacci sequence.\nprevious = 0\ncurrent = 1\nfor (i=0; i<iterations; i++) {\n    if (task.cancelRequested) {\n        task.cancel()\n        break\n    }\n    task.update(null, i, iterations)\n    v = current\n    current += previous\n    previous = v\n}\ntask.outputs[\"numer\"] = current\ntask.outputs[\"denom\"] = previous\n\"\"\"\n\nenv = appose.java(vendor=\"zulu\", version=\"17\").build()\nwith env.groovy() as groovy:\n    task = groovy.task(golden_ratio_in_groovy)\n\n    def task_listener(event):\n        match event.responseType:\n            case ResponseType.UPDATE:\n                print(f\"Progress {task.current}/{task.maximum}\")\n            case ResponseType.COMPLETION:\n                numer = task.outputs[\"numer\"]\n                denom = task.outputs[\"denom\"]\n                ratio = numer / denom\n                print(f\"Task complete. Result: {numer}/{denom} =~ {ratio}\");\n            case ResponseType.CANCELATION:\n                print(\"Task canceled\")\n            case ResponseType.FAILURE:\n                print(f\"Task failed: {task.error}\")\n\n    task.listen(task_listener)\n\n    task.start()\n    sleep(1)\n    if not task.status.is_finished():\n        # Task is taking too long; request a cancelation.\n        task.cancel()\n\n    task.wait_for()\n```\n\nOf course, the above examples could have been done all in one language. But\nhopefully they hint at the possibilities of easy cross-language integration.\n\n## Issue tracker\n\nAll implementations of Appose use the same issue tracker:\n\nhttps://github.com/apposed/appose/issues\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Appose: multi-language interprocess cooperation with shared memory.",
    "version": "0.7.0",
    "project_urls": {
        "documentation": "https://github.com/apposed/appose-python/blob/main/README.md",
        "download": "https://pypi.org/project/appose-python",
        "homepage": "https://github.com/apposed/appose-python",
        "source": "https://github.com/apposed/appose-python",
        "tracker": "https://github.com/apposed/appose/issues"
    },
    "split_keywords": [
        "java",
        " javascript",
        " python",
        " cross-language",
        " interprocess"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f53f4e2ab7bbdb3c3a8d405d7383642dd17e75190fd9a359e2358aae84aa86c5",
                "md5": "9c7e6dfd163103179241e8ba1cfbfadf",
                "sha256": "90a6f815aad5a6a7d25a5c26a760cd19d7510c2b3cf4a9d4ec0509a1107f2a8b"
            },
            "downloads": -1,
            "filename": "appose-0.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9c7e6dfd163103179241e8ba1cfbfadf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 22983,
            "upload_time": "2025-07-18T22:19:04",
            "upload_time_iso_8601": "2025-07-18T22:19:04.698468Z",
            "url": "https://files.pythonhosted.org/packages/f5/3f/4e2ab7bbdb3c3a8d405d7383642dd17e75190fd9a359e2358aae84aa86c5/appose-0.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b6c1eee6eb172991b48a2361875a97951de5f33e5edf1dbc1c8a89c7382597cb",
                "md5": "fed3baecd6c32225798ad9643080d105",
                "sha256": "09c62543d2d6940712f14c9d4a792316fa52d790b642fd93cafbfdf9c7938e16"
            },
            "downloads": -1,
            "filename": "appose-0.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fed3baecd6c32225798ad9643080d105",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 21194,
            "upload_time": "2025-07-18T22:19:05",
            "upload_time_iso_8601": "2025-07-18T22:19:05.959114Z",
            "url": "https://files.pythonhosted.org/packages/b6/c1/eee6eb172991b48a2361875a97951de5f33e5edf1dbc1c8a89c7382597cb/appose-0.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-18 22:19:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "apposed",
    "github_project": "appose-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "appose"
}
        
Elapsed time: 1.22485s