zignode


Namezignode JSON
Version 25.2 PyPI version JSON
download
home_pageNone
SummaryModular Zigfi Node framework for distributed control and automation
upload_time2025-07-26 17:18:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseApache-2.0
keywords iot zigfi automation zignode modular
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # πŸ”Œ Zignode – Zero-Effort, Self-Discovering RPC for Python (and Beyond)

**Zignode** is a lightweight framework that turns any script (Python and potentially others) into a smart, networked node β€” often with just a single line of code in Python.
Forget about manual server configuration and request handling. Simply expose your functions and let the nodes discover, communicate, and collaborate automatically on your local network.

This project was born from the practical needs of an electronics enthusiast: how to easily control devices connected to a Raspberry Pi (or similar systems) without writing a dedicated server for each project?
**Zignode is the answer**, offering a universal and instant solution.

Although originally implemented in Python, the **Zignode protocol** is language-agnostic. Support for other platforms (e.g., Arduino/C++, Node.js) is actively being explored.

---

## ✨ Key Features

* βš™οΈ **Effortless Python Integration**
  Just call `zignode.auto(locals())` at the end of your script β€” and all your functions become available on the network.

* 🌐 **Automatic Network Discovery**
  Nodes scan the local network to find others β€” no config files, no central server required.

* 🧐 **Intelligent Function Routing**
  Zignode builds a "mesh mind" across the network. If a function isn't available locally, it automatically forwards the call to the right node β€” even via 2-hop neighbors.

* 🎯 **Targeted or Automatic Execution**
  Call a specific node (by ID) or let the network choose the best node for the job.

* 🧱 **Built-in Web UI**
  Each node hosts a web interface with its function list, status info, and discovered neighbors.

* πŸ›ŽοΈ **Integrated Utilities**
  Optional built-in helpers: `msg()`, `notif()`, `speak()` for notifications and TTS (RHVoice/Linux).

* 🦦 **Lightweight & Interoperable**
  Fully async (`aiohttp`, `netifaces2`), using standard HTTP/JSON β€” works great with ESP32, MicroPython, and is extendable to C++/Arduino/Node.js.

---

## βš™οΈ Requirements

* Python **3.8+**
* Automatically installs:

  * `aiohttp`
  * `netifaces2`

---

## πŸ“¦ Installation

```bash
pip install zignode
```

---

## πŸ§ͺ Usage Example (Python)

```python
#!/usr/bin/python
# -*- coding: utf-8 -*-

import zignode

def set_servo_position(position: int):
    print(f"SERVO: Setting position to {position} degrees.")
    return f"Servo position set to {position}."

def read_temperature():
    temp = 23.5
    print(f"SENSOR: Read temperature: {temp}Β°C")
    return {"temperature": temp, "unit": "Celsius"}

if __name__ == '__main__':
    zignode.auto(
        external_locals=locals(),
        debug_mode=True,
        manual_node_list=[('192.168.1.101', 8635)]
    )
```

---

## πŸ“‘ How It Works

Zignode creates a peer-to-peer network where every node is equal.

**Startup**

* The node starts a local HTTP server and begins scanning the network.

**Discovery**

* On port `8635`, Zignode discovers others, exchanging available functions and neighbors.

**Execution**

* When a call is made:

  1. If the function exists locally β†’ execute.
  2. Else β†’ check neighbors.
  3. If needed β†’ 2-hop route via neighbor’s neighbors.

This builds a self-healing, mesh-style RPC network.

---

## πŸ“¬ How to Call Functions

You can use any HTTP client (`curl`, `requests`, Postman) to call functions on any node.

### 1. Call a local or auto-routed function:

```bash
curl -X POST -H "Content-Type: application/json" \
-d '{"call": "set_servo_position", "args": [90]}' \
http://localhost:8635/
```

### 2. Call a function on a specific node (by ID):

```bash
curl -X POST -H "Content-Type: application/json" \
-d '{"call": "read_temperature", "id": "a1b2c3d4-..."}' \
http://localhost:8635/
```

### 3. Send a message using `msg()`:

```bash
curl -X POST -H "Content-Type: application/json" \
-d '{"call": "msg", "args": ["Message from the network!"]}' \
http://localhost:8635/
```

---

## πŸ— Web UI

Each node automatically hosts a web page at `http://<ip>:8635/`, showing:

* Node ID
* Available functions
* Discovered neighbors
* Optional logs

*(Screenshot coming soon)*

---

## 🚧 Roadmap

* [ ] Authentication & API tokens
* [ ] Optional encryption (Fernet or TLS)
* [ ] Multicast ZeroConf support
* [ ] WebSocket-based push events
* [ ] Native MicroPython/ESP8266 bridge
* [ ] Arduino/C++ protocol client
* [ ] Node.js-compatible Zignode client

---

## πŸ§‘β€πŸ’» Authors & Credits

* Concept, architecture & integration: **Zigfi** ([GitHub](https://github.com/zigfi7))
* Early implementations & sync version: written by Zigfi
* Code support provided by AI assistants:

  * **Gemini** (Google)
  * **ChatGPT** (OpenAI)
  * **Claude** (Anthropic)
  * **Mistral**, **Tulu3** and others
* Protocol and structure are designed to be **human-readable and language-agnostic**

Feedback, forks and PRs welcome!

---

## πŸ“œ License

This project is licensed under the **Apache 2.0 License**. See [LICENSE](./LICENSE) for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "zignode",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "iot, zigfi, automation, zignode, modular",
    "author": null,
    "author_email": "\"(Zigfi) Artur Kujawa\" <zigfi@zigfi.net>",
    "download_url": "https://files.pythonhosted.org/packages/a2/36/81828cde604e62da821d6da52143c79d57dbf5d82d4dda3f4265e38f4e60/zignode-25.2.tar.gz",
    "platform": null,
    "description": "# \ud83d\udd0c Zignode \u2013 Zero-Effort, Self-Discovering RPC for Python (and Beyond)\n\n**Zignode** is a lightweight framework that turns any script (Python and potentially others) into a smart, networked node \u2014 often with just a single line of code in Python.\nForget about manual server configuration and request handling. Simply expose your functions and let the nodes discover, communicate, and collaborate automatically on your local network.\n\nThis project was born from the practical needs of an electronics enthusiast: how to easily control devices connected to a Raspberry Pi (or similar systems) without writing a dedicated server for each project?\n**Zignode is the answer**, offering a universal and instant solution.\n\nAlthough originally implemented in Python, the **Zignode protocol** is language-agnostic. Support for other platforms (e.g., Arduino/C++, Node.js) is actively being explored.\n\n---\n\n## \u2728 Key Features\n\n* \u2699\ufe0f **Effortless Python Integration**\n  Just call `zignode.auto(locals())` at the end of your script \u2014 and all your functions become available on the network.\n\n* \ud83c\udf10 **Automatic Network Discovery**\n  Nodes scan the local network to find others \u2014 no config files, no central server required.\n\n* \ud83e\uddd0 **Intelligent Function Routing**\n  Zignode builds a \"mesh mind\" across the network. If a function isn't available locally, it automatically forwards the call to the right node \u2014 even via 2-hop neighbors.\n\n* \ud83c\udfaf **Targeted or Automatic Execution**\n  Call a specific node (by ID) or let the network choose the best node for the job.\n\n* \ud83e\uddf1 **Built-in Web UI**\n  Each node hosts a web interface with its function list, status info, and discovered neighbors.\n\n* \ud83d\udece\ufe0f **Integrated Utilities**\n  Optional built-in helpers: `msg()`, `notif()`, `speak()` for notifications and TTS (RHVoice/Linux).\n\n* \ud83e\udda6 **Lightweight & Interoperable**\n  Fully async (`aiohttp`, `netifaces2`), using standard HTTP/JSON \u2014 works great with ESP32, MicroPython, and is extendable to C++/Arduino/Node.js.\n\n---\n\n## \u2699\ufe0f Requirements\n\n* Python **3.8+**\n* Automatically installs:\n\n  * `aiohttp`\n  * `netifaces2`\n\n---\n\n## \ud83d\udce6 Installation\n\n```bash\npip install zignode\n```\n\n---\n\n## \ud83e\uddea Usage Example (Python)\n\n```python\n#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport zignode\n\ndef set_servo_position(position: int):\n    print(f\"SERVO: Setting position to {position} degrees.\")\n    return f\"Servo position set to {position}.\"\n\ndef read_temperature():\n    temp = 23.5\n    print(f\"SENSOR: Read temperature: {temp}\u00b0C\")\n    return {\"temperature\": temp, \"unit\": \"Celsius\"}\n\nif __name__ == '__main__':\n    zignode.auto(\n        external_locals=locals(),\n        debug_mode=True,\n        manual_node_list=[('192.168.1.101', 8635)]\n    )\n```\n\n---\n\n## \ud83d\udce1 How It Works\n\nZignode creates a peer-to-peer network where every node is equal.\n\n**Startup**\n\n* The node starts a local HTTP server and begins scanning the network.\n\n**Discovery**\n\n* On port `8635`, Zignode discovers others, exchanging available functions and neighbors.\n\n**Execution**\n\n* When a call is made:\n\n  1. If the function exists locally \u2192 execute.\n  2. Else \u2192 check neighbors.\n  3. If needed \u2192 2-hop route via neighbor\u2019s neighbors.\n\nThis builds a self-healing, mesh-style RPC network.\n\n---\n\n## \ud83d\udcec How to Call Functions\n\nYou can use any HTTP client (`curl`, `requests`, Postman) to call functions on any node.\n\n### 1. Call a local or auto-routed function:\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n-d '{\"call\": \"set_servo_position\", \"args\": [90]}' \\\nhttp://localhost:8635/\n```\n\n### 2. Call a function on a specific node (by ID):\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n-d '{\"call\": \"read_temperature\", \"id\": \"a1b2c3d4-...\"}' \\\nhttp://localhost:8635/\n```\n\n### 3. Send a message using `msg()`:\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n-d '{\"call\": \"msg\", \"args\": [\"Message from the network!\"]}' \\\nhttp://localhost:8635/\n```\n\n---\n\n## \ud83d\uddd0 Web UI\n\nEach node automatically hosts a web page at `http://<ip>:8635/`, showing:\n\n* Node ID\n* Available functions\n* Discovered neighbors\n* Optional logs\n\n*(Screenshot coming soon)*\n\n---\n\n## \ud83d\udea7 Roadmap\n\n* [ ] Authentication & API tokens\n* [ ] Optional encryption (Fernet or TLS)\n* [ ] Multicast ZeroConf support\n* [ ] WebSocket-based push events\n* [ ] Native MicroPython/ESP8266 bridge\n* [ ] Arduino/C++ protocol client\n* [ ] Node.js-compatible Zignode client\n\n---\n\n## \ud83e\uddd1\u200d\ud83d\udcbb Authors & Credits\n\n* Concept, architecture & integration: **Zigfi** ([GitHub](https://github.com/zigfi7))\n* Early implementations & sync version: written by Zigfi\n* Code support provided by AI assistants:\n\n  * **Gemini** (Google)\n  * **ChatGPT** (OpenAI)\n  * **Claude** (Anthropic)\n  * **Mistral**, **Tulu3** and others\n* Protocol and structure are designed to be **human-readable and language-agnostic**\n\nFeedback, forks and PRs welcome!\n\n---\n\n## \ud83d\udcdc License\n\nThis project is licensed under the **Apache 2.0 License**. See [LICENSE](./LICENSE) for details.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Modular Zigfi Node framework for distributed control and automation",
    "version": "25.2",
    "project_urls": {
        "Homepage": "https://github.com/zigfi7/zignode/",
        "Repository": "https://github.com/zigfi7/zignode/"
    },
    "split_keywords": [
        "iot",
        " zigfi",
        " automation",
        " zignode",
        " modular"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "020d93b19729f8a8922cbff2fa1395bc6c4edd6be65cf9cb84dcf170a9ca786a",
                "md5": "3b1e473875d4be7b7382d2bc0a337d28",
                "sha256": "60f4f6e4f790e1aa78b26e37e4d3fff95e10320472a6004c8dd8b4e75f36ba6f"
            },
            "downloads": -1,
            "filename": "zignode-25.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b1e473875d4be7b7382d2bc0a337d28",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 19472,
            "upload_time": "2025-07-26T17:18:12",
            "upload_time_iso_8601": "2025-07-26T17:18:12.632026Z",
            "url": "https://files.pythonhosted.org/packages/02/0d/93b19729f8a8922cbff2fa1395bc6c4edd6be65cf9cb84dcf170a9ca786a/zignode-25.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a23681828cde604e62da821d6da52143c79d57dbf5d82d4dda3f4265e38f4e60",
                "md5": "b5e2d57180efd50cc5228902eff817d2",
                "sha256": "fb9291588318ae355f52715551fd8e1c31806e28244e5439acb915153e159110"
            },
            "downloads": -1,
            "filename": "zignode-25.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b5e2d57180efd50cc5228902eff817d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 21985,
            "upload_time": "2025-07-26T17:18:13",
            "upload_time_iso_8601": "2025-07-26T17:18:13.638852Z",
            "url": "https://files.pythonhosted.org/packages/a2/36/81828cde604e62da821d6da52143c79d57dbf5d82d4dda3f4265e38f4e60/zignode-25.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-26 17:18:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zigfi7",
    "github_project": "zignode",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "zignode"
}
        
Elapsed time: 0.44613s