Skip to main content

Distributed Reactive Orchestration Nodes Environment

Project description

DRONE

Distributed Reactive Orchestration Nodes Environment

build PyPI Python

DRONE is a Python framework built on top of Atom that turns reactive object graphs into distributed ones. When a member value changes in one process, it is automatically pushed through a message broker to all subscribers on any machine — triggering their local Atom observers as if the change had happened locally.

Installation

pip install drones

A running Redis instance is required for the default RedisBroker.

Quick start

Publisher (process A)

from atom.api import Atom, Float
from drones import Drone, RedisBroker, drone


@drone
class MarketFeed(Atom):
    price = Float().tag(drone_publish="price")


Drone.bind(pubsub_channel="my-app", broker=RedisBroker("redis://localhost:6379"))

feed = MarketFeed()
feed.price = 185.0  # published to every subscriber on the "my-app" channel

Subscriber (process B)

from atom.api import Atom, Float, Int, observe
from drones import Drone, RedisBroker, drone


@drone
class Portfolio(Atom):
    price = Float().tag(drone_node="price")  # fed remotely
    quantity = Int(10)
    total = Float()

    @observe("price")
    def _refresh(self, change):
        self.total = self.price * self.quantity


Drone.bind(pubsub_channel="my-app", broker=RedisBroker("redis://localhost:6379"))

portfolio = Portfolio()
# portfolio.price is updated whenever MarketFeed.price changes in process A,
# firing _refresh through Atom's native observation.

See the examples/ directory for a runnable publisher/subscriber pair, and SPEC.md for the full design specification.

Core concepts

  • @drone — class decorator that instruments an Atom subclass.
  • drone_publish="name" — tag a member so its changes are published under name.
  • drone_node="name" — tag a member so it receives updates for name.
  • drone_scope="instance" — restrict delivery to the instance whose drone_id matches (node name on the wire becomes name.<drone_id>).
  • Broker — pluggable transport (DroneBroker ABC); RedisBroker ships by default.
  • Serializer — pluggable (DroneSerializer ABC); PickleSerializer is the default.

Development

This project uses pixi for local development.

pixi run test        # run the test suite
pixi run lint        # ruff check
pixi run format      # ruff format
pixi run typecheck   # mypy

Releasing

Versions are derived from git tags via hatch-vcs. To publish a release, push a tag and the GitHub Actions workflow builds and publishes to PyPI using trusted publishing:

git tag v0.1.0
git push origin v0.1.0

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drones-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drones-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file drones-0.1.0.tar.gz.

File metadata

  • Download URL: drones-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for drones-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8889220ebd838b9accf5a5e363d39ba16d69b97d72f0086bb85767fc5f0e4208
MD5 f9b471ef372ff75adbd588334f561770
BLAKE2b-256 98e5333a48f9ea65b98614e0eb9de03fbd81a30fbfc66e00323e92930817400e

See more details on using hashes here.

Provenance

The following attestation bundles were made for drones-0.1.0.tar.gz:

Publisher: main.yml on gabrielcnr/drones

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drones-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: drones-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for drones-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 def8283e5846765d44daa8ee39760259932ce3ae035675950900c6f108d141db
MD5 370015059512c2fe29aa723554e76679
BLAKE2b-256 615c0d5ce4cab83120c911eb95c9a0f55229621effc23810deb755d2f70fd728

See more details on using hashes here.

Provenance

The following attestation bundles were made for drones-0.1.0-py3-none-any.whl:

Publisher: main.yml on gabrielcnr/drones

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page