Skip to content

Create python API #4

@VigneshVSV

Description

@VigneshVSV

Is your feature request related to a problem? Please describe.
A python API which uses the same backend would be a very useful addition.

Describe the solution you'd like
A support for the following functions would be useful:

import corev

# init
corev.init("http://localhost:3000", use_ssl=False) # allow toggle SSL and trust non recognised certificates
corev.list() # corev list

# retrieve a project
project = corev.pull("<project name>")
config = project.version("<version value>") or project.latest()  
# project.version("<version value>", latest_if_absent=True)

# Apps use the config values or anywhere within the python app
values = config.properties # or config.values whichever makes sense

# if somebody wants the schema
schema = config.schema # hopefully makes sense, just the schema under the "config" field

# to update
new_config = corev.Config("<version value>")
project.push(new_config)

# or 
project.push(existing_config_variable, "<version value>")
# when updating config variable in place without updating remote

A usage example would be as follows:

import corev

class Camera:
  
    frame_rate = property()
    fps = property()
    pixel_clock = property()

    def __init__(self):
        config = corev.project("camera").latest()
        for name, value in config.properties:
            setattr(self, name, value)

Its actually sort of not clear how to update the configuration once the property is set:

class property:

     def _post_value_set(self, value):
         config.properties[self.name] = value     
         project.push(config, "<next version name>")        

This actually needs to be discussed further. The issue is not complete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions