Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
system.py51 linesDownload Raw Back to cli
1# Copyright 2022 The HuggingFace Team. All rights reserved.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 at6#7#     http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# 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 and13# limitations under the License.14"""Contains commands to print information about the environment and version."""15 16import typer17 18from huggingface_hub import __version__19 20from ..utils import dump_environment_info21from ._cli_utils import _fetch_latest_pypi_version, run_update22from ._output import out23 24 25def env() -> None:26    """Print information about the environment."""27    dump_environment_info()28 29 30def version() -> None:31    """Print information about the hf version."""32    print(__version__)33 34 35def update() -> None:36    """Update the `hf` CLI to the latest version."""37    out.text(f"Current version: {__version__}")38    out.text("Checking for updates to latest version...")39    latest_version = _fetch_latest_pypi_version("huggingface_hub")40    if latest_version is not None and __version__ == latest_version:41        out.text(f"hf is up to date ({__version__})")42        return43 44    returncode = run_update()45    if returncode != 0:46        raise typer.Exit(code=returncode)47    out.hint(48        "You may also want to run `hf skills upgrade` to refresh any installed skills "49        "so your AI agent sees the latest command surface."50    )51 
codekingpro/portable-devtools · Team Ai