2024-01-08 PyPI module notes
(note by Bill)
-
reviewed several PyPI module build tools and settled on two prospects:
flit: simple to put into practice; minimal metadata requiredhatch: also simple; metadata seems more complicated; also supports more options
-
(also experimented with using
buildandtwinemodules: very simple; does not support dependencies so that is not suitable for Massive Wiki publishing.) -
important to create and use
test.pypi.orgto work out the use details; requires creating a login and an API key -
reading the
flitdocumentation, care must be taken to insure that testing uses thetest.pypi.orgsystem; seems easy to end up using the default, which is the main PyPI server, and that needs to be avoided.- see how to upload to
test.pypi.orghere: Using .pypirc, Controlling package uploads
- see how to upload to
-
questions to answer:
- best to just have an empty
__init.py__file? - where is a good place to define the
versiondescriptor? (reason for this question: some docs show it in thepyproject.tomlfile which seems like a terrible place -- once all that metadata is set up just leave that file alone; some docs show it imported into the__init.py__file, but how is that used?;flitwants the version descriptor at the top of the source file -- OK, that seems maintainable )
- best to just have an empty
Resources
-
Hatch: About - Hatch (pypa.io)
-
Twine: twine · PyPI
-
Build: build · PyPI
-
An example of a good documentation practice to emulate: The Most Complete Guide for Creating a Good PyPI Package | by Elise Landman | Towards Data Science
- what I like about this description is the inclusion of the barebones project directory tree and the warm tone and style of the writing.