google/yapf 源码下载与部署教程

项目概述

A formatter for Python files

项目地址

https://github.com/google/yapf

项目页面预览

google/yapf preview

关键指标

  • Stars:13978
  • 主要语言:Python
  • License:Apache License 2.0
  • 最近更新:2025-12-15T04:04:54Z
  • 默认分支:main

本站高速下载(国内可用)

点击下载(本站镜像)
– SHA256:5c390f09cd77aaf0deaaeeb2bae60f8254021972b002ff742d21b114dd5a0e3d

安装部署要点(README 精选)

Installation

To install YAPF from PyPI:

$ pip install yapf

YAPF is still considered in “beta” stage, and the released version may change
often; therefore, the best way to keep up-to-date with the latest development
is to clone this repository or install directly from github:

$ pip install git+https://github.com/google/yapf.git

Note that if you intend to use YAPF as a command-line tool rather than as a
library, installation is not necessary. YAPF supports being run as a directory
by the Python interpreter. If you cloned/unzipped YAPF into DIR, it’s
possible to run:

$ PYTHONPATH=DIR python DIR/yapf [options] ...

Usage

usage: yapf [-h] [-v] [-d | -i | -q] [-r | -l START-END] [-e PATTERN]
            [--style STYLE] [--style-help] [--no-local-style] [-p] [-m] [-vv]
            [files ...]

Formatter for Python code.

positional arguments:
  files                 reads from stdin when no files are specified.

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -d, --diff            print the diff for the fixed source
  -i, --in-place        make changes to files in place
  -q, --quiet           output nothing and set return value
  -r, --recursive       run recursively over directories
  -l START-END, --lines START-END
                        range of lines to reformat, one-based
  -e PATTERN, --exclude PATTERN
                        patterns for files to exclude from formatting
  --style STYLE         specify formatting style: either a style name (for
                        example "pep8" or "google"), or the name of a file
                        with style settings. The default is pep8 unless a
                        .style.yapf or setup.cfg or pyproject.toml file
                        located in the same directory as the source or one of
                        its parent directories (for stdin, the current
                        directory is used).
  --style-help          show style settings and exit; this output can be saved
                        to .style.yapf to make your settings permanent
  --no-local-style      don't search for local style definition
  -p, --parallel        run YAPF in parallel when formatting multiple files.
  -m, --print-modified  print out file names of modified files
  -vv, --verbose        print out file names while processing

常用命令(从 README 提取)

$ pip install yapf

$ pip install git+https://github.com/google/yapf.git

$ PYTHONPATH=DIR python DIR/yapf [options] ...

通用部署说明

  1. 下载源码并阅读 README
  2. 安装依赖(pip/npm/yarn 等)
  3. 配置环境变量(API Key、模型路径、数据库等)
  4. 启动服务并测试访问
  5. 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)

免责声明与版权说明

本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容