vbp-bid-common
vbp-bid-common 是 VBP Bid Copilot 的公共基础包,当前提供异步 Redis 与 MongoDB 客户端封装,便于多个服务复用同一套缓存、队列、分布式锁和基础 CRUD 能力。
安装
pip install vbp-bid-common
本地开发时可在仓库根目录执行:
pip install -e ./vbp-bid-common[dev]
使用示例
from vbp_bid_common import get_mongodb_client, get_redis_client
async def main() -> None:
redis_client = get_redis_client()
await redis_client.set("demo:key", "value", ex=60)
value = await redis_client.get("demo:key")
mongo_client = get_mongodb_client(default_collection="demo")
inserted_id = await mongo_client.insert_one({"value": value})
doc = await mongo_client.find_one({"_id": inserted_id})
也可以按模块导入:
from vbp_bid_common.services.mongodb import MongoDBClient
from vbp_bid_common.services.redis import RedisClient
环境变量
Redis 客户端支持以下环境变量:
REDIS_HOST,默认127.0.0.1REDIS_PORT,默认6379REDIS_DB,默认0REDIS_USERNAMEREDIS_PASSWORDREDIS_DECODE_RESPONSES,默认trueREDIS_MAX_CONNECTIONS,默认100REDIS_CONNECTION_POOL_TIMEOUT,默认10REDIS_SOCKET_TIMEOUTREDIS_SOCKET_CONNECT_TIMEOUT
MongoDB 客户端支持以下环境变量:
MONGODB_URI,默认mongodb://127.0.0.1:27017MONGODB_DATABASE,默认test-technicalMONGODB_COLLECTION_NAMEMONGODB_MAX_POOL_SIZEMONGODB_MIN_POOL_SIZEMONGODB_SERVER_SELECTION_TIMEOUT_MS
发布到 PyPI
首次发布前需要注册并配置 PyPI API Token:
python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*
发布测试包可先使用 TestPyPI:
python -m twine upload --repository testpypi dist/*
每次发布前请更新 pyproject.toml 中的 version,并确认 README.md、LICENSE 与依赖声明已同步。
开源协议
本项目使用 Apache License 2.0。详见 LICENSE。
Metadata
Release files for vbp-bid-common 0.6.4
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 |
|---|---|---|---|---|
| vbp_bid_common-0.6.4.tar.gz | 49.3 kB | Without provenance | Details for vbp_bid_common-0.6.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vbp_bid_common-0.6.4-py3-none-any.whl | Python 3 | none | any | Details for vbp_bid_common-0.6.4-py3-none-any.whl |
Total release size: 108.0 kB
Release files / vbp_bid_common-0.6.4.tar.gz
| Download URL | vbp_bid_common-0.6.4.tar.gz |
|---|---|
| Size | 49.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39abc2775d17e1e4536d7fad4317ca29a2cfe3a47f951fc27ac9155b28b67251
|
|
BLAKE2b-256 checksum How to use checksums |
c48ae05bcbef93ccf98eb542f2faec54698671917bda240dbb85916ec4da241b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Release files / vbp_bid_common-0.6.4-py3-none-any.whl
| Download URL | vbp_bid_common-0.6.4-py3-none-any.whl |
|---|---|
| Size | 58.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab4255b2d2aae943aa00c987ae35f801e7156d01f40f7f2e719288f0defcdf34
|
|
BLAKE2b-256 checksum How to use checksums |
4e4221753c3711f3a7e97f8e6b9cc3f934c3a18d34122a4b185d98a1f946b501
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Security for vbp-bid-common 0.6.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.