Skip to main content

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

Project description

mini-init

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

加载依赖

pip install mini-init

读取环境变量

# .env
PROJECT_NAME=mini-init
...
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

读取项目配置

# 默认, 不可修改
# 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)

# 其他参数自行扩展
...
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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mini-init-0.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

mini_init-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file mini-init-0.0.1.tar.gz.

File metadata

  • Download URL: mini-init-0.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for mini-init-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6065e56fcd58d11bcc30068d2a54c53dbd7c68da155e14a273a42f0fd166f9b9
MD5 d8f84fb35ec42339482e24567c9b80ed
BLAKE2b-256 58e02672f5b27e71c56aa77ac1864ee505276e7345dcb7c477b3f695e8b364f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mini_init-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for mini_init-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76c39023be546b71cde6fdf0967d3bfc3f674d4bc44649072bd2dd4522606da6
MD5 d437f9871316b28b84529a72f12519b1
BLAKE2b-256 d579a43b6434d1b6edca767f6f13019fbf0f399bbb223e824d0693259ba6c137

See more details on using hashes here.

Supported by

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