Skip to content

Commit 0ddb184

Browse files
authored
docs(app-namespace): add documentation for app namespace (#499)
1 parent 8cb66bd commit 0ddb184

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

docs/docs/core/cli.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ You may also provide a `cocoindex_cmd` argument to the `main_fn` decorator to ch
4141

4242
### Explicitly CLI Invoke
4343

44-
An alterntive way is to use `cocoindex.cli.cli` (with type [`click.Group`](https://click.palletsprojects.com/en/stable/api/#click.Group)).
44+
An alternative way is to use `cocoindex.cli.cli` (with type [`click.Group`](https://click.palletsprojects.com/en/stable/api/#click.Group)).
4545
For example, you may invoke the CLI explicitly with additional arguments:
4646

4747
<Tabs>
@@ -60,7 +60,7 @@ The following subcommands are available:
6060

6161
| Subcommand | Description |
6262
| ---------- | ----------- |
63-
| `ls` | List all flows. |
63+
| `ls` | List all flows present in the current process. Or list all persisted flows under the current app namespace if `--all` is specified. |
6464
| `show` | Show the spec for a specific flow. |
6565
| `setup` | Check and apply backend setup changes for flows, including the internal and target storage (to export). |
6666
| `drop` | Drop the backend setup for specified flows. |

docs/docs/core/initialization.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,19 @@ if __name__ == "__main__":
8383

8484
`cocoindex.Settings` is used to configure the CocoIndex library. It's a dataclass that contains the following fields:
8585

86+
* `app_namespace` (type: `str`, required): The namespace of the application.
8687
* `database` (type: `DatabaseConnectionSpec`, required): The connection to the Postgres database.
8788

89+
### App Namespace
90+
91+
The `app_namespace` field helps organize flows across different environments (e.g., testing, production) or teams. When set, it prefixes flow names with the namespace.
92+
93+
For example, if the namespace is "Staging", for a flow with name specified as `Flow1` in code, the full name of the flow will be `Staging.Flow1`.
94+
95+
If not set, all flows are in a default unnamed namespace.
96+
97+
You can also control it by the `COCOINDEX_APP_NAMESPACE` environment variable.
98+
8899
### DatabaseConnectionSpec
89100

90101
`DatabaseConnectionSpec` configures the connection to a database. Only Postgres is supported for now. It has the following fields:
@@ -116,6 +127,7 @@ Each setting field has a corresponding environment variable:
116127

117128
| environment variable | corresponding field in `Settings` | required? |
118129
|---------------------|-------------------|----------|
130+
| `COCOINDEX_APP_NAMESPACE` | `app_namespace` | No |
119131
| `COCOINDEX_DATABASE_URL` | `database.url` | Yes |
120132
| `COCOINDEX_DATABASE_USER` | `database.user` | No |
121133
| `COCOINDEX_DATABASE_PASSWORD` | `database.password` | No |

python/cocoindex/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def cli():
1616
@cli.command()
1717
@click.option(
1818
"-a", "--all", "show_all", is_flag=True, show_default=True, default=False,
19-
help="Also show all flows with persisted setup, even if not defined in the current process.")
19+
help="Also show all flows with persisted setup under the current app namespace, even if not defined in the current process.")
2020
def ls(show_all: bool):
2121
"""
2222
List all flows.

0 commit comments

Comments
 (0)