Skip to content

Commit 8cbc206

Browse files
authored
docs: module inclusion policy (#119)
* docs: module inclusion policy * module-policy: typo
1 parent c3a45e8 commit 8cbc206

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

docs/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
extensions = [
3131
"sphinx.ext.autodoc",
3232
"sphinx.ext.viewcode",
33+
"sphinx.ext.intersphinx",
3334
]
3435

3536
html_theme = "furo"

docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Contents
1919

2020
install
2121
usage
22+
module-policy
2223

2324

2425
Indices and tables

docs/module-policy.rst

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Module inclusion policy
2+
=======================
3+
4+
Python is a dynamic language with a complex module system, including
5+
modules that are created only at runtime or appear on specific
6+
supported platforms.
7+
8+
This page exists to document ``stdlib-list``'s approach to module detection
9+
and subsequent inclusion. It is not intended to be permanent, and may change
10+
over time as Python itself changes (or our approach to module detection
11+
improves).
12+
13+
Current guiding rules
14+
---------------------
15+
16+
* Missing top-level modules **are a bug**: if a new version of Python adds a new
17+
top-level module, our failure to detect it should be considered a bug.
18+
19+
Concretely: if ``examplemodule`` is present in Python 3.999, then it should be
20+
included in the ``stdlib_list("3.999")`` listing.
21+
22+
* Missing sub-modules are **best-effort**: if ``examplemodule`` contains
23+
``examplemodule.foo.bar.baz.deeply.nested``, we make a best-effort attempt
24+
to detect each inner module but make no guarantee about doing so.
25+
26+
Our rationale for this is that "stdlib-ness" is inherited from the parent
27+
module, even when not explicitly listed. In other words: anything that matches
28+
``examplemodule.*`` is in the standard library by definition so long
29+
as ``examplemodule`` is in the standard library.
30+
31+
* Platform-specific modules are **best-effort**: ``stdlib-list`` is currently collected
32+
from Linux builds of CPython. This means that Windows- and macOS-specific modules
33+
(i.e., modules that aren't installed except for on those hosts) are not necessarily
34+
included.
35+
36+
This includes top-level modules.
37+
38+
* Missing non-CPython modules are **not supported**: ``stdlib-list`` is implicitly
39+
a list of CPython's standard library modules, which are expected to be mirrored
40+
in other implementations of Python.
41+
42+
* Psuedo-modules are **not supported**: Python sometimes makes use of
43+
"pesudo-modules", i.e. namespaces placed into ``sys.modules`` that don't
44+
pass :py:func:`inspect.ismodule`. We don't currently support these, since the
45+
semantics for doing so are unclear.
46+
See `stdlib-list#117 <https://github.com/pypi/stdlib-list/issues/117>`__
47+
for additional details.
48+
49+
If you have a scenario not covered by the rules above, please file an issue!

0 commit comments

Comments
 (0)