Package org.openrewrite.python.internal
Class PipfileLockParser
java.lang.Object
org.openrewrite.python.internal.PipfileLockParser
Parses Pipfile.lock files (JSON format) to extract resolved dependency information.
Pipfile.lock has the shape:
{
"_meta": { "sources": [...], "requires": {...} },
"default": { "requests": { "version": "==2.28.0", ... } },
"develop": { "pytest": { "version": "==7.0.0", ... } }
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindAndParse(Path pipfileDir, @Nullable Path boundary) Find and parse a Pipfile.lock file, walking up from the given directory.Parse Pipfile.lock content into a list of resolved dependencies.
-
Constructor Details
-
PipfileLockParser
public PipfileLockParser()
-
-
Method Details
-
findAndParse
public static List<PythonResolutionResult.ResolvedDependency> findAndParse(Path pipfileDir, @Nullable Path boundary) Find and parse a Pipfile.lock file, walking up from the given directory.- Parameters:
pipfileDir- the directory containing Pipfileboundary- the boundary to stop searching at (typically relativeTo)- Returns:
- list of resolved dependencies, or empty list if no Pipfile.lock found
-
parse
Parse Pipfile.lock content into a list of resolved dependencies. Entries fromdefaultappear before entries fromdevelop.
-