mini-init


Namemini-init JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/xiaohuohumax/mini-init
Summary简单辅助工具集合: 日志, 配置文件, 环境变量等
upload_time2023-10-30 12:43:24
maintainer
docs_urlNone
authorxiaohuohumax
requires_python>=3.8
licenseMIT
keywords mini-init init tools project-init logging env config
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mini-init

简单辅助工具集合: 日志, 配置文件, 环境变量等

加载依赖
------

```shell
pip install mini-init
```

读取环境变量
----------

```ini
# .env
PROJECT_NAME=mini-init
...
```

```python
from dataclasses import dataclass
from miniinit import env

@dataclass
class Env:
    # 环境变量
    PROJECT_NAME: str = ''
    ...

env_data = env.get_env(Env)
# 更换路径
# env_data = env.get_env(Env, '**/.env')

print(env_data.PROJECT_NAME)
# mini-init
```

读取项目配置
----------

```yaml
# 默认, 不可修改
# config/application.yaml
app:
  name: mini-init
  version: 0.0.1

log:
  is_use: true
  yaml_path: config/log.yaml

banner:
  is_show: true
  file_path: banner.txt
  welcome: welcome use mini-init (v0.0.1)

# 其他参数自行扩展
...
```

```python
from dataclasses import dataclass
from miniinit import config

@dataclass
class Config(config.Config):
    # 自定参数, 也可覆盖
    ...

config_data = config.get_config(Config)

print(config_data.app.name)
# mini-init
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xiaohuohumax/mini-init",
    "name": "mini-init",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "mini-init,init,tools,project-init,logging,env,config",
    "author": "xiaohuohumax",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/58/e0/2672f5b27e71c56aa77ac1864ee505276e7345dcb7c477b3f695e8b364f2/mini-init-0.0.1.tar.gz",
    "platform": null,
    "description": "# mini-init\n\n\u7b80\u5355\u8f85\u52a9\u5de5\u5177\u96c6\u5408: \u65e5\u5fd7, \u914d\u7f6e\u6587\u4ef6, \u73af\u5883\u53d8\u91cf\u7b49\n\n\u52a0\u8f7d\u4f9d\u8d56\n------\n\n```shell\npip install mini-init\n```\n\n\u8bfb\u53d6\u73af\u5883\u53d8\u91cf\n----------\n\n```ini\n# .env\nPROJECT_NAME=mini-init\n...\n```\n\n```python\nfrom dataclasses import dataclass\nfrom miniinit import env\n\n@dataclass\nclass Env:\n    # \u73af\u5883\u53d8\u91cf\n    PROJECT_NAME: str = ''\n    ...\n\nenv_data = env.get_env(Env)\n# \u66f4\u6362\u8def\u5f84\n# env_data = env.get_env(Env, '**/.env')\n\nprint(env_data.PROJECT_NAME)\n# mini-init\n```\n\n\u8bfb\u53d6\u9879\u76ee\u914d\u7f6e\n----------\n\n```yaml\n# \u9ed8\u8ba4, \u4e0d\u53ef\u4fee\u6539\n# config/application.yaml\napp:\n  name: mini-init\n  version: 0.0.1\n\nlog:\n  is_use: true\n  yaml_path: config/log.yaml\n\nbanner:\n  is_show: true\n  file_path: banner.txt\n  welcome: welcome use mini-init (v0.0.1)\n\n# \u5176\u4ed6\u53c2\u6570\u81ea\u884c\u6269\u5c55\n...\n```\n\n```python\nfrom dataclasses import dataclass\nfrom miniinit import config\n\n@dataclass\nclass Config(config.Config):\n    # \u81ea\u5b9a\u53c2\u6570, \u4e5f\u53ef\u8986\u76d6\n    ...\n\nconfig_data = config.get_config(Config)\n\nprint(config_data.app.name)\n# mini-init\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\u7b80\u5355\u8f85\u52a9\u5de5\u5177\u96c6\u5408: \u65e5\u5fd7, \u914d\u7f6e\u6587\u4ef6, \u73af\u5883\u53d8\u91cf\u7b49",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/xiaohuohumax/mini-init"
    },
    "split_keywords": [
        "mini-init",
        "init",
        "tools",
        "project-init",
        "logging",
        "env",
        "config"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d579a43b6434d1b6edca767f6f13019fbf0f399bbb223e824d0693259ba6c137",
                "md5": "d437f9871316b28b84529a72f12519b1",
                "sha256": "76c39023be546b71cde6fdf0967d3bfc3f674d4bc44649072bd2dd4522606da6"
            },
            "downloads": -1,
            "filename": "mini_init-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d437f9871316b28b84529a72f12519b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4765,
            "upload_time": "2023-10-30T12:43:23",
            "upload_time_iso_8601": "2023-10-30T12:43:23.155494Z",
            "url": "https://files.pythonhosted.org/packages/d5/79/a43b6434d1b6edca767f6f13019fbf0f399bbb223e824d0693259ba6c137/mini_init-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58e02672f5b27e71c56aa77ac1864ee505276e7345dcb7c477b3f695e8b364f2",
                "md5": "d8f84fb35ec42339482e24567c9b80ed",
                "sha256": "6065e56fcd58d11bcc30068d2a54c53dbd7c68da155e14a273a42f0fd166f9b9"
            },
            "downloads": -1,
            "filename": "mini-init-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d8f84fb35ec42339482e24567c9b80ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4231,
            "upload_time": "2023-10-30T12:43:24",
            "upload_time_iso_8601": "2023-10-30T12:43:24.550945Z",
            "url": "https://files.pythonhosted.org/packages/58/e0/2672f5b27e71c56aa77ac1864ee505276e7345dcb7c477b3f695e8b364f2/mini-init-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 12:43:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xiaohuohumax",
    "github_project": "mini-init",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "mini-init"
}
        
Elapsed time: 0.13957s