[BUG]Zip module import
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Hi!
i'm trying to make my zip-packed module work.
as in docs,created the following zip:
my_module.zip
|--my_module/
|--init.pyc
|--my_module/
|--.... [modules sources]
i can see salt minion is syncing my module,that's ok
but list_functions has none of my functions(for test purposes placed some foo function in init)
debugging salt minion lead me to the following line in https://github.com/saltstack/salt/blob/84f434cc76b04bc8f91582ca6aa11e471b7e3988/salt/loader/lazy.py#L980C20-L980C20
if (
self._only_pack_properly_namespaced_functions
and not func.__module__.startswith(self.loaded_base_name)
):
# We're not interested in imported functions, only
# functions defined(or namespaced) on the loaded module.
continue
self._only_pack_properly_namespaced_functions is set to True and self.loaded_base_name is salt.loaded
but func.module starts with my module name,so any function from my module is not beeing loaded.
Is it a bug?if not,what do i do?
i've tried hacking my module's function's module in init(),they started to load,but i can't call them after it)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read salt/loader/lazy.py around the referenced namespace-filtering condition and compare it with the reported zip layout and function module values. Reproduce the import and list_functions behavior, then determine whether valid zip-packed functions are being excluded and capture the expected loading behavior in a regression test or documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100