Skip to content

Some tests with python package resources inside pyoxidizer builds.

Notifications You must be signed in to change notification settings

thijsmie/pyoxidizer-resource-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyOxidizer package resource tests

There are multiple mechanisms to read in-package python resources. In PyOxidizer some of those work, and then only for some setups. Here is an index what currently (2022-10-14) works:

Resource in main directory of module
pkgutil.get_data FAILURE
pkg_resources.resource_string SUCCESS
importlib.resources.open_text SUCCESS
importlib.resources.files FAILURE
importlib.resources.read_text SUCCESS
importlib.resources.read_binary SUCCESS
importlib.resources.contents SUCCESS
Resource in subdirectory of module
pkgutil.get_data FAILURE
pkg_resources.resource_string SUCCESS
importlib.resources.open_text CANT_USE
importlib.resources.files FAILURE
importlib.resources.read_text CANT_USE
importlib.resources.read_binary CANT_USE
importlib.resources.contents SUCCESS

These results were obtained by simply typing pyoxidizer run in the top level directory. The CANT_USE is here because some of the importlib.resources functions do not accept path separators in the resource names, making it impossible to access things in subdirectories. With importlib.resources.files not working at all your only option is pkg_resources.resource_* functions which work reliably in my tests.

About

Some tests with python package resources inside pyoxidizer builds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published