Skip to content

Conversation

@lemorage
Copy link
Contributor

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 running python 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.

@badmonster0
Copy link
Member

Really awesome! Thanks for making this happen!

Copy link
Member

@badmonster0 badmonster0 left a 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!

@lemorage
Copy link
Contributor Author

Nice catch!

Copy link
Member

@badmonster0 badmonster0 left a 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!

@lemorage
Copy link
Contributor Author

Thanks for all the help along the way! I've created another PR accounting for the docs' changes to the standalone CLI.

@badmonster0 badmonster0 merged commit 93b34e5 into cocoindex-io:main May 20, 2025
6 checks passed
@badmonster0
Copy link
Member

hi @lemorage thank you so much for all your contribution with cocoindex, we love all your contributions and made a section for you on the latest release note https://cocoindex.io/blogs/cocoindex-changelog-2025-05-31/#lemorage

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

Successfully merging this pull request may close these issues.

[FEATURE] Create standalone cocoindex CLI

2 participants