Package org.openrewrite.python
Class RequirementsTxtParser
java.lang.Object
org.openrewrite.python.RequirementsTxtParser
- All Implemented Interfaces:
org.openrewrite.Parser
Parser for requirements.txt files that delegates to
PlainTextParser and attaches a
PythonResolutionResult marker with dependency metadata resolved via uv pip freeze.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.openrewrite.Parser
org.openrewrite.Parser.Input -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuilder()Convert resolved dependencies into declared (direct) dependencies.parseFreezeOutput(Path workspace) Stream<org.openrewrite.SourceFile> parseInputs(Iterable<org.openrewrite.Parser.Input> sources, @Nullable Path relativeTo, org.openrewrite.ExecutionContext ctx) sourcePathFromSourceText(Path prefix, String sourceCode) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.Parser
accept, acceptedInputs, getCharset, parse, parse, parse, requirePrintEqualsInput, reset
-
Constructor Details
-
RequirementsTxtParser
public RequirementsTxtParser()
-
-
Method Details
-
parseInputs
public Stream<org.openrewrite.SourceFile> parseInputs(Iterable<org.openrewrite.Parser.Input> sources, @Nullable Path relativeTo, org.openrewrite.ExecutionContext ctx) - Specified by:
parseInputsin interfaceorg.openrewrite.Parser
-
parseFreezeOutput
-
dependenciesFromResolved
public static List<PythonResolutionResult.Dependency> dependenciesFromResolved(List<PythonResolutionResult.ResolvedDependency> resolved) Convert resolved dependencies into declared (direct) dependencies. When the dependency graph has been linked (vialinkDependenciesFromMetadata(java.util.List<org.openrewrite.python.marker.PythonResolutionResult.ResolvedDependency>, java.nio.file.Path)), only root packages (those not depended on by any other package) are included. When the graph is unlinked (alldependenciesfields are null), all packages are treated as direct so that client code traversinggetDependencies()finds every package. -
accept
- Specified by:
acceptin interfaceorg.openrewrite.Parser
-
sourcePathFromSourceText
- Specified by:
sourcePathFromSourceTextin interfaceorg.openrewrite.Parser
-
builder
-