Skip to main content

The PyParse CLI

We have a pythonic cli for commune, which is a wrapper around the c.Module library. This is a simple way to interact with the commune library. This does not need to be formated like argparse, and is more like a pythonic cli, where you can test out the functions and modules.

The template for the cli is as follows:

c {module_name} {function_name} *args **kwargs

For example, the following command:

import commune as c
c.modules("model")

is the same as

c modules model

Using the cli to interact with your modules​

You can use the cli to interact with your modules. For example, if you have a module called demo, you can use the cli to interact with it.

For instance, to get the config of the model.openai module, you can use the following command:

c model.openai config

This is the same as the following python code:

import commune as c
c.module("model.openai").config()

Serving​

You can also serve your modules using the cli. For example, if you have a module called demo, you can serve it using the following command:

c demo serve tag=latest

This is the same as the following python code:

import commune as c
c.module("demo").serve(tag="latest")

Why did we make this instead of using Argparse?​

Argparse is a great library, but it is not very pythonic, and it is not very easy to use. You also have to write a lot of boilerplate code to get it to work, which is not very fun.

Our New Pyparse It is a simple way to interact with the commune library. This does not need to be formated like argparse, and is more like a pythonic cli, where you can test out the functions and modules.