-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use Yasha by script directly instead of Command Line ? #58
Comments
Update 1: I tried calling the function directly but got an error. The code:
The error: |
Update 2: If I include a non_cli version of the function without all the click decorators (click command, argument, option etc), then it can be called directly from script no-problem. This is very convenient for people who are supporting multiple systems like windows, linux and other systems. The Code: non cli python function for calling directly from script. no click decorators.def yasha_non_cli( The call:
|
In yasha/scons.py file, I have used CliRunner from click.testing to call yasha.cli |
The problem with using here's another option which runs yasha on the same interpreter as your python code: from yasha import cli as yasha_cli
yasha_cli(['-v', 'my-variable-file.json', 'my-template.j2']) |
Yeah, you're right. This has been bugging me too. To change the approach I would like to see Yasha being refactored heavily. I would prefer Yasha internals to have similar API that Jinja has (Environment class). If you like to do this I can review the PR(s). However, be prepared that it may not be smooth process and there can be many review rounds ;) My experience in Python has increased greatly since I wrote Yasha and there is quite much code I'm not happy anymore. |
Could the yasha cli.py script function be called directly ?
I have a unique problem where I can't call Yasha.exe from the command line.
I am trying to call the yasha cli function directly, but can't get it to work.
Can you explain how, if it is possible ?
my original call goes like this:
call(('yasha', '-v', variable_file_path, '-o', output_file_path, template_file_path))
The text was updated successfully, but these errors were encountered: