Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced content levelIntermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
784
|
25 章 發布擴充功能與程式
setup.cfg 檔案
setup.cfg
為建置時期(build-time)的命令之選項提供適當的預設值。舉例
來說,你可以新增下列的文字行到
setup.cfg
,以永遠建置
universal wheels
通用的
wheels
,請參閱後面的「建立 wheels」):
[bdist_wheel]
universal=1
發布你的套件
一旦你準備好你的
setup.py
(和其他檔案),發布你的套件需要下列步驟:
1. distribution 建立(「封裝」)為一個 wheel 或其他的封存格式(archive
format)。
2. 如果必要的話,將你的套件註冊到一個存放庫(repository)。
3. 上傳你的套件到那個存放庫。
建立 Distribution
在過去,以
python setup.py sdist
製作的一個封裝好的「source(原始
)」 distribution
sdist
)是你能以
distutils
產生的最有用的檔案了。如
果你要為某個版本的 Linux 發布帶有 C 擴充功能的套件,你仍然會想要
建立一個
sdist
而當你絕對需要絕對路徑(而非相對路徑)以安裝特定檔
案(列在
setup.py
data_files
中),你就需要使用一個
sdist
。(請參閱
Python Packaging User Guide 中有關
data_files
的討論(
https://packaging.
python.org/distributing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9789864766819