FOR MORE INFO, GO TO DOCS FOR MORE INFORMATION
Introduction to Commune
Commune is an open-source project that aims to create a network for connecting various developer tools. It's designed to be flexible and unopinionated, allowing developers to use it alongside their existing projects.
Key Features:
- Module Filesystem
- Subspace blockchain integration
- Flexible key management
- Pythonic CLI
A module is a class. The name of the module can be determined by the filepath with respect to the current working directory (c.pwd()/c pwd).
make a class in a file
c new_module agi
Example (agi.py):
class Agi(c.Module):
def __init__(self, a=1, b=2):
self.set_config(locals())
def generate(self, x:int = 1, y:int = 2) -> int:
c.print(self.config)
c.print(self.config, 'This is the config, it is a Munch object')
return x + y
forward = generate
You can call this module using: Input
c example/predict 10 # c {module}/{method} *args **kwargs
Result
⚡️⚡️⚡️⚡️predict⚡️⚡️⚡️⚡️
✅Result(0.001s)✅
11
When you create a module, commune will see if the key name exists, and if it doesnt, it will generate a new one randomly. Dont worry, its not encrypted by default.
Commune uses sr25519 keys for signing, encryption, and verification.
To add a new key:
c add_key alice
c key alice
<Key(address=5CmA5vVC9s8uXE8htaigNicNokSouwLsSPPWMN3Z3V8uNEWw, path=alice, crypto_type=sr25519)>
To list keys:
c keys alice
[alice]
To sign a message:
key = c.get_key("alice")
signature = key.sign("hello world")
To serve a module:
c serve model.openai
To call a served module:
c.call("model.openai/forward", "sup")
To run tests:
pytest tests
Page 9: Contributing
Contributions to Commune are welcome. Please submit pull requests on the GitHub repository.
Page 10: License
Commune is licensed under MIT, but with a "Do What You Want" philosophy. The project encourages open-source usage without strict legal restrictions.
This documentation provides a high-level overview of Commune. For more detailed information on specific features, please refer to the individual module documentation or the project's GitHub repository.