import { type Coverage } from '../analyzers/tools/coverage';
import type { LanguageSupport } from './types';
/**
 * Pure parser for `pip show pkg1 pkg2 ...` output. pip-show returns
 * RFC-822-ish blocks separated by `---` with `Key: Value` lines. The
 * fields we need:
 *
 *   Name: foo
 *   Requires: a, b, c
 *   Required-by: x, y
 *
 * Empty `Required-by` identifies a package that nothing else in the
 * env depends on — conventionally a directly-installed (top-level)
 * package. Extracted so the builder below can be unit-tested without
 * a live pip invocation.
 */
export declare function parsePipShowOutput(raw: string): Map<string, {
    requires: string[];
    requiredBy: string[];
}>;
/**
 * BFS the parsed pip-show graph to produce a per-package-name index of
 * its top-level ancestors. Top-levels are packages with empty
 * `Required-by` — nothing else in the environment depends on them, so
 * they were installed as direct deps.
 *
 * Pure function; testable with fabricated graphs.
 */
export declare function buildPyTopLevelDepIndex(graph: Map<string, {
    requires: string[];
    requiredBy: string[];
}>): Map<string, string[]>;
/**
 * Parse a `requirements.txt`-style file into the set of direct (top-
 * level) package names. Used as a fallback when no venv is available
 * for the pip-show-based dep graph. Handles common requirement-spec
 * shapes:
 *
 *   requests==2.20.0           → 'requests'
 *   requests>=2.20,<3          → 'requests'
 *   Django                     → 'django'  (lowercased to match pip-audit)
 *   # comment                  → skipped
 *   -r other.txt               → skipped (recursive include not followed)
 *   -e .                       → skipped
 *   pkg ; python_version<'3'   → 'pkg'  (env-marker stripped)
 *   pkg[extra1,extra2]         → 'pkg'  (extras stripped)
 *
 * Names are lowercased to match pip-audit's canonical-PyPI casing
 * convention. Returns deduplicated names in the order they appear.
 */
export declare function parseRequirementsTxtTopLevels(raw: string): string[];
/** coverage.py JSON: `{ "totals": {...}, "files": { "path": { summary: {...} } } }`. */
export declare function parseCoveragePy(raw: string, sourceFile: string, cwd: string): Coverage;
/**
 * Capture Python module specifiers from source text. Handles both
 * `from X import Y` and bare `import X, Y as Z` forms. Exported so
 * unit tests can exercise it directly; the imports capability batches
 * it across all .py files under the repo.
 */
export declare function extractPyImportsRaw(content: string): string[];
/**
 * Resolve a Python import specifier to an in-project file path, or null
 * for unresolvable / stdlib / external references. Handles relative
 * specifiers (leading dots) and absolute-from-project-root imports.
 * Exported for unit testing.
 */
export declare function resolvePyImportRaw(fromFile: string, spec: string, cwd: string): string | null;
/**
 * Locate the project's own Python interpreter.
 *
 * Detection order (fail-cheap first, subprocess last):
 *   1. `./.venv` or `./venv` under cwd  — uv default, in-project
 *      poetry (`virtualenvs.in-project = true`), hand-rolled venvs.
 *      Zero-cost stat() checks.
 *   2. `$VIRTUAL_ENV` env var — set by `source .venv/bin/activate`
 *      and poetry shell. Catches externally-activated envs.
 *   3. `poetry env info --path` — external poetry venvs
 *      (default `virtualenvs.in-project = false` on most installs;
 *      env lives in `~/.cache/pypoetry/virtualenvs/<hash>`).
 *   4. `pipenv --venv` — pipenv default stores elsewhere too.
 *
 * Returns null if no venv is resolvable — the provider then skips
 * cleanly rather than falling through to pip-licenses's install env
 * (which would report dxkit's own packages, not the project's).
 */
export declare function findPyProjectVenvPython(cwd: string): string | null;
export declare const python: LanguageSupport;
//# sourceMappingURL=python.d.ts.map