pyread

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pyread reads Python source for the env and outbound plugins: the environment variable names the code reads and the public hosts it calls, is configured for, or mentions. A tokenizer that follows Python's lexical grammar (lex.go) and patterns on its token stream, as jsread does for TypeScript; the pure-Go Python parsers stop at Python 3.4. Nothing is executed or imported. See https://cernly.dev/how/plugins/.

Index

Constants

View Source
const (
	Mention = "mention"
	Default = "default"
	Request = "request"
)

Usage grades, as for Go and TypeScript.

Variables

This section is empty.

Functions

func Manifest

func Manifest(p string) bool

Manifest reports a Python manifest file: pyproject.toml, requirements*.txt, setup.py or setup.cfg.

func Source

func Source(p string) bool

Source reports the files the reader takes: Python sources, not tests.

func Unit

func Unit(units map[string]bool, file string) string

Unit is the folder of the nearest Python manifest, the unit deps-python uses, or ".".

func Units

func Units(files []string) map[string]bool

Units is the set of folders that hold a Python manifest.

Types

type Env

type Env struct {
	Name string
	Line int
	How  string // "" for a direct read; "settings" for a pydantic BaseSettings field
}

type Host

type Host struct {
	Host  string
	Usage string
	Line  int
}

type Result

type Result struct {
	Env   []Env
	Hosts []Host
}

func Read

func Read(r *repo.Repo, file string, src []byte) (Result, error)

Read reads one file. The result is cached for the scan by path and content, since the env and outbound plugins both read every file.

Jump to

Keyboard shortcuts

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