Skip to content
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

API usage #105

Closed
bendrissou opened this issue May 23, 2023 · 2 comments
Closed

API usage #105

bendrissou opened this issue May 23, 2023 · 2 comments

Comments

@bendrissou
Copy link

I would like to know how to invoke grammarinator-generate from a Python script. Instead of CLI.

Are there any documentations or examples please?

@renatahodovan
Copy link
Owner

Hi @bendrissou !

grammarinator-generate is basically a CLI wrapper utilizing the GeneratorTool module. If you would like to invoke grammarinator-generate from a Python script, then you can do it as with any other executable, e.g., with using subprocess.run.

However, if your goal is to avoid starting a subprocess and use Grammarinator from API (as the title suggests) then you should setup and instantiate GeneratorTool yourself and iteratively call its create method, just like the CLI implementation does here and here.

@bendrissou
Copy link
Author

bendrissou commented Oct 4, 2023

Great!

Thank you for the clear answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants