datacommons-cli 0.0.2__tar.gz → 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: datacommons-cli
3
+ Version: 1.0.0
4
+ Summary: Data Commons CLI
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/datacommonsorg/datacommons
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: click>=8.1.7
10
+ Requires-Dist: datacommons-admin
11
+
12
+ # Data Commons CLI
13
+
14
+ <p align="center">
15
+ <a href="https://www.datacommons.org"><img src="https://datacommons.org/images/dc-logo.svg" alt="Data Commons" width="120"></a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <em>Standard command-line interface for interacting with, deploying, and administering the Data Commons Platform.</em>
20
+ </p>
21
+
22
+ ---
23
+
24
+ [Data Commons](https://www.datacommons.org) is an open-source project initiated by Google that aggregates data from hundreds of public sources, such as the US Census, Eurostat, CDC, and UN, into a unified, standard Knowledge Graph.
25
+
26
+ The **Data Commons Platform** provides the infrastructure to run your own private instance of Data Commons, allowing you to seamlessly combine public datasets with your own custom, private data using modern APIs, graph query engines, and visualization dashboards.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ Install the Data Commons CLI using `pip` or `uv`:
33
+
34
+ ### Install with `pip`
35
+
36
+ ```bash
37
+ pip install --user datacommons-cli
38
+ ```
39
+
40
+ If the datacommons command is not found after installing, add Python's user-binary directory to your PATH:
41
+
42
+ ```
43
+ export PATH="$PATH:$(python3 -m site --user-base)/bin"
44
+ ```
45
+
46
+ ### Install with `uv`
47
+
48
+ ```bash
49
+ uv tool install datacommons-cli
50
+ ```
51
+
52
+ If the `datacommons` command is not found after installing, add the appropriate directory to your PATH:
53
+
54
+ ```
55
+ export PATH="~/.local/bin:$PATH"
56
+ ```
57
+
58
+ ### With `uvx`
59
+
60
+ Or execute `datacommons-cli` on-the-fly without installation using `uvx`:
61
+
62
+ ```bash
63
+ uvx datacommons-cli --help
64
+ ```
65
+
66
+ ## Help & Documentation
67
+
68
+ For full documentation, tutorials, and deployment guides, visit:
69
+ 👉 **[docs.datacommons.org](https://docs.datacommons.org)**
70
+
71
+ ---
72
+
73
+ ## Usage
74
+
75
+ The CLI exposes standard operations under the main `datacommons` entrypoint. You can check the version and get help instantly:
76
+
77
+ ```bash
78
+ # Show help menu
79
+ datacommons --help
80
+
81
+ # Show version
82
+ datacommons --version
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Administrative Commands
88
+
89
+ All infrastructure setup, database operations, and ingestion pipelines are managed under the `admin` sub-command group:
90
+
91
+ ```bash
92
+ datacommons admin [COMMAND] --help
93
+ ```
94
+
95
+ ### Available Commands
96
+
97
+ | Command | Description |
98
+ | --- | --- |
99
+ | **`init`** | Scaffolds a localized Terraform configuration to deploy the Data Commons Platform on Google Cloud Platform (GCP). |
100
+ | **`init-db`** | Configures database schemas and seeds baseline tables on GCP Spanner via the Ingestion Helper service. |
101
+ | **`seed-db`** | Re-runs or updates base geographic and schema seeds on GCP Spanner. |
102
+ | **`ingest start`** | Triggers a Cloud Run + Cloud Workflows background data ingestion pipeline to import your custom datasets. |
103
+ | **`ingest show-config`**| Prints current background ingestion parameters, GCS bucket paths, and active GCP credentials. |
104
+
105
+ ### Quickstart: Scaffolding a Private Data Commons
106
+
107
+ 1. Initialize your project configuration and scaffold Terraform templates:
108
+ ```bash
109
+ datacommons admin init --project-id my-gcp-project --namespace prod
110
+ ```
111
+
112
+ 2. Change directories to the scaffolded directory (e.g. `cd prod`).
113
+
114
+ 3. Initialize and deploy your GCP infrastructure with Terraform:
115
+ ```bash
116
+ terraform init
117
+ terraform apply
118
+ ```
119
+
120
+ 4. Initialize and seed your Spanner database:
121
+ ```bash
122
+ datacommons admin init-db
123
+ ```
124
+
125
+ 5. Trigger the data ingestion pipeline:
126
+ ```bash
127
+ datacommons admin ingest start
128
+ ```
129
+
130
+ ---
131
+
132
+ License: [Apache-2.0](https://github.com/datacommonsorg/datacommons/blob/main/LICENSE)
@@ -0,0 +1,121 @@
1
+ # Data Commons CLI
2
+
3
+ <p align="center">
4
+ <a href="https://www.datacommons.org"><img src="https://datacommons.org/images/dc-logo.svg" alt="Data Commons" width="120"></a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <em>Standard command-line interface for interacting with, deploying, and administering the Data Commons Platform.</em>
9
+ </p>
10
+
11
+ ---
12
+
13
+ [Data Commons](https://www.datacommons.org) is an open-source project initiated by Google that aggregates data from hundreds of public sources, such as the US Census, Eurostat, CDC, and UN, into a unified, standard Knowledge Graph.
14
+
15
+ The **Data Commons Platform** provides the infrastructure to run your own private instance of Data Commons, allowing you to seamlessly combine public datasets with your own custom, private data using modern APIs, graph query engines, and visualization dashboards.
16
+
17
+ ---
18
+
19
+ ## Installation
20
+
21
+ Install the Data Commons CLI using `pip` or `uv`:
22
+
23
+ ### Install with `pip`
24
+
25
+ ```bash
26
+ pip install --user datacommons-cli
27
+ ```
28
+
29
+ If the datacommons command is not found after installing, add Python's user-binary directory to your PATH:
30
+
31
+ ```
32
+ export PATH="$PATH:$(python3 -m site --user-base)/bin"
33
+ ```
34
+
35
+ ### Install with `uv`
36
+
37
+ ```bash
38
+ uv tool install datacommons-cli
39
+ ```
40
+
41
+ If the `datacommons` command is not found after installing, add the appropriate directory to your PATH:
42
+
43
+ ```
44
+ export PATH="~/.local/bin:$PATH"
45
+ ```
46
+
47
+ ### With `uvx`
48
+
49
+ Or execute `datacommons-cli` on-the-fly without installation using `uvx`:
50
+
51
+ ```bash
52
+ uvx datacommons-cli --help
53
+ ```
54
+
55
+ ## Help & Documentation
56
+
57
+ For full documentation, tutorials, and deployment guides, visit:
58
+ 👉 **[docs.datacommons.org](https://docs.datacommons.org)**
59
+
60
+ ---
61
+
62
+ ## Usage
63
+
64
+ The CLI exposes standard operations under the main `datacommons` entrypoint. You can check the version and get help instantly:
65
+
66
+ ```bash
67
+ # Show help menu
68
+ datacommons --help
69
+
70
+ # Show version
71
+ datacommons --version
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Administrative Commands
77
+
78
+ All infrastructure setup, database operations, and ingestion pipelines are managed under the `admin` sub-command group:
79
+
80
+ ```bash
81
+ datacommons admin [COMMAND] --help
82
+ ```
83
+
84
+ ### Available Commands
85
+
86
+ | Command | Description |
87
+ | --- | --- |
88
+ | **`init`** | Scaffolds a localized Terraform configuration to deploy the Data Commons Platform on Google Cloud Platform (GCP). |
89
+ | **`init-db`** | Configures database schemas and seeds baseline tables on GCP Spanner via the Ingestion Helper service. |
90
+ | **`seed-db`** | Re-runs or updates base geographic and schema seeds on GCP Spanner. |
91
+ | **`ingest start`** | Triggers a Cloud Run + Cloud Workflows background data ingestion pipeline to import your custom datasets. |
92
+ | **`ingest show-config`**| Prints current background ingestion parameters, GCS bucket paths, and active GCP credentials. |
93
+
94
+ ### Quickstart: Scaffolding a Private Data Commons
95
+
96
+ 1. Initialize your project configuration and scaffold Terraform templates:
97
+ ```bash
98
+ datacommons admin init --project-id my-gcp-project --namespace prod
99
+ ```
100
+
101
+ 2. Change directories to the scaffolded directory (e.g. `cd prod`).
102
+
103
+ 3. Initialize and deploy your GCP infrastructure with Terraform:
104
+ ```bash
105
+ terraform init
106
+ terraform apply
107
+ ```
108
+
109
+ 4. Initialize and seed your Spanner database:
110
+ ```bash
111
+ datacommons admin init-db
112
+ ```
113
+
114
+ 5. Trigger the data ingestion pipeline:
115
+ ```bash
116
+ datacommons admin ingest start
117
+ ```
118
+
119
+ ---
120
+
121
+ License: [Apache-2.0](https://github.com/datacommonsorg/datacommons/blob/main/LICENSE)
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.0.2"
15
+ __version__ = "1.0.0"
@@ -0,0 +1,74 @@
1
+ # Copyright 2025 Google LLC.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import os
16
+
17
+ import click
18
+
19
+ from datacommons_admin.admin_cli import admin as admin_cli
20
+
21
+ from . import __version__
22
+
23
+
24
+ def get_logo_color():
25
+ """Determine the best logo color based on terminal capabilities"""
26
+ colorterm = os.environ.get("COLORTERM", "").lower()
27
+ if colorterm in ("truecolor", "24bit"):
28
+ return (7, 81, 179)
29
+
30
+ term = os.environ.get("TERM", "").lower()
31
+ if "256color" in term or colorterm:
32
+ return 26 # Royal blue color index in 256-color palette
33
+
34
+ return "blue"
35
+
36
+
37
+ class CustomGroup(click.Group):
38
+ """Custom click.Group to preserve logo formatting and newlines in help text"""
39
+
40
+ def format_help_text(self, ctx, formatter):
41
+ if self.help:
42
+ formatter.write_paragraph()
43
+ with formatter.indentation():
44
+ for line in self.help.splitlines():
45
+ if line:
46
+ formatter.write(f"{' ' * formatter.current_indent}{line}\n")
47
+ else:
48
+ formatter.write("\n")
49
+
50
+
51
+ def cli_help() -> str:
52
+ """Return help string for the CLI"""
53
+ logo = (
54
+ " ██████╗ ██████╗\n"
55
+ " ██╔══██╗ ██╔════╝\n"
56
+ " ██║ ██║ ██║ \n"
57
+ " ██║ ██║ ██║ \n"
58
+ " ██████╔╝ ╚██████╗\n"
59
+ " ╚═════╝ ╚═════╝"
60
+ )
61
+ styled_logo = click.style(logo, fg=get_logo_color(), bold=True)
62
+ version_str = click.style(f"v{__version__}", fg="bright_black")
63
+ return f"{styled_logo}\n\nData Commons CLI {version_str}"
64
+
65
+
66
+ @click.group(cls=CustomGroup, help=cli_help())
67
+ @click.version_option(version=__version__, prog_name="Data Commons CLI")
68
+ def cli():
69
+ """Data Commons CLI"""
70
+ pass
71
+
72
+
73
+ # Add admin CLI commands to the main CLI
74
+ cli.add_command(admin_cli)
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: datacommons-cli
3
+ Version: 1.0.0
4
+ Summary: Data Commons CLI
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/datacommonsorg/datacommons
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: click>=8.1.7
10
+ Requires-Dist: datacommons-admin
11
+
12
+ # Data Commons CLI
13
+
14
+ <p align="center">
15
+ <a href="https://www.datacommons.org"><img src="https://datacommons.org/images/dc-logo.svg" alt="Data Commons" width="120"></a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <em>Standard command-line interface for interacting with, deploying, and administering the Data Commons Platform.</em>
20
+ </p>
21
+
22
+ ---
23
+
24
+ [Data Commons](https://www.datacommons.org) is an open-source project initiated by Google that aggregates data from hundreds of public sources, such as the US Census, Eurostat, CDC, and UN, into a unified, standard Knowledge Graph.
25
+
26
+ The **Data Commons Platform** provides the infrastructure to run your own private instance of Data Commons, allowing you to seamlessly combine public datasets with your own custom, private data using modern APIs, graph query engines, and visualization dashboards.
27
+
28
+ ---
29
+
30
+ ## Installation
31
+
32
+ Install the Data Commons CLI using `pip` or `uv`:
33
+
34
+ ### Install with `pip`
35
+
36
+ ```bash
37
+ pip install --user datacommons-cli
38
+ ```
39
+
40
+ If the datacommons command is not found after installing, add Python's user-binary directory to your PATH:
41
+
42
+ ```
43
+ export PATH="$PATH:$(python3 -m site --user-base)/bin"
44
+ ```
45
+
46
+ ### Install with `uv`
47
+
48
+ ```bash
49
+ uv tool install datacommons-cli
50
+ ```
51
+
52
+ If the `datacommons` command is not found after installing, add the appropriate directory to your PATH:
53
+
54
+ ```
55
+ export PATH="~/.local/bin:$PATH"
56
+ ```
57
+
58
+ ### With `uvx`
59
+
60
+ Or execute `datacommons-cli` on-the-fly without installation using `uvx`:
61
+
62
+ ```bash
63
+ uvx datacommons-cli --help
64
+ ```
65
+
66
+ ## Help & Documentation
67
+
68
+ For full documentation, tutorials, and deployment guides, visit:
69
+ 👉 **[docs.datacommons.org](https://docs.datacommons.org)**
70
+
71
+ ---
72
+
73
+ ## Usage
74
+
75
+ The CLI exposes standard operations under the main `datacommons` entrypoint. You can check the version and get help instantly:
76
+
77
+ ```bash
78
+ # Show help menu
79
+ datacommons --help
80
+
81
+ # Show version
82
+ datacommons --version
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Administrative Commands
88
+
89
+ All infrastructure setup, database operations, and ingestion pipelines are managed under the `admin` sub-command group:
90
+
91
+ ```bash
92
+ datacommons admin [COMMAND] --help
93
+ ```
94
+
95
+ ### Available Commands
96
+
97
+ | Command | Description |
98
+ | --- | --- |
99
+ | **`init`** | Scaffolds a localized Terraform configuration to deploy the Data Commons Platform on Google Cloud Platform (GCP). |
100
+ | **`init-db`** | Configures database schemas and seeds baseline tables on GCP Spanner via the Ingestion Helper service. |
101
+ | **`seed-db`** | Re-runs or updates base geographic and schema seeds on GCP Spanner. |
102
+ | **`ingest start`** | Triggers a Cloud Run + Cloud Workflows background data ingestion pipeline to import your custom datasets. |
103
+ | **`ingest show-config`**| Prints current background ingestion parameters, GCS bucket paths, and active GCP credentials. |
104
+
105
+ ### Quickstart: Scaffolding a Private Data Commons
106
+
107
+ 1. Initialize your project configuration and scaffold Terraform templates:
108
+ ```bash
109
+ datacommons admin init --project-id my-gcp-project --namespace prod
110
+ ```
111
+
112
+ 2. Change directories to the scaffolded directory (e.g. `cd prod`).
113
+
114
+ 3. Initialize and deploy your GCP infrastructure with Terraform:
115
+ ```bash
116
+ terraform init
117
+ terraform apply
118
+ ```
119
+
120
+ 4. Initialize and seed your Spanner database:
121
+ ```bash
122
+ datacommons admin init-db
123
+ ```
124
+
125
+ 5. Trigger the data ingestion pipeline:
126
+ ```bash
127
+ datacommons admin ingest start
128
+ ```
129
+
130
+ ---
131
+
132
+ License: [Apache-2.0](https://github.com/datacommonsorg/datacommons/blob/main/LICENSE)
@@ -1,9 +1,11 @@
1
+ README.md
1
2
  pyproject.toml
3
+ datacommons_cli/__init__.py
2
4
  datacommons_cli/cli.py
3
- datacommons_cli/version.py
4
5
  datacommons_cli.egg-info/PKG-INFO
5
6
  datacommons_cli.egg-info/SOURCES.txt
6
7
  datacommons_cli.egg-info/dependency_links.txt
7
8
  datacommons_cli.egg-info/entry_points.txt
8
9
  datacommons_cli.egg-info/requires.txt
9
- datacommons_cli.egg-info/top_level.txt
10
+ datacommons_cli.egg-info/top_level.txt
11
+ tests/test_cli.py
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
2
  datacommons = datacommons_cli.cli:cli
3
+ datacommons-cli = datacommons_cli.cli:cli
@@ -16,6 +16,7 @@ urls = {Homepage = "https://github.com/datacommonsorg/datacommons"}
16
16
 
17
17
  [project.scripts]
18
18
  datacommons = "datacommons_cli.cli:cli"
19
+ datacommons-cli = "datacommons_cli.cli:cli"
19
20
 
20
21
  [build-system]
21
22
  requires = ["uv", "setuptools"]
@@ -25,4 +26,4 @@ build-backend = "setuptools.build_meta"
25
26
  include-package-data = true
26
27
 
27
28
  [tool.setuptools.dynamic]
28
- version = {attr = "datacommons_cli.version.__version__"}
29
+ version = {attr = "datacommons_cli.__version__"}
@@ -1,4 +1,4 @@
1
- # Copyright 2025 Google LLC.
1
+ # Copyright 2026 Google LLC.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -12,16 +12,19 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- import click
15
+ from click.testing import CliRunner
16
+ from datacommons_cli.cli import cli, __version__
16
17
 
17
- from datacommons_admin.admin_cli import admin as admin_cli
18
18
 
19
+ def test_cli_version() -> None:
20
+ runner = CliRunner()
21
+ result = runner.invoke(cli, ["--version"])
22
+ assert result.exit_code == 0
23
+ assert f"Data Commons CLI, version {__version__}" in result.output
19
24
 
20
- @click.group()
21
- def cli():
22
- """Datacommons CLI suite"""
23
- pass
24
25
 
25
-
26
- # Add schema CLI commands to the main CLI
27
- cli.add_command(admin_cli)
26
+ def test_cli_help() -> None:
27
+ runner = CliRunner()
28
+ result = runner.invoke(cli, ["--help"])
29
+ assert result.exit_code == 0
30
+ assert "Data Commons CLI" in result.output
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: datacommons-cli
3
- Version: 0.0.2
4
- Summary: Data Commons CLI
5
- License-Expression: Apache-2.0
6
- Project-URL: Homepage, https://github.com/datacommonsorg/datacommons
7
- Requires-Python: >=3.11
8
- Description-Content-Type: text/markdown
9
- Requires-Dist: click>=8.1.7
10
- Requires-Dist: datacommons-admin
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: datacommons-cli
3
- Version: 0.0.2
4
- Summary: Data Commons CLI
5
- License-Expression: Apache-2.0
6
- Project-URL: Homepage, https://github.com/datacommonsorg/datacommons
7
- Requires-Python: >=3.11
8
- Description-Content-Type: text/markdown
9
- Requires-Dist: click>=8.1.7
10
- Requires-Dist: datacommons-admin