Skip to main content

blankcx330-hello

一个用于学习 Python 公共库构建与发布 全流程的示例工程:从源码组织、 pyproject.toml 配置,到 python -m build 打包、twine 上传 PyPI, 再到 pip install 安装使用。

简介

blankcx330-hello 演示一个最小可发布的 Python 包应该长什么样:

  • 采用 src 布局,源码与工程配置分离,避免脚本和缓存被误打进发行包;
  • 使用 hatchling 作为构建后端,全部配置集中在 pyproject.toml;
  • 同时产出 sdist(.tar.gz)与 wheel(.whl)两种分发格式。

包本身只做一件事:打印一句问候语。价值不在功能,而在于把这套流程完整跑通一遍。

环境要求

  • Python >= 3.14

安装

pip install blankcx330-hello

发行名 blankcx330-hello 和导入名 blankcx330_hello 不一样:PyPI 上带连字符, import 时连字符会变成下划线,这是 Python 模块名的正常约定。

从源码以开发模式安装:

git clone <你的仓库地址>
cd blankcx330-hello

python -m venv .venv
. .venv/Scripts/Activate.ps1    # Windows PowerShell
# source .venv/bin/activate     # macOS / Linux

pip install -e .

快速开始

from blankcx330_hello import hello

hello()

输出:

你好,这是一个包里面的函数

API

blankcx330_hello.hello()

打印一句固定的问候语,不接受参数,返回 None。

名称 签名 说明
hello () -> None 在标准输出打印问候语

项目结构

blankcx330-hello/
├── pyproject.toml          # 构建系统与项目元数据
├── README.md
└── src/
    ├── main.py             # 本地演示脚本,不随包发布
    └── blankcx330_hello/
        ├── __init__.py     # 对外导出 hello
        └── hello.py        # 具体实现

构建与发布

python -m build                     # 产物生成到 dist/
python -m twine check dist/*        # 校验元数据与 README 渲染
python -m twine upload dist/*       # 需要 PyPI API Token

许可证

MIT

Metadata

Release files for blankcx330-hello 0.1.3

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

Source distribution (sdist)

Source distribution for blankcx330-hello 0.1.3
File Size Uploaded Provenance
blankcx330_hello-0.1.3.tar.gz 2.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for blankcx330-hello 0.1.3
File Interpreter ABI Platform
blankcx330_hello-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 4.6 kB

Release files / blankcx330_hello-0.1.3.tar.gz

Download URL blankcx330_hello-0.1.3.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
24036629a77db910eb645b996d947f8b460e432a3549d47f15fdb44856e9390d
BLAKE2b-256 checksum
How to use checksums
3c8929b57a1f53fcf27e5968799c590d5d3d37a07b5d09b2ec47c42a4d28e7ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.1

Release files / blankcx330_hello-0.1.3-py3-none-any.whl

Download URL blankcx330_hello-0.1.3-py3-none-any.whl
Size 2.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c50f0f663858724741b66fdd49d7a0050593681ede11a294a11af8c89f205c1
BLAKE2b-256 checksum
How to use checksums
bfa04dd5e8acb67547c9d0118c2a329e330e613259da0fca12b6384e0ed3e106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.1

Security for blankcx330-hello 0.1.3

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.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

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