Open cloudultima3164 opened 3 years ago
There are a few issues with your config file.
In this code:
def resource_callback(policy, resource):
if resource.package == "itertools":
resource.add_include = True
The idea is sound. But PythonExtensionModule
doesn't expose a package
attribute. You'll want to do something like this:
def resource_callback(policy, resource):
if type(resource) == "PythonExtensionModule":
if resource.name == "itertools":
resource.add_include = True
In this code:
exe.add_python_resources([
PythonExtensionModule(
name="itertools",
is_stdlib=True,
add_include=True,
add_location="in_memory",
add_location_fallback="filesystem-relative:lib",
add_bytecod_optimization_level_two=True
),
# ^^^^ also tried this
exe.read_package_root(
path="my_path",
packages=["my_script"]
),
exe.read_package_root(
path="my_path/src/py",
packages=["local_package1", "local_package2", "local_package3"]
),
exe.pip_install(["-r", "req.txt"]
)
])
You cannot construct instances of PythonExtensionModule
, as there is no constructor function.
Also, this code effectively passes a list of non-uniform types to add_python_resources()
. add_python_resources()
wants a list of resource-like types. A list of lists won't work. (Although it could potentially be made to work.)
Let me know if you have better success with this feedback!
Hi! First of all, I want to say thank you for developing this tool. I am a big fan of Rust, and this tool is probably the easiest packaging manager I've used so far (if I can call it that).
The issue: I'm still trying to figure out how to properly make a configuration file, so I may have just overlooked this in the documentation, but I can't seem to include itertools in the final build. My script runs fine if I build with
policy.extension_module_filter = "all"
, but I would really rather use theminimal
option and then fine-tune other included packages. I've tried a couple of different things to see if I could make it work, but to no avail.My configuration file is basically the following:
However, I'm guessing neither of the things I tried in the above code are not the right approach, as the callback results in:
and the attempt to directly create a PythonExtensionModule results in:
Sorry if this is just something I missed in the documentation, but can someone please help me understand the proper way to fine tune which packages are included in the build when using
policy.extension_module_filter = "minimal"
?