Class LockFileRegeneration

java.lang.Object
org.openrewrite.python.internal.LockFileRegeneration

public final class LockFileRegeneration extends Object
Regenerates a lock file by running <packageManager> lock in a temporary directory seeded with the dependencies file (and optionally an existing lock). Pre-configured instances are provided for uv (UV) and pipenv (PIPENV).
  • Field Details

  • Method Details

    • forPackageManager

      public static @Nullable LockFileRegeneration forPackageManager(@Nullable PythonResolutionResult.PackageManager pm)
    • regenerate

      public LockFileRegeneration.Result regenerate(String dependenciesContent)
    • regenerate

      public LockFileRegeneration.Result regenerate(String dependenciesContent, @Nullable String existingLockContent)
    • regenerate

      public LockFileRegeneration.Result regenerate(String dependenciesContent, @Nullable String existingLockContent, Map<String,String> environment)
      Regenerate the lock file from the given dependencies content. When an existing lock file is provided it is seeded into the working directory so the package manager performs a minimal update rather than re-resolving every dependency from scratch.
      Parameters:
      dependenciesContent - the dependencies-file content to lock
      existingLockContent - the current lock file content, or null
      environment - additional environment variables (e.g., SSL_CERT_FILE)
      Returns:
      a result containing the new lock file content, or an error message