Help us shape the future of Go! Take the 2026 Go Developer Survey

python

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package python declares the Python language:

  • its extensions, project manifests, comment forms and test files
  • its visibility rule, which PEP 8 states
  • its tree-sitter grammar and tags query
  • pyright, its language server

A composition root calls Register, which adds Python to a registry and its engines to a catalogue.

Dependency position

Imports the standard library, core/engine, core/sema, core/source, lang, lang/engines, lang/lsp, lang/treesitter and the tree-sitter grammar of Python. It does not import another language module.

Index

Constants

View Source
const Language source.Language = "python"

Language is the language this module declares. Every sema.ID of a Python declaration contains it, so a change invalidates the IDs an index has stored.

Variables

This section is empty.

Functions

func Declaration

func Declaration() lang.Declaration

Declaration returns the declaration of Python, with the visibility rule of PEP 8 and the test files of pytest.

func Grammar

func Grammar() treesitter.Grammar

Grammar returns the tree-sitter grammar of Python with the tags query of the module.

func IsTest

func IsTest(p string) bool

IsTest reports whether p is a test file by the default patterns of pytest: a base name that starts with test_ or ends in _test.py.

func Register

func Register(w lang.Workspace, r *lang.Registry, c *engine.Catalog) error

Register adds Python to r and its engines to c: the tree-sitter engine, and pyright for a workspace on disk.

func Server

func Server() lsp.Server

Server returns the declaration of pyright, the type checker of the Python extension of Visual Studio Code.

func Visibility

func Visibility(name string) sema.Visibility

Visibility returns the visibility that PEP 8 gives a name. A leading underscore marks a name as internal, so Visibility returns sema.Unexported for it. A special name such as __init__ belongs to a protocol of the language, so Visibility returns sema.Exported for it, as for every other name. It returns sema.VisibilityUnknown for an empty name.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL