-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current working directory-based config file loading? #471
Comments
Also not really part of Fabric's functionality, Invoke's should just-work. Possibly add back after pyinvoke/invoke#471 is implemented?
I ran into similar issues with invoke-0.21.0 while trying out |
Just a thought: It might be useful to walk up the CWD path to find the configuration. That way a user is not constrained to stay in the root of the project to call invoke. Doing this does bring up the question of managing the CWD for the tasks... "Where the user is" and "where the configuration is" both seem reasonable choices. I'd say the second is better since it ensures your tasks work the same regardless of which directory inside your project you are. eg: if the user is at /home/username/my-projects/project/subdir, invoke could check:
Further, from #537, it's nice that |
That's exactly how the tasks loader works now, for what it's worth, so yea we'd likely reuse the same code and approach: http://docs.pyinvoke.org/en/1.0/concepts/loading.html#task-module-discovery |
I have an tasks:
search-root: ./test
search_root: ./test And invoking |
This has come up a few times recently, though I can't find the ticket or discussion that I'm thinking of. But it affects me occasionally, and also some tests occasionally.
Background
Specifically, the "project" level config file: it's technically defined as "the config file living in the same directory as one's task namespace". In many cases, both files and the user are all hanging out in one's project / checkout / etc root directory, such as
~/code/myproject
, and thus it's also often interpreted as "the config file that is closest to my CWD / the output ofpwd
/ whatever."However, right now, the latter isn't implemented anywhere; so in some edge cases folks get confused as to why things don't work right:
inv -c othercollection
, andothercollection
lives in some other location on yourPYTHONPATH
. Conf file isn't loaded, sadness ensues.nottasks.py
(maybe there's a non-Invoketasks
onPYTHONPATH
already) and one is expecting that the conf file, which states{'tasks': {'collection_name': 'nottasks'}}
, will cause Invoke to load upnottasks.py
. But it doesn't, since the file is a "project-level" conf file, whose loading is predicated on finding and loading the nearby collection; again, sadness ensues.tasks.collection_name
itself...well...that didn't go well.Solutions
local
orworking_directory
.The text was updated successfully, but these errors were encountered: