1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
.. SPDX-FileCopyrightText: 2023 The meson-python developers
..
.. SPDX-License-Identifier: MIT
.. _reference-limitations:
***********
Limitations
***********
Non-package data files
======================
It is possible to encapsulate arbitrary data files into Python
wheels. ``meson-python`` will add to the wheel any data file installed
into the Meson's ``{datadir}`` location, for example via Meson's
|install_data()|_ function. However, when the resulting wheel is
installed, these files are unpacked into a platform-specific location
and there is no supported facility to reliably find them at run time.
It is recommended to include data files than need to be accessible at
run-time inside the package alongside the Python code, and use
:mod:`importlib.resources` (or the `importlib-resources`_ backport) to
access them.
.. _install_data(): https://mesonbuild.com/Reference-manual_functions.html#install_data
.. _importlib-resources: https://importlib-resources.readthedocs.io/en/latest/index.html
.. |install_data()| replace:: ``install_data()``
|