pyFAI.resources package

pyFAI.resources.setup module

pyFAI.resources.setup.configuration(parent_package='', top_path=None)

Module contents

Access project’s data and documentation files.

All access to data and documentation files MUST be made through the functions of this modules to ensure access across different distribution schemes:

  • Installing from source or from wheel

  • Installing package as a zip (through the use of pkg_resources)

  • Linux packaging willing to install data files (and doc files) in alternative folders. In this case, this file must be patched.

  • Frozen fat binary application using pyFAI (frozen with cx_Freeze or py2app). This needs special care for the resource files in the setup:

  • With cx_Freeze, add pyFAI/resources to include_files:

import pyFAI.resources
pyFAI_include_files = (os.path.dirname(pyFAI.resources.__file__),
                      os.path.join('pyFAI', 'resources'))
setup(...,
    options={'build_exe': {'include_files': [pyFAI_include_files]}}
)
  • With py2app, add pyFAI in the packages list of the py2app options:

setup(...,
    options={'py2app': {'packages': ['pyFAI']}}
)
pyFAI.resources.resource_filename(resource)

Return filename corresponding to resource.

resource can be the name of either a file or a directory. The existence of the resource is not checked.

Parameters:

resource (str) – Resource path relative to resource directory using ‘/’ path separator.

Returns:

Absolute resource path in the file system

pyFAI.resources.silx_integration()

Provide pyFAI resources accessible throug silx using a prefix.