Skip to main content

A Global config tools created by gawainx

Project description

config tool

A tool help you to create config and load in an easy way

Usage

Define and Writing Config to toml

In Python Code

from typing import NamedTuple
import gxconfig

class DataConfig(NamedTuple):
    root:str = "/home/gawainx/data"
    chkp:str = "chkp"

class ModelConfig(NamedTuple):
    embd_dim:int = 768
    hidden_dim:int = 5

class Config(NamedTuple):
    dataConfig:DataConfig = DataConfig()
    modelConfig:ModelConfig = ModelConfig()

cfg = Config()
gxconfig.save_toml(cfg, "config.toml")

Then you can get a toml

[DataConfig]
root = "/home/gawainx/data"
chkp = "chkp"

[ModelConfig]
embd_dim = 768
hidden_dim = 5

Load from Toml

import gxconfig
from typing import NamedTuple
class DataConfig(NamedTuple):
    root:str = "/home/gawainx/data"
    chkp:str = "chkp"

class ModelConfig(NamedTuple):
    embd_dim:int = 768
    hidden_dim:int = 5

class Config(NamedTuple):
    dataConfig:DataConfig = DataConfig()
    modelConfig:ModelConfig = ModelConfig()

cfg = gxconfig.load_toml("config.toml", Config)

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

gxconfig-0.0.1-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file gxconfig-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gxconfig-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for gxconfig-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ec77108a0ee2bf63e16fbcb26cb3345a2acf7ac36e72f01e0504f2b8e1d70d4
MD5 e55abe41ce05c51065e8bad951471b38
BLAKE2b-256 0459405e5209eded793b56ee6faf804d49b2a863ebfa4018e3e56ce20eb439f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page