No project description provided
Project description
Python 包发布简明流程指南
1. 准备发布环境
# 安装必要工具
pip install -U setuptools wheel twine
2. 创建项目目录结构
# 创建项目目录
mkdir mypackage
# 进入目录
cd mypackage
# 创建标准目录结构
mkdir -p mypackage data tests
touch mypackage/__init__.py
touch mypackage/main.py
touch setup.py
touch README.md
touch LICENSE
# 打开vscode
code .
标准目录结构
mypackage/
├── data/ # 数据文件目录
├── mypackage/ # 主代码包
│ ├── __init__.py # 包初始化文件
│ └── main.py # 主代码文件
├── setup.py # 包配置
├── LICENSE # 许可证文件
└── README.md # 项目文档
3. 创建核心文件
1. setup.py 配置
2. LICENSE 文件
3. README.md
4. 构建分发包
# 清理旧构建文件
rm -rf build dist *.egg-info
# 生成分发包
# sdist: 源码分发版 source distribution
# bdist_wheel: 构建分发版 build distribution
python setup.py sdist bdist_wheel
# 验证包结构
twine check dist/*
5. 发布到 PyPI
# 上传到正式 PyPI
twine upload dist/*
# 测试上传命令
twine upload --repository testpypi dist/*
6. 安装验证
# 从PyPI安装
pip install mypackage
# 验证安装
python -c "import mypackage; print('成功安装版本:', mypackage.__version__)"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mkfpdf-1.0.0.tar.gz
(14.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mkfpdf-1.0.0-py3-none-any.whl
(14.8 kB
view details)
File details
Details for the file mkfpdf-1.0.0.tar.gz.
File metadata
- Download URL: mkfpdf-1.0.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34a0691207cc43dc021cd0830a0f6b36d43d9852e5b259f3a1a9d4bd48e3c3ed
|
|
| MD5 |
27a7a0ee062cc4fcdf52bfd8727789ad
|
|
| BLAKE2b-256 |
2326449ebc18438589b7f33681488e530c6f92a52896a2b3bb88c7dfd4fcb937
|
File details
Details for the file mkfpdf-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mkfpdf-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4035d2428a52c29e26089f7bfab0e71d6fa31da9c3c860bcb03e60cf0dec8bc
|
|
| MD5 |
d2c405198e7fce41fd1fcb2fd06dd4ea
|
|
| BLAKE2b-256 |
b734eea5f96495ea54ed8ecb25ed984069162679f3bbcb04edfc16305c79cb1f
|