Hi Chris, If I'm not mistaken, extract_tasks is only looking for modules in the fabfile.py namespace and only runs once at import time. Have you tried executing your code at the end of your fabfile so the arbitrarily named module is in that namespace at import time?
On Wed, Nov 18, 2015 at 12:39 AM Chris Spencer <chriss...@gmail.com> wrote: > Is it possible to dynamically expose tasks in a namespace other than the > module in which they appear? > > Say I have the file `myfabtasks.py` containing the tasks > `configure_apache`. By default, Fabric exposes this as > `myfabtasks.configure_apache`, which is a little clunky. How would I expose > it as `apache.configure` without renaming my module filename and task? > > My goal is to make tasks class-based, and I'm currently able to > dynamically create tasks with arbitrary names, but they're still restricted > to the namespace of their module's filename, which causes conflicts if I > have two classes in the same file that have the same method name. > > I spent some time digging through the code, specifically in main.py and > the `extract_tasks` function, but this behavior unfortunately seems to be > hardcoded. Is there any workaround? > > I tried dynamically creating a module with an arbitrary name and > reassigning my tasks there, as explained at > http://stackoverflow.com/questions/3799545/dynamically-importing-python-module/3799609#3799609, > but Fab never seems to find the dynamic module. > _______________________________________________ > Fab-user mailing list > Fab-user@nongnu.org > https://lists.nongnu.org/mailman/listinfo/fab-user >
_______________________________________________ Fab-user mailing list Fab-user@nongnu.org https://lists.nongnu.org/mailman/listinfo/fab-user