A command line tool for downloading files from MinIO
Project description
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
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
mectl-0.1.2.tar.gz
(6.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mectl-0.1.2-py3-none-any.whl
(7.4 kB
view details)
File details
Details for the file mectl-0.1.2.tar.gz.
File metadata
- Download URL: mectl-0.1.2.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.15 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e1a6084c9730078c5e20c9babafada0822bfbe63f87015d7520f0387bce0841
|
|
| MD5 |
b202b9516b28b1b9f3ea1bbfeedb33b9
|
|
| BLAKE2b-256 |
a7877d76918b287e497b000a8c7edfed26b6175fa816698f2c297c989a67da4b
|
File details
Details for the file mectl-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mectl-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.15 Linux/5.15.167.4-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a200ac3be13ef2eba593059502b3feb7eeb3cd97559fb70d003c7228baacae9a
|
|
| MD5 |
ef12db3232c3dd0f6e7e0b84e720288c
|
|
| BLAKE2b-256 |
3e2940be247f0cdb77878d1243d285cfa95704340b3c5364aa1d2b4cfb1a6fc4
|