govpkg
A simple Python client for the official pkg.go.dev v1beta API.
Installation
pip install govpkg
Usage
Search for a package
from govpkg import get
url = get("cobra")
print(url)
Get package metadata
from govpkg import package
pkg = package("github.com/spf13/cobra")
print(pkg)
You can also pass a pkg.go.dev URL:
pkg = package("https://pkg.go.dev/github.com/spf13/cobra")
Get module metadata
from govpkg import module
mod = module("github.com/spf13/cobra")
print(mod)
Or using a pkg.go.dev URL:
mod = module("https://pkg.go.dev/github.com/spf13/cobra")
API
get(query: str) -> str
Searches for a Go package and returns the pkg.go.dev URL of the best match.
package(path: str) -> dict
Returns metadata for a Go package.
module(path: str) -> dict
Returns metadata for the Go module containing the package.
Requirements
License
MIT