python

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package python provides Python specific functionality for librarian.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add added in v0.11.0

func Add(lib *config.Library) (*config.Library, error)

Add initializes a new Python library with default values.

func BuildClientDocumentationURI added in v0.8.4

func BuildClientDocumentationURI(libraryName, repoMetadataName string) string

BuildClientDocumentationURI builds the URI for the client documentation for the library. TODO(https://github.com/googleapis/librarian/issues/4175): make this function package-private (or inline it) after migration, when we won't need to determine whether or not to specify an override.

func Bump added in v0.8.1

func Bump(output, version string) error

Bump updates the version number in the library with the given output directory.

func Clean added in v0.8.4

func Clean(lib *config.Library) error

Clean removes all generated code from beneath the given library's output directory. If the output directory does not currently exist, this function is a no-op.

func DefaultLibraryName added in v0.8.1

func DefaultLibraryName(api string) string

DefaultLibraryName derives a library name from an API path by stripping the version suffix and replacing "/" with "-". For example: "google/cloud/secretmanager/v1" -> "google-cloud-secretmanager".

func DefaultOutput added in v0.8.4

func DefaultOutput(name, defaultOutput string) string

DefaultOutput derives an output path from a library name and a default output directory. Currently, this just assumes each library is a directory directly underneath the default output directory.

func Fill added in v0.11.0

func Fill(library *config.Library) (*config.Library, error)

Fill populates empty Python-specific fields. Library configurations takes precedence.

func FindExistingLibraryForNewAPI added in v0.12.0

func FindExistingLibraryForNewAPI(libraries []*config.Library, apiPath string) *config.Library

FindExistingLibraryForNewAPI attempts to find an existing library that should contain the given new API path. This function uses the concept of a "versionless" path, which is just the path with any version removed (so the versionless path of google/cloud/xyz/v1 is google/cloud/xyz/; the versionless path of google/cloud/xyz/type is still google/cloud/xyz/type). A nil pointer is returned if no existing library is suitable for the new API path. The function observes the following rules:

  1. If the versionless path of any path in the library is the same as the versionless apiPath, that library is returned.
  2. If the versionless path of any path in the library is a prefix of apiPath *and* the library contains multiple different versionless paths, that library is returned.
  3. Otherwise, nil is returned.

func Generate

func Generate(ctx context.Context, cfg *config.Config, library *config.Library, srcs *sources.Sources) error

Generate generates a Python client library.

func Install added in v0.10.0

func Install(ctx context.Context) error

Install installs Python pip tool dependencies.

func Tidy added in v0.11.0

func Tidy(lib *config.Library) *config.Library

Tidy tidies configuration for a library.

func ValidateNewAPIs added in v0.11.0

func ValidateNewAPIs(lib *config.Library) error

ValidateNewAPIs validates that new APIs can be added to an existing library. Currently this is just a check that there is a default version already, and that no existing APIs in the library have custom GAPIC options. Future checks may require details of the APIs being added.

Types

This section is empty.

Jump to

Keyboard shortcuts

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