funpub
funpub 是多渠道制品发布工具。核心引擎采用 Rust 实现(funpub-core),直接通过 funsecret-core 读取本地加密仓库凭据,同时提供:
- 原生 CLI 二进制(
funpub):零 Python 依赖、纯 Rust TLS(rustls),通过apt/brew/cargo install/ GitHub Release 静态二进制分发; - Python 扩展包(PyPI
funpub):基于 PyO3 + maturin(abi3-py312)包装,零运行时依赖,完全兼容历史 Python API; - Rust 核心库(
funpub-core):发布于 crates.io,供 Rust 工具链与服务直接调用。
当前支持的渠道:
- aliyun — 阿里云 Packages generic 仓库(协议细节见
docs/aliyun/generic/)
安装
命令行安装(原生静态二进制,零 Python 依赖)
# APT(添加 farfarfun 源后,见 https://farfarfun.github.io/packages/funpub/)
sudo apt install funpub
# Homebrew
brew install farfarfun/packages/funpub
# Cargo
cargo install funpub
# 或直接从 GitHub Releases 下载对应平台的静态二进制 / .deb
Python 库安装(仅提供 Python API,零运行时依赖,不含命令行入口)
pip install funpub
Rust 核心库
[dependencies]
funpub-core = "0.1"
命令行用法
阿里云账号下可以有多个仓库,同一类型(如 generic)下也可以有多个不同名字
的仓库,因此凭证按 (repo-type, repo-name) 两级区分,一个仓库只需要用
funsecret 配置一次,之后命令行只需要传 --repo-name:
funsecret write https://packages.aliyun.com/api/protocol/{org_id}/generic/{repo} \
funpub aliyun generic {repo_name} repo_url
funsecret write {username} funpub aliyun generic {repo_name} username
funsecret write {password} funpub aliyun generic {repo_name} password
# 上传(repo-type 默认 generic,凭证从 funsecret 按 repo-name 自动读取)
funpub upload ./dist/app-1.0.0.tar.gz path/to/app \
--version 1.0.0 --repo-name {repo_name}
# 下载
funpub download path/to/app --version 1.0.0 \
--repo-name {repo_name} --output ./downloads/
# 检查制品是否存在(存在退出码 0,不存在退出码 1)
funpub exist path/to/app --version 1.0.0 --repo-name {repo_name}
# 生成临时免密下载地址
funpub sign-url path/to/app --version 1.0.0 \
--repo-name {repo_name} --expiration-seconds 3600
# 查看已注册的渠道
funpub channels
# 查看版本
funpub --version
CLI 不接受密码参数,认证信息统一通过 funsecret 按仓库名称读取,避免凭据进入 shell 历史和进程列表。
Python 用法
from funpub import get_publisher
# 方式一(推荐):仓库信息已通过 funsecret 配置过(见上面「命令行用法」
# 里的 funsecret write 示例),只需要传 repo_name,无需在代码里出现凭据
publisher = get_publisher("aliyun", repo_name="funpackage")
# 方式二:测试/一次性脚本场景下,在代码中直接传入配置(不适用于 CLI;
# username/password 不要写成字面量,应从环境变量或自建的 secret 存取读取)
import os
publisher = get_publisher(
"aliyun",
repo_url=os.environ["FUNPUB_ALIYUN_REPO_URL"],
username=os.environ["FUNPUB_ALIYUN_USERNAME"],
password=os.environ["FUNPUB_ALIYUN_PASSWORD"],
)
# 文件大小超过 chunk_threshold(默认等于 chunk_size,100MB)会自动走分块上传
result = publisher.upload_file(
filepath="./dist/app-1.0.0.tar.gz",
path="path/to/app",
version="1.0.0",
)
print(result.url, result.md5)
publisher.download_file(path="path/to/app", version="1.0.0", save_dir="./downloads")
url = publisher.get_download_url(path="path/to/app", version="1.0.0")
架构设计
仓库采用与 funget / funsecret 一致的 3-crate 纯虚拟 Rust 工作区:
crates/funpub-core:纯 Rust 核心库,实现Publisher、PublishResult、ChannelRegistry、流式校验和、幂等重试 HTTP 客户端、阿里云 Generic 协议以及通过funsecret-core读取加密凭据。crates/funpub:独立原生 CLI 二进制(clap+env_logger),支持 musl 静态构建。crates/funpub-py:PyO3(abi3-py312)+ maturin 扩展模块_funpub,不依赖 CLI crate,提供零依赖 Python API(get_publisher/PublishResult/BasePublisher/AliyunPublisher/FunPubError异常族)。src/funpub/:薄 Python 再导出层与.pyi类型存根,保持from funpub import ...、from funpub.core import ...、from funpub.channels import ...全部兼容。
开发
# Rust 检查与测试
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --exclude funpub-py
# 构建原生 CLI
cargo build --release --package funpub
# 构建 Python 扩展并运行 pytest
maturin build --release --out dist
pytest
关于 farfarfun
farfarfun 是一个专注于实用工具库的开源组织, 涵盖云存储、数据处理、AI、多媒体与开发工具链等方向。
- 🏠 组织主页:https://github.com/farfarfun
- 📦 PyPI:https://pypi.org/user/niuliangtao/
- 📧 联系:farfarfun@qq.com
本项目基于 MIT 协议开源。
Metadata
Release files for funpub 0.2.0
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 |
|---|---|---|---|---|
| funpub-0.2.0.tar.gz | 56.9 kB | Without provenance | Details for funpub-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 24.9 MB
Release files / funpub-0.2.0.tar.gz
| Download URL | funpub-0.2.0.tar.gz |
|---|---|
| Size | 56.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ceee431018f7ab1a479a308e3003b551f9f6d64a47f240531f5dd7ef5d6856b6
|
|
BLAKE2b-256 checksum How to use checksums |
b27cf39c0c936121a831cc924d3b5d1f6e79ac2febe83552cb8ef5315c9ee77f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / funpub-0.2.0-cp312-abi3-win_amd64.whl
| Download URL | funpub-0.2.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7cafdc2d7d0fd8fd526bbaf57494caf33eb5453760593ae3bf14e85b1779c2a1
|
|
BLAKE2b-256 checksum How to use checksums |
1b9ffc60774b4a54c0958564ec0c7c4cb3171dea6e44153a00bd31263c15248d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / funpub-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | funpub-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e4bdeb903f4ef943b2d064fcb96d017f86bb026825e8e56a0b7ecc58dc2f0605
|
|
BLAKE2b-256 checksum How to use checksums |
4e8217bd62f59a72d4310f17da0a118f4ac780196b2dd291ca9f0aa61e682178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / funpub-0.2.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | funpub-0.2.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e579508b93306d7702038e0c5fc09c8b5233e3d5d126f8b680176e8e7630b552
|
|
BLAKE2b-256 checksum How to use checksums |
d723d5b1349d589a88fa6c0e3e746167309aa7ca8639e33f24f81ff5b5a3b110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / funpub-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | funpub-0.2.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a7d94ae494747c1e4d3597fa4e1554b3f060b408dd954fe1533d0811d154f0cf
|
|
BLAKE2b-256 checksum How to use checksums |
eda82bfdaf1be507044b2a75fb3ae67677a9825fca1ea4e0483569a7c1e09cc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / funpub-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | funpub-0.2.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
72de9fa2fe2f43e27972f4d86837391a6f0b92d427b4e01c74dd513945af3b06
|
|
BLAKE2b-256 checksum How to use checksums |
9e9ff8645376a1eb0d7b0db0a47ef5be915bfd9ce7a7611d003c54f85d78688f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / funpub-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | funpub-0.2.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a8642f03c1b4308744d5f5bb420472a13a376b3def167ca7f65944f6e08c1a58
|
|
BLAKE2b-256 checksum How to use checksums |
54ca6cc77fb89f615d6a43271028ac894869657ede63db45c6331b773e96f77d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for funpub 0.2.0
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.