LLMpediaThe first transparent, open encyclopedia generated by LLMs

Google Python Style Guide

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: Black (software) Hop 5
Expansion Funnel Raw 129 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted129
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
Google Python Style Guide
NameGoogle Python Style Guide
SubjectCoding standards
PublisherGoogle
First pub2008
LanguageEnglish

Google Python Style Guide The Google Python Style Guide is an internal coding standard used to shape Python source code at Google. It codifies conventions for naming, layout, documentation, testing, and tooling to promote consistency across large codebases maintained by teams such as Sundar Pichai, Larry Page, Sergey Brin, Eric Schmidt, Amit Singhal and organizations like Alphabet Inc., DeepMind, YouTube, Android (operating system), Waymo. Influential in both industry and academia, the guide interacts with wider ecosystems including Python (programming language), CPython, PEP 8, NumPy, TensorFlow and projects from Mozilla Foundation, Microsoft, Facebook, Amazon (company).

Overview

The guide prescribes stylistic and structural norms to aid readability and maintainability across products such as Gmail, Google Search, Google Maps, Google Drive, Google Photos, Google Ads, Google Cloud Platform, Google Play, Chrome (web browser), Chromium, Kubernetes, Istio, Borg (software). It complements language-specific standards like PEP 8 and tools created by entities including Guido van Rossum, Raymond Hettinger, Brett Cannon, Python Software Foundation, OpenAI, Reddit, Stack Overflow, GitHub.

Naming Conventions

Identifiers follow descriptive, consistent patterns influenced by practices at Sun Microsystems, Oracle Corporation, IBM, Intel Corporation, NVIDIA, AMD, ARM Holdings, Cisco Systems, Dell Technologies. Module, package, class, function, method, constant, and variable names are chosen to reflect intent and interoperability with libraries such as NumPy, Pandas, SciPy, Matplotlib, Django, Flask, Celery, SQLAlchemy. Public API names consider compatibility with ecosystems represented by Android (operating system), iOS, Windows, macOS, Linux kernel, Debian, Ubuntu (operating system), while avoiding conflicts with trademarks like Intel Corporation or Microsoft.

Code Layout and Formatting

Formatting is intended for consistency across contributions from teams including Site Reliability Engineering, Google Research, Google Brain, Waymo, Verily. Line length, indentation, blank lines, imports ordering, and string quoting are governed to align with precedent from PEP 8 and tools from Black (software), isort, Flake8, PyLint, Mypy. The guide prescribes import grouping similar to practices used at Red Hat, Canonical (company), SUSE, IBM and in projects like Kubernetes, TensorFlow, OpenStack.

Programming Recommendations and Best Practices

Recommendations emphasize clarity, simplicity, and robustness, mirroring engineering habits at Bell Labs, AT&T, NASA, European Space Agency, CERN, MIT, Stanford University, Harvard University, Carnegie Mellon University, Caltech. Best practices address error handling, resource management, concurrency, and performance for applications ranging from Google Search indexing to Waymo autonomy stacks and integration with frameworks such as gRPC, Protocol Buffers, Thrift, RESTful API patterns. Security-conscious guidance echoes standards from National Institute of Standards and Technology, ISO, IETF, OWASP.

Documentation and Docstrings

Docstrings and inline documentation are required for public interfaces, shaped by documentation styles seen in NumPy, Sphinx (documentation tool), Javadoc, Doxygen, Read the Docs, Confluence. Guidance ensures compatibility with tooling used by teams like Google Cloud Platform and Google Analytics, and with publication venues including ACM, IEEE, ArXiv and conferences such as NeurIPS, ICML, SIGMOD, KDD.

Testing and Type Checking

Testing strategy emphasizes unit tests, integration tests, and continuous integration, reflecting practices at Travis CI, CircleCI, Jenkins, Bazel (build tool), Kokoro (Google), and repositories on GitHub, GitLab, Bitbucket. Type checking and gradual typing recommendations complement Mypy and static analysis approaches used by projects like TensorFlow, PyTorch, Scikit-learn and research groups at Google Research, OpenAI, Microsoft Research.

Tooling and Automation

The guide assumes integration with build and automation systems from Bazel (build tool), Make (software), Gradle, Maven, Buck (build system), and CI/CD infrastructures adopted by Google Cloud Platform, Amazon Web Services, Microsoft Azure, IBM Cloud. Linting, formatting, dependency management, release automation, and code review workflows align with practices at GitHub, Gerrit, Phabricator, Puppet (software), Chef (software), Ansible.

Category:Programming style guides