Skip to main content

gp_hub

gp_hub 是一个本地优先的极简包管理系统 MVP,目标是提供类似 pip/npm/cargo 的基础体验。

当前包含六个核心能力:

  • build: 构建项目产物(tar.gz)
  • publish: 发布到本地仓库或 HTTP 云仓库
  • install: 从本地仓库或云仓库安装包
  • list: 列出本地仓库或云仓库中的包
  • search: 按关键字搜索本地仓库或云仓库包
  • info: 查看本地仓库或云仓库的包版本详情

并提供三条已安装包查询命令:

  • installed-list: 列出当前项目已安装包
  • installed-search: 按关键字搜索当前项目已安装包
  • installed-info: 查看当前项目已安装包详情

并提供一条卸载命令:

  • uninstall: 删除当前项目已安装包(支持按版本或整包删除)

安装(开发模式)

pip install -e .

快速开始

1) 构建

gp-hub build --project-dir . --dist-dir dist

2) 发布到本地仓库

gp-hub publish dist/gp_hub-0.1.0.tar.gz --repo-dir .gp_hub_repo

2.1) 启动本地模拟云服务(Flask)

gp-hub serve-cloud --host 127.0.0.1 --port 5000 --storage-dir .gp_hub_cloud

2.2) 发布到云(HTTP)

gp-hub publish dist/gp_hub-0.1.0.tar.gz --target cloud --cloud-url http://127.0.0.1:5000

3) 从仓库安装(本地/云)

gp-hub install gp_hub --version 0.1.0 --repo-dir .gp_hub_repo --project-dir .

# 或从云仓库安装
gp-hub install gp_hub --target cloud --cloud-url http://127.0.0.1:5000 --project-dir .

4) 列出仓库包

gp-hub list --repo-dir .gp_hub_repo

5) 搜索仓库包

gp-hub search gp --repo-dir .gp_hub_repo

6) 查看包信息

gp-hub info gp_hub --repo-dir .gp_hub_repo

7) 查询当前项目已安装包

gp-hub installed-list --project-dir .
gp-hub installed-search gp --project-dir .
gp-hub installed-info gp_hub --project-dir .

8) 卸载当前项目已安装包

# 卸载指定版本
gp-hub uninstall gp_hub --version 0.1.0 --project-dir .

# 卸载该包全部已安装版本
gp-hub uninstall gp_hub --project-dir .

配置文件(可选)

支持简单文本配置文件 gp_hub.conf(key = value,支持 # 注释):

  • 当前目录:./gp_hub.conf
  • 其次:$HOME/.gp_hub/gp_hub.conf

可配置项:

  • default_target = local|cloud
  • default_cloud_url = http://127.0.0.1:5000
  • default_repo_dir = .gp_hub_repo

命令行参数优先级高于配置文件;当 publish/install/list/search/info 未显式传 --target/--cloud-url/--repo-dir 时,会使用配置默认值。

本地仓库结构

默认仓库目录:.gp_hub_repo/

  • .gp_hub_repo/index.json:包索引
  • .gp_hub_repo/<name>/<version>/<artifact>.tar.gz:产物文件

本地云服务存储目录(模拟云端)默认:.gp_hub_cloud/

  • .gp_hub_cloud/index.json:云包索引
  • .gp_hub_cloud/<name>/<version>/<artifact>.tar.gz:云产物文件

安装记录位于:.gp_hub/installed.json

示例与测试

  • 示例:python examples/example_mvp_flow.py
  • 测试:python -m pytest -q

Metadata

Release files for gp-hub 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for gp-hub 0.1.4
File Interpreter ABI Platform Actions
gp_hub-0.1.4-py3-none-any.whl Python 3 none any Details for gp_hub-0.1.4-py3-none-any.whl

Release files / gp_hub-0.1.4-py3-none-any.whl

Download URL gp_hub-0.1.4-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d25aac3bdd8e9a3b69444a8a9d95219e38e704b3f8f16d0ec23126b24437bce
BLAKE2b-256 checksum
How to use checksums
61983492e0916b1168562ceab84744d67f6ca4e49510ecbf9ab5877ba0a0762c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Security for gp-hub 0.1.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page