Title: Handle `--frozen` flag for Poetry backend via lockfile backup/restore by Copilot · Pull Request #1773 · usethis-python/usethis-python · GitHub
Open Graph Title: Handle `--frozen` flag for Poetry backend via lockfile backup/restore by Copilot · Pull Request #1773 · usethis-python/usethis-python
X Title: Handle `--frozen` flag for Poetry backend via lockfile backup/restore by Copilot · Pull Request #1773 · usethis-python/usethis-python
Description: Poetry's CLI has no --frozen equivalent. When frozen=True, poetry add/remove were running unmodified—resolving, locking, and installing despite the user requesting frozen mode. Changes call_poetry_subprocess: When frozen=True and the command is add/remove, the function now (1) inserts --lock to skip installation, and (2) uses a _frozen_poetry_lock context manager to back up poetry.lock to a temp directory before the subprocess and restore it afterwards. This ensures pyproject.toml is updated while the lockfile remains truly frozen—even on subprocess failure. _frozen_poetry_lock context manager: Encapsulates the backup/restore lifecycle for poetry.lock. If the lockfile exists beforehand it is backed up and restored on exit; if it did not exist, any lockfile created during the block is removed. The temp directory is always cleaned up. _noop_context: No-op context manager used as a fallback when frozen mode is not applicable. Tests: 8 unit tests on call_poetry_subprocess (frozen add/remove, non-applicable commands, frozen=False baseline, lockfile restore on success, lockfile restore on failure, lockfile removal when it didn't previously exist, temp directory cleanup) + 2 integration tests on add_deps_to_group/remove_deps_from_group with Poetry backend under frozen mode. 100% coverage on the changed module. # Poetry doesn't support a --frozen flag like uv does. To emulate frozen # behaviour we: (1) pass --lock to skip installation, (2) back up # poetry.lock before the subprocess and restore it afterwards so the # lockfile is never modified. frozen_applicable = usethis_config.frozen and args[:1] in (["add"], ["remove"]) if frozen_applicable: args = [args[0], "--lock", *args[1:]]
Open Graph Description: Poetry's CLI has no --frozen equivalent. When frozen=True, poetry add/remove were running unmodified—resolving, locking, and installing despite the user requesting frozen mode. Changes call_po...
X Description: Poetry's CLI has no --frozen equivalent. When frozen=True, poetry add/remove were running unmodified—resolving, locking, and installing despite the user requesting frozen mode. Changes cal...
Opengraph URL: https://github.com/usethis-python/usethis-python/pull/1773
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3e8dd5e1-5c8a-0ad3-4124-54cf629e2ddf |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 95D8:3BEDBF:1392439:1B3333E:6A4DE947 |
| html-safe-nonce | 3a67da9165f02da137210d8f043f2b293f6ddd43d31ec36069e74af5f0814ab9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUQ4OjNCRURCRjoxMzkyNDM5OjFCMzMzM0U6NkE0REU5NDciLCJ2aXNpdG9yX2lkIjoiMjkxNDI1Mzg3MDM5NjcyOTY3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 26c6574c09071397055b73a55a38675a9de818bafbdadb505a4452797e628ff1 |
| hovercard-subject-tag | pull_request:3484286838 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/usethis-python/usethis-python/pull/1773/files |
| twitter:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/in/1143301?s=400&v=4 |
| og:image:alt | Poetry's CLI has no --frozen equivalent. When frozen=True, poetry add/remove were running unmodified—resolving, locking, and installing despite the user requesting frozen mode. Changes call_po... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/usethis-python/usethis-python git https://github.com/usethis-python/usethis-python.git |
| octolytics-dimension-user_id | 216362695 |
| octolytics-dimension-user_login | usethis-python |
| octolytics-dimension-repository_id | 842189705 |
| octolytics-dimension-repository_nwo | usethis-python/usethis-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 842189705 |
| octolytics-dimension-repository_network_root_nwo | usethis-python/usethis-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width