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 upload [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 upload ./local-model.zip -c config.json
# 上传到指定存储桶
mectl upload ./local-model.zip -b another-bucket -c config.json
上传时需要设置以下环境变量:
export SP_USER_ID=your-user-id
export SP_HOST=your-host-url
上传完成后,工具会提示输入模型名称和描述,然后自动创建模型记录。
开发
本地运行
# 克隆项目
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.1.tar.gz
(4.9 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.1-py3-none-any.whl
(6.0 kB
view details)
File details
Details for the file mectl-0.1.1.tar.gz.
File metadata
- Download URL: mectl-0.1.1.tar.gz
- Upload date:
- Size: 4.9 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 |
186f5441cfcad7cb7b1a8e8b5ece432452e7f839c74ebe9605bb0604a5da455f
|
|
| MD5 |
0aeea772d5484b5b39db77f70c13189c
|
|
| BLAKE2b-256 |
3cebc8fc2859917b318ab1a70f45ea857f52b2f4db012272b5614a35cf8c0ec9
|
File details
Details for the file mectl-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mectl-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.0 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 |
cb155e94be2a520d4c61433b5f2f4906ccbc7ef3cf71f94d702dc88c71c0619a
|
|
| MD5 |
85c058d292ee6c201b88008316d2c5b9
|
|
| BLAKE2b-256 |
ff621ac2a4fd630d13640b0cb8542ebfd1ed97f8a97ad14af0e1d8c9c1dbe0f1
|