Lines Matching full:resources
1 :mod:`!importlib.resources` -- Package resource reading, opening and access
4 .. module:: importlib.resources
7 **Source code:** :source:`Lib/importlib/resources/__init__.py`
13 This module leverages Python's import system to provide access to *resources*
16 "Resources" are file-like resources associated with a module or package in
17 Python. The resources may be contained directly in a package, within a
19 package. Resources may be text or binary. As a result, Python module sources
21 de-facto resources of that package. In practice, however, resources are
25 Resources can be opened or read in either binary or text mode.
27 Resources are roughly akin to files inside directories, though it's important
28 to keep in mind that this is just a metaphor. Resources and packages **do
30 for example, a package and its resources can be imported from a zip file using
40 resources included in packages easier, with more stable and consistent
44 on `using importlib.resources
45 <https://importlib-resources.readthedocs.io/en/latest/using.html>`_ and
46 `migrating from pkg_resources to importlib.resources
47 <https://importlib-resources.readthedocs.io/en/latest/migration.html>`_.
51 :class:`importlib.resources.abc.ResourceReader`.
55 Represents an anchor for resources, either a :class:`module object
61 Returns a :class:`~importlib.resources.abc.Traversable` object
62 representing the resource container (think directory) and its resources
67 package, resources are resolved from that package. If a module,
68 resources are resolved adjacent to that module (in the same package
84 Given a :class:`~importlib.resources.abc.Traversable` object representing
85 a file or directory, typically from :func:`importlib.resources.files`,
112 - *anchor* is an :class:`~importlib.resources.Anchor`,
113 as in :func:`~importlib.resources.files`.
120 importlib.resources.read_text(my_module, "info.txt")
122 Like :meth:`Traversable.joinpath <importlib.resources.abc.Traversable>`,
127 importlib.resources.read_binary(my_module, "pics/painting.png")
128 importlib.resources.read_binary(my_module, "pics", "painting.png")
134 importlib.resources.read_text(my_module, "info", "chapter1.txt",
229 with importlib.resources.path(anchor, "resource.txt") as fspath:
247 This function does not consider directories to be resources.
263 The iterable returns names of resources (e.g. files) and non-resources