Make any updates to current source
()
| 457 | |
| 458 | // Make any updates to current source |
| 459 | func (m *PythonSdk) WithUpdates() *PythonSdk { |
| 460 | if !m.UseUv() { |
| 461 | return m |
| 462 | } |
| 463 | |
| 464 | ctr := m.Container |
| 465 | d := m.Discovery |
| 466 | |
| 467 | // Update lock file but without upgrading dependencies. |
| 468 | switch { |
| 469 | case m.UseUvLock(): |
| 470 | // Support uv.lock. Takes precedence. |
| 471 | // Always update if uv.lock exists, but only create a new uv.lock |
| 472 | // if init and there's not already a requirements.lock. |
| 473 | ctr = ctr.WithExec([]string{"uv", "lock"}) |
| 474 | |
| 475 | case d.HasFile(PipCompileLock) && !m.IsInit: |
| 476 | // Support requirements.lock (legacy). |
| 477 | args := []string{ |
| 478 | "uv", "pip", "compile", "-q", "--universal", |
| 479 | "-o", PipCompileLock, |
| 480 | ProjectCfg, |
| 481 | } |
| 482 | |
| 483 | if m.VendorPath != "" { |
| 484 | args = append(args, path.Join(m.VendorPath, ProjectCfg)) |
| 485 | } |
| 486 | |
| 487 | ctr = ctr.WithExec(args) |
| 488 | } |
| 489 | |
| 490 | m.Container = ctr |
| 491 | |
| 492 | return m |
| 493 | } |
| 494 | |
| 495 | // Install the module's package and dependencies |
| 496 | func (m *PythonSdk) WithInstall() *PythonSdk { |