REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.98 KB
Close
//opt/alt/python311/share/doc/alt-python311-setuptools/docs/deprecated/resource_extraction.rst
Text
Base64
.. _Automatic Resource Extraction: Automatic Resource Extraction ============================= In a modern setup, Python packages are usually installed as directories, and all the files can be found on deterministic locations on the disk. This means that most of the tools expect package resources to be "real" files. There are a few occasions however that packages are loaded in a different way (e.g., from a zip file), which is incompatible with the assumptions mentioned above. Moreover, a package developer may also include non-extension native libraries or other files that C extensions may expect to be able to access. In these scenarios, the use of :mod:`importlib.resources` is recommended. Old implementations (prior to the advent of :mod:`importlib.resources`) and long-living projects, however, may still rely on the library ``pkg_resources`` to access these files. If you have to support such systems, or want to provide backward compatibility for ``pkg_resources``, you may need to add an special configuration to ``setuptools`` when packaging a project. This can be done by listing as ``eager_resources`` (argument to ``setup()`` in ``setup.py`` or field in ``setup.cfg``) all the files that need to be extracted together, whenever a C extension in the project is imported. This is especially important if your project includes shared libraries *other* than ``distutils``/``setuptools``-built C extensions, and those shared libraries use file extensions other than ``.dll``, ``.so``, or ``.dylib``, which are the extensions that setuptools 0.6a8 and higher automatically detects as shared libraries and adds to the ``native_libs.txt`` file for you. Any shared libraries whose names do not end with one of those extensions should be listed as ``eager_resources``, because they need to be present in the filesystem when he C extensions that link to them are used. The ``pkg_resources`` runtime for compressed packages will automatically extract *all* C extensions and ``eager_resources`` at the same time, whenever *any* C extension or eager resource is requested via the ``resource_filename()`` API. (C extensions are imported using ``resource_filename()`` internally.) This ensures that C extensions will see all of the "real" files that they expect to see. Note also that you can list directory resource names in ``eager_resources`` as well, in which case the directory's contents (including subdirectories) will be extracted whenever any C extension or eager resource is requested. Please note that if you're not sure whether you need to use this argument, you don't! It's really intended to support projects with lots of non-Python dependencies and as a last resort for crufty projects that can't otherwise handle being compressed. If your package is pure Python, Python plus data files, or Python plus C, you really don't need this. You've got to be using either C or an external program that needs "real" files in your project before there's any possibility of ``eager_resources`` being relevant to your project.
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 10
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
distutils
DIR
-
drwxr-xr-x
2024-03-03 22:48:42
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
changed_keywords.rst
2.13 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
commands.rst
28.98 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
dependency_links.rst
2.79 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
distutils-legacy.rst
2.31 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
easy_install.rst
50.84 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
functionalities.rst
1.42 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.rst
863 B
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
python_eggs.rst
30.22 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
resource_extraction.rst
2.98 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
zip_safe.rst
3.57 KB
lrw-r--r--
2022-11-24 06:08:53
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).