/commune

Commune Repo

Primary LanguagePython

Commune AI

License: MIT Discord Chat Website Uptime Twitter Follow

An Open Modules Network

Commune is a protocol that aims to connect all developer tools into one network, fostering a more shareable, reusable, and open economy. It follows an inclusive design philosophy that is based on being maximally unopinionated. This means that developers can leverage Commune as a versatile set of tools alongside their existing projects and have the freedom to incorporate additional tools they find valuable.

By embracing an unopinionated approach, Commune acknowledges the diverse needs and preferences of developers. It provides a flexible framework that allows developers to integrate specific tools seamlessly while avoiding imposing rigid structures or constraints. This adaptability enables developers to leverage Commune's capabilities in a manner that best aligns with their individual projects and workflows.

The overarching goal of Commune is to create a collaborative ecosystem where developers can easily share, connect, and extend their tools, ultimately fostering innovation and efficiency within the development community. By providing a network that encourages openness and accessibility, Commune empowers developers to leverage the collective knowledge and resources of the community to enhance their own projects.

Install

Setting Up With setup.py

Install setuptools: If you haven't already installed setuptools, you can do so using pip:

pip install -r requirements; pip install -e .

or

./start.sh

Setting Up Commune With Docker

Install Docker: If you don't have Docker installed on your system, download and install it from the official Docker website: https://www.docker.com/get-started.

Clone the Commune Repository: Open your terminal or command prompt and clone the Commune repository from GitHub:

make up 

or

docker-compose build

Start Commune: Once the Docker container is built, start Commune by running the following command:

make start

or

docker-compose up -d # -d for detached mode

To enter the docker container do, and do the following

make enter

or

docker exec -it commune bash

Then run the following command to sync the network

c ls

To exit the container

exit

Sync Commune with the Network: Inside the Docker container, run the following command to sync Commune with the network:

c sync

Congratulations! Commune is now set up and running inside a Docker container. Congratulations! Commune is now set up and running without Docker

Note:

This repo is on the cutting edge of experimentation, so there may be some hiccups along the way. If you're primarily interested in using the core features of the protocol (such as intuitive cli) or seeking a more lightweight implementation, consider installing the Communex package.

Key Features

Module Filesystem

The module.py file serves as an anchor, organizing future modules in what we call a module filesystem. For example, you can store a dataset module in {PWD}/dataset/text, which will have a path of dataset.text. The current limitation is to have a config where the name of the config is that of the Python object.

Subspace

Example

Subspace is a blockchain that Commune uses for several purposes:

  • DNS for Python: Decentralized Name Service for deployed objects.
  • Evaluating Performance through Voting: Stake-weighted voting system for users to evaluate each other instead of self-reported networks. This provides users with

Register On The Chain

To register a module, do the following

c register {module_path} name={module_name (OPTIONAL)}

The module path is specified

Yo, listen up! I'm about to drop some updated knowledge on how to create a dope module and register it on the blockchain. Here's the revised step-by-step guide:

  1. Create Your Module: Start by creating your own module in Python. It can be anything you want - a model, a service, or some sick functionality. Make sure your module is ready to rock and roll.

  2. Import Commune: Import the Commune library into your Python code. You'll need it to create and register your module.

import commune as c
  1. Define Your Module Class: Create a class that represents your module. Make sure it inherits from c.Module.
class MyDopeModule(c.Module):
    def __init__(self):
        super().__init__()
        # Your module initialization code goes here

    def some_cool_function(self):
        # Your module's cool functionality goes here
        return "I'm bringing the heat!"
  1. Register Your Module: Now it's time to register your module on the blockchain. You have the option to specify a custom name and tag for your module. If you don't provide a custom name, the module will default to the module path. The tag is optional and can be used for versioning or categorization purposes.

To register your module with a custom name and tag, run the following command:

c register my_module_path name=my_module tag=1

Replace my_module_path with the actual path to your module file (without the class name), my_module with the desired name for your module, and 1 with the desired tag. This will register your module on the blockchain with the specified name and tag.

If you prefer to use the default module path as the name, simply omit the name parameter:

c register my_module_path tag=1

Developement FAQ

  • Where can i find futher documentation? This repository folder, Doc.
  • Can I install on Windows? Yes, Guide.
  • Can I contribute? Absolutely! We are open to all contributions. Please feel free to submit a pull request.