Skip to main content

google spreadsheet as config file

Project description

Python package PyPi version Code style: black


spreadsheet as config

how to use it

Get config object from spreadsheet something like below.

import sys
import typing_extensions as tx
import sheetconf
from sheetconf.usepydantic import Parser
from pydantic import BaseModel, Field

class XXXConfig(BaseModel):
    name: str
    token: str

class YYYConfig(BaseModel):
    name: str = Field(default="yyy", description="name of yyy")
    token: str = Field(description="token of yyy")

class LoggerConfig(BaseModel):
    level: tx.Literal["DEBUG","INFO", "WARNING", "ERROR"]

class Config(BaseModel):
    xxx: XXXConfig
    yyy: YYYConfig
    logger: LoggerConfig

url = ""
config = sheetconf.loadfile(url, config=Config, format="spreadsheet", adjust=True)

# Config(logger=LoggerConfig(level='INFO'), xxx=XXXConfig(name='xxx', token='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'), yyy=YYYConfig(name='yyy', token='yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'))


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sheetconf, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size sheetconf-0.0.1-py3-none-any.whl (10.0 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page