A site-package to create your local pypi-sitepackage, manage your own scripts pack as an env!
Project description
CFGC 构建自己本地的 PYPI
快速构建项目的自定义python运行环境
当我们进行某些任务时,他们可能有多种类似的脚本,输出类似的内容,比如一些pipeline。
这时候任务脚本间可能存在大量的重复函数/变量,而这些函数并非pypi提供的,可能是我们自己定义的
如果对这些内容在各个脚本间重复定义则太不灵活,而CFGC(config-center)库则是为此而生!
如:
- 测评一系列类似的方法 (测评、数据加载函数很大概率是一种)
- 多流程分支分析 (数据读取、某些变量如输出路径)
- 日常使用 (如获取时间间隔的API、机器学习常用的数据拆分策略)
- ...更多可能
Install
pip install config-center
Usage
# region |- Import -|
import cfgc
import datetime
import os
# endregion
# list all envs
cfgc.envs.view()
# region |- Create an Env -|
env = cfgc.center.Environment()
env.define(
"cfgc-base", # env name: test
{"date": datetime.datetime.now().strftime('%Y-%m-%d')}, # env domain(data): test
os.path.join(cfgc.center.PATH.center) # env engine(site-package): cfgc self
)
env.save(safe=True)
# Input: yes
# endregion
del env
# region |- Reload the Env -|
from pprint import pprint
load_env = cfgc.center.Environment(load="cfgc-base") # env name: test
pprint(dir(load_env.engine))
# endregion
# region |- Export the Env -|
load_env.export("../export")
del load_env
# reload
load_env = cfgc.center.Environment()
load_env.load_path("../export") # env name: export
pprint(dir(load_env.engine.center))
print(load_env.domain)
# endregion
CFGC实现非常简单,仅仅是使用了部分路径定义、模块加载的知识即可完成
而它可以保证让你在本地构建一些简单的python包,而无需上传pypi下载,来达到随心import
- 完全不要再为相对路径、绝对路径的导入发愁
- 数据目录 与 函数目录分离, 无论项目的路径怎么变化, CFGC都可以定位到你本地的函数库
- 简单的客制化
欢迎使用体验CFGC!
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 Distribution
Built Distribution
Close
Hashes for config_center-0.0.40.post2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10779e56019d5e570d247ab5c160501f0acf1d30ec79d1d11399e46755d13d08 |
|
MD5 | 02df297bbb8bc5155d372852191a1706 |
|
BLAKE2b-256 | 91fe404390578d4009925464a7311d1e72a129f585909ead2793caf4ca27f4e8 |
Close
Hashes for config_center-0.0.40.post2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21735095035222b74c040722590497f3621406118cedb12694931ba331b6331f |
|
MD5 | 6915b22aab991c2590e48c5957605a7e |
|
BLAKE2b-256 | e6f1735bac0072770d5e7d1a3f5aeaaec86ab8b2e77cd4ebbbe6848f981d8eb9 |