minicore
minicore是定势能源数据组件ncore的简化版。
用法
配置
环境变量
MINICORE_CONFIG_FILE="" # 可选
config相关
配置类型目前可选用file,此时使用一个Python文件来提供配置参数。配置文件的查找顺序为:
$MINICORE_CONFIG_FILE(如提供该环境变量)./minicore_config.py$HOME/.minicore/minicore_config.py
配置文件示例可见examples/minicore_config.py, 详解见下文。
核心枢纽:NCore单例对象
from minicore import NCore
nc = NCore()
minicore系统的核心枢纽类型NCore是一个单例类型,也就是在一个程序中无论写多少次初始化过程NCore(),返回的都是同一个对象,实质的初始化过程也只在第一次过程中发生,不会造成额外开销。所以通过上面的方式, 可以在任何需要用到它的地方来现场生成该对象。
如果没有提供正确的配置文件,会抛出MiniCoreBadConfig异常。
获取数据类型(DataType)
nc.ls_types() # 打印出可用的数据类型
SomeType = nc.get_type(TYPE_NAME)
生成Data对象,并获取数据结果
data = SomeType(**para)
result = data.result
快捷方式
from minicore import D
data = D(type_name, **para)
result = data.result
配置文件详解
配置文件示例可见examples/minicore_config.py
SOURCE 数据源
SOURCE配置项是一个列表,可以包含一或多个数据源。
SOURCE = [
{
"name": "SourceName", # 数据源名称
"base_url": "http://some.com/ncore/", # 数据服务基础url路径
"auth": {
"type": "token",
"token": "SomeToken",
}, # 身份认证参数
}
]
其中,身份认证参数目前支持以下形式:
auth type="token"
{
"type": "token",
"token": "SomeToken"
}
TMP_DIR 临时文件目录
MiniCore临时文件目录的根路径
Metadata
Release files for minicore 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| minicore-0.1.2.tar.gz | 10.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| minicore-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.1 kB
Release files / minicore-0.1.2.tar.gz
| Download URL | minicore-0.1.2.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2138f7aed9248f13a5044944eb88609010932bbb66d5ed936f23f437f6a19868
|
|
BLAKE2b-256 checksum How to use checksums |
d1c139fe1ef9035a4d5e62f6dc46bc05548177e429f0329875900f769b278e45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / minicore-0.1.2-py3-none-any.whl
| Download URL | minicore-0.1.2-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6ae012df7b2afc4fdc7e0b098a7ff7f644a9fee92a269d4ce49079594f4c50b
|
|
BLAKE2b-256 checksum How to use checksums |
902217f9831608ccd3292aa26f56b85c029659db7b68d07bb99cc6932080d7ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for minicore 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.