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.

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

sheetconf-0.0.1-py3-none-any.whl (10.0 kB view hashes)

Uploaded py3

Supported by

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