Skip to content

v0.0.1

Compare
Choose a tag to compare
@ncdhz ncdhz released this 06 Sep 14:28
· 22 commits to main since this release

no_config

致力于更简单的配置。

快速开始

  1. 配置文件

    # 创建配置文件start.yaml
    user:
        username: ncdhz
        password: ncdhz
  2. 源码文件

    from os import path
    from no_config import Config
    
    # 配置注入
    @Config
    class User:
        password = None
        username = None
    
    if __name__ == '__main__':
        # 配置初始化
        # 全局只需一次初始化
        # 在更改配置之后可以通过此函数刷新配置
        Config.init(path.join(path.dirname(__file__), 'start.yaml'))
        print(User.password)
        print(User.username)

官方文档

https://ncdhz.github.io/no_config