Skip to main content

基于OpenMind的模型文件上传下载CLI工具

Project description

GitCode CLI

基于OpenMind SDK的GitCode平台模型文件上传下载CLI工具

简介

GitCode CLI 是一个命令行工具,用于与GitCode平台交互,支持模型和数据集的上传、下载等操作。工具基于OpenMind Hub SDK开发,并配置为连接GitCode API端点。

功能特性

  • 🔐 用户认证和登录管理
  • 📁 支持模型和数据集仓库创建
  • ⬆️ 文件和目录批量上传
  • ⬇️ 仓库内容下载
  • 🎨 彩色终端输出
  • 📊 上传下载进度显示
  • 🔧 配置文件管理

安装

从源码安装

git clone https://gitcode.com/gitcode-ai/gitcode_cli.git
cd gitcode
pip install -e .

使用pip安装(如果已发布)

pip install gitcode

使用方法

1. 登录

首先需要登录到GitCode平台:

gitcode login

系统会提示输入访问令牌(从GitCode平台获取)。

2. 上传文件

上传模型

gitcode upload ./your-model-dir --repo-id your-username/your-model-name

上传数据集

gitcode upload ./your-dataset-dir --repo-id your-username/your-dataset-name

上传单个文件

gitcode upload ./model.bin --repo-id your-username/your-model-name

3. 下载文件

下载到当前目录

gitcode download your-username/your-model-name

下载到指定目录

gitcode download your-username/your-model-name -d ./models/

4. 其他命令

查看当前登录用户

gitcode whoami

退出登录

gitcode logout

显示配置信息

gitcode config-show

配置文件

配置文件保存在 ~/.gitcode/config.json,包含用户认证信息和其他设置。

API端点配置

工具已预配置为连接GitCode平台API端点:

  • API端点https://api.gitcode.com
  • 环境变量OPENMIND_HUB_ENDPOINT=https://api.gitcode.com

此配置在程序启动时自动设置,用户无需手动配置。

错误处理

  • 如果遇到网络错误,工具会自动重试
  • 上传大文件时会显示进度条
  • 所有操作都有详细的错误信息提示

支持的文件类型

  • 支持所有文件类型的上传和下载
  • 自动处理目录结构
  • 支持大文件传输

开发

项目结构

gitcode/
├── __init__.py          # 包初始化
├── __main__.py          # 主入口
├── cli.py               # CLI命令定义
├── api.py               # OpenMind API客户端
├── config.py            # 配置管理
├── utils.py             # 工具函数
├── requirements.txt     # 依赖包
├── setup.py             # 包安装配置
└── README.md           # 说明文档

本地开发

# 克隆项目
git clone https://gitcode.com/gitcode-ai/gitcode_cli.git
cd gitcode

# 安装依赖
pip install -r requirements.txt

# 开发模式安装
pip install -e .

# 运行测试
python -m pytest tests/

许可证

MIT License

贡献

欢迎提交Issue和Pull Request!

联系我们

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitcode-1.1.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitcode-1.1.2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file gitcode-1.1.2.tar.gz.

File metadata

  • Download URL: gitcode-1.1.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for gitcode-1.1.2.tar.gz
Algorithm Hash digest
SHA256 95fee2ee734c74c7687f0c8d4c237b1031389acaceadb02dedb0e64da96a115e
MD5 097bae7ced3ee85fdb41f6d272a4b6fd
BLAKE2b-256 5a9b76fcd91676bdad08f2afa34ea3840a9e5a5fef2bc64398e9382ae8d073b5

See more details on using hashes here.

File details

Details for the file gitcode-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: gitcode-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for gitcode-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce09372fa32188ec8cbb146dc0434831c3947c45e7958d14f280d89f741f76f2
MD5 9f782fcb74f232de9724de8d2a9bea7d
BLAKE2b-256 1f96cfe8222edeed88d3188b8742e84246fe94c781a868defffe5a34383cdea6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page