MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / update

Function update

cli-python/datakit_local/cli.py:146–175  ·  view source on GitHub ↗

Check for updates

()

Source from the content-addressed store, hash-verified

144
145@main.command()
146def update():
147 """Check for updates"""
148 click.secho("🔍 Checking for updates...", fg="blue")
149
150 try:
151 # Check PyPI for latest version
152 result = subprocess.run([
153 sys.executable, "-m", "pip", "index", "versions", "datakit-local"
154 ], capture_output=True, text=True, timeout=10)
155
156 if result.returncode == 0:
157 # Parse output to get latest version
158 current_version = get_version("datakit-local")
159
160 click.echo()
161 click.secho(f"Current version: {current_version}", fg="yellow")
162 click.echo()
163 click.secho("To update, run:", fg="blue")
164 click.secho(" pip install --upgrade datakit-local", fg="cyan")
165 click.echo()
166 else:
167 click.secho("⚠️ Could not check for updates", fg="yellow")
168 click.secho("Please check your internet connection", fg="bright_black")
169
170 except subprocess.TimeoutExpired:
171 click.secho("⚠️ Update check timed out", fg="yellow")
172 except Exception as e:
173 click.secho(f"❌ Failed to check for updates: {e}", fg="red")
174
175 click.echo()
176
177
178if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

get_versionFunction · 0.85

Tested by

no test coverage detected