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
Release history Release notifications | RSS feed
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
File details
Details for the file gxconfig-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: gxconfig-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23595893839e257cad7e81f2c46d21d793036f924d0d60f8c9e274dccc6eb7f3 |
|
MD5 | 690d82d091ddc6bdbd5f45c91bebfea9 |
|
BLAKE2b-256 | be31082fe1238ca979a052e8c0d8891a0b8daa53249f296f0a8ca66978d23eb6 |