|
| 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