README.md
mectl
mectl 是一个命令行工具,用于辅助mindedge的模型开发,例如从 MinIO 服务器下载文件。
功能特性
- 通过命令行从 MinIO 服务器下载文件
- 支持通过配置文件或环境变量设置连接参数
- 灵活的输出路径配置
- 支持指定存储桶名称
- 自动从文件路径提取文件名
- 自动检测并解压ZIP文件
- 上传文件到 MinIO,并选择「创建新模型」或「为已有模型添加版本」以创建/更新模型记录
安装
# 使用 pip 安装
pip install mectl
使用方法
基本用法
mectl get [OPTIONS] FILE_KEY
上传文件
mectl put [OPTIONS] FILE_PATH
参数说明
下载参数
FILE_KEY: MinIO 对象路径,格式:bucket_name/object_key-o, --output: 本地保存路径(默认为从 FILE_KEY 提取的文件名)-c, --config: 配置文件路径(JSON,含 oss.accessKey 等)-b, --bucket: MinIO 存储桶名称(默认为suanpan)
上传参数
FILE_PATH: 本地文件路径-c, --config: 配置文件路径(JSON,含 oss.accessKey 等)-b, --bucket: MinIO 存储桶名称(默认为suanpan)
配置
工具需要通过配置文件或环境变量提供 MinIO 连接信息。
配置文件示例 (config.json)
{
"oss": {
"internalEndpoint": "your-minio-server.com:9000",
"accessKey": "your-access-key",
"accessSecret": "your-access-secret"
}
}
环境变量方式
export NODE_CONFIG='{"oss":{"internalEndpoint":"your-minio-server.com:9000","accessKey":"your-access-key","accessSecret":"your-access-secret"}}'
mectl get bucket-name/file-path
使用示例
下载文件示例
# 使用配置文件下载文件
mectl get my-file.txt -c config.json -o ./local-file.txt
# 使用环境变量下载文件(自动提取文件名)
mectl get studio/100029/models/MindEdge.zip -c config.json
# 指定特定存储桶
mectl get my-file.txt -b another-bucket -c config.json
上传文件示例
# 上传文件到 MinIO 并创建/更新模型记录
mectl put ./local-model.zip -c config.json
# 上传到指定存储桶
mectl put ./local-model.zip -b another-bucket -c config.json
上传前需设置以下环境变量:
export SP_USER_ID=your-user-id # 用于生成 OSS 对象路径
export SP_API_HOST=your-api-host # 模型 API 地址(如 127.0.0.1:8080),用于拉取模型列表、校验版本、创建记录
上传到 OSS 成功后,工具会询问:
- 创建新模型:输入模型名称,即可创建新模型并关联当前文件。
- 为已有模型添加版本:先拉取已有模型列表并选择模型,再输入新版本号(会先校验版本是否可用),可选输入版本描述,然后为该模型添加新版本并关联当前文件。
开发
本地运行
# 克隆项目
git clone <repository-url>
# 安装依赖
cd mectl
pip install -e .
发布到 PyPI
要发布新版本到 PyPI,请执行以下步骤:
- 更新 pyproject.toml 中的版本号
- 运行测试确保一切正常
- 使用发布脚本发布:
# 运行发布脚本
./release.sh
发布脚本将:
- 检查环境和依赖
- 构建包
- 询问发布目标(测试PyPI或正式PyPI)
- 执行发布
依赖
- Python >= 3.10
- minio >= 7.0.0
Metadata
Release files for mectl 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 | Actions |
|---|---|---|---|---|
| mectl-0.1.2.tar.gz | 6.2 kB | Without provenance | Details for mectl-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mectl-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mectl-0.1.2-py3-none-any.whl |
Total release size: 13.7 kB
Release files / mectl-0.1.2.tar.gz
| Download URL | mectl-0.1.2.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e1a6084c9730078c5e20c9babafada0822bfbe63f87015d7520f0387bce0841
|
|
BLAKE2b-256 checksum How to use checksums |
a7877d76918b287e497b000a8c7edfed26b6175fa816698f2c297c989a67da4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.10.15 Linux/5.15.167.4-microsoft-standard-WSL2
|
Release files / mectl-0.1.2-py3-none-any.whl
| Download URL | mectl-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a200ac3be13ef2eba593059502b3feb7eeb3cd97559fb70d003c7228baacae9a
|
|
BLAKE2b-256 checksum How to use checksums |
3e2940be247f0cdb77878d1243d285cfa95704340b3c5364aa1d2b4cfb1a6fc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.10.15 Linux/5.15.167.4-microsoft-standard-WSL2
|
Security for mectl 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.