Metadata-Version: 2.4
Name: koi-net
Version: 2.1.0b2
Summary: Implementation of KOI-net framework in Python
Author-email: Luke Miller <luke@block.science>, Joshua Jodesty <joshua@block.science>
Maintainer-email: Luke Miller <luke@block.science>
License: MIT License
        
        Copyright (c) 2025 BlockScience
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/BlockScience/koi-net/
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rid-lib>=3.2.7
Requires-Dist: networkx>=3.4.2
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.10.6
Requires-Dist: ruamel.yaml>=0.18.10
Requires-Dist: cryptography>=45.0.3
Requires-Dist: fastapi>=0.115.12
Requires-Dist: uvicorn>=0.34.2
Requires-Dist: rich>=14.1.0
Requires-Dist: structlog>=25.4.0
Requires-Dist: pydantic-settings>=2.12.0
Requires-Dist: jsonpointer>=3.0.0
Requires-Dist: colorama>=0.4.6
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-autoapi>=3.6.0; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=3.0.1; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=3.0.2; extra == "docs"
Dynamic: license-file

# KOI-net

[![PyPI](https://img.shields.io/pypi/v/koi-net)](https://pypi.org/project/koi-net/)
[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://blockscience.github.io/koi-net/index.html)

*This protocol and framework are the result of several iterations of KOI research, [read more here](https://github.com/BlockScience/koi).*

KOI-net (Knowledge Organization Infrastructure Network) can be understood as both a network protocol for distributed knowledge processing, and as a Python framework for building nodes, networks, and applications on top of that protocol. This repo is the implementation of that framework.

For information about the KOI-net protocol, see the [official specification](https://blockscience.github.io/koi-net-spec). 
# Quick Start
## Installation

(Optionally) create and activate a virtual environment, and install KOI-net:

```shell
$ pip install koi-net
```

## Create a Simple Partial Node

The KOI-net framework is built around the [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) pattern. Node classes are *containers* for interdependent *components* implementing internal subsystems. Each node inherits from a base partial or full node class, which comes with ~36 default components. At a minimum, each node needs to implement a config component:

```python
from koi_net.config import PartialNodeConfig, KoiNetConfig, PartialNodeProfile  

class MyPartialNodeConfig(PartialNodeConfig):
	koi_net: KoiNetConfig = KoiNetConfig(
		node_name="partial",
		node_profile=PartialNodeProfile()
	)
```

Which is set in the node container:

```python
from koi_net.core import PartialNode

class MyPartialNode(PartialNode):
	config_schema = MyPartialNodeConfig
```

Finally, the main method can be set to build and run the node:

```python
if __name__ == "__main__":
	MyPartialNode().run()
```

See `examples/coordinator.py` for a more complex example node, or see [the docs](https://blockscience.github.io/koi-net) for more information on the KOI-net framework.

This framework depends on [rid-lib](https://github.com/BlockScience/rid-lib), the Python implementation of the RID protocol.
