-
Notifications
You must be signed in to change notification settings - Fork 82
feat: create standalone CLI for cocoindex #485
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
Conversation
Really awesome! Thanks for making this happen! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing I just notice - which will be needed by migrating existing examples - is about loading of the .env
files.
Previously they're loaded by examples' main module (under the if __name__ == "__main__":
condition), but they're no longer executed when we invoke this standalone CLI.
So I think this standalone CLI may need to be able to load .env
file, and we may also add a --env_file
flag to allow override (example: flask CLI is doing the similar).
Let me know if you have any other thoughts. Thanks!
Nice catch! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for making it happen! This is a big thing!
Thanks for all the help along the way! I've created another PR accounting for the docs' changes to the standalone CLI. |
* feat(flow): update text label to handle empty lines instead of color style * feat: update to use standalone cocoindex cli * feat: pass in `<module_path>:<flow_name>` directly in new CLI * feat: only show relevant flows given ls targets * feat: add function to parse app target and warn on flow name usage * feat: add support for loading dot-env files * feat: use `find_dotenv` for better path resolution
This is a breaking change, and may resolve #417.
We create a standalone CLI for cocoindex. For compatibility reasons, we mark
main_fn
as deprecated. So, users can still use@cocoindex.main_fn()
in their programs, but when runningpython main.py cocoindex <command>
, the deprecation warning will be shown instead.Now, in the new CLI, we will use
cocoindex <command> [options] --app main.py
to run the CLI program directly.A lot of examples and docs will then be outdated and need to be updated accordingly. I will start on those if all the changes in this PR are confirmed.