Am I missing something or is `sync` just not worki...
# general
s
Am I missing something or is
sync
just not working? I have a uv-based lockfile, and whenI run
pants generate-lockfiles --resolve=python-default --sync
i get:
Copy code
13:22:49.93 [INFO] Completed: Generate uv lockfile for python-default
13:22:50.06 [INFO] Wrote lockfile for the resolve `python-default` to pyproject.lock

Lockfile diff: pyproject.lock [python-default]

==                    Upgraded dependencies                     ==

  anyio                          4.9.0        -->   4.14.1
  arrow                          1.3.0        -->   1.4.0
  asgiref                        3.8.1        -->   3.11.1
  asttokens                      3.0.0        -->   3.0.1
  attrs                          25.3.0       -->   26.1.0
  basedpyright                   1.29.5       -->   1.39.9
  bcrypt                         4.3.0        -->   5.0.0
  billiard                       4.2.1        -->   4.2.4
  black                          25.1.0       -->   26.5.1
  boltons                        25.0.0       -->   26.0.0
  certifi                        2025.6.15    -->   2026.6.17
  cffi                           1.17.1       -->   2.1.0
  charset-normalizer             3.4.2        -->   3.4.9
  click                          8.2.1        -->   8.4.2
  cloudpickle                    3.1.1        -->   3.1.2
  cloudvision                    1.24.1       -->   1.30.4
  coconut                        3.1.2        -->   3.2.0
  cogapp                         3.5.1        -->   3.6.0
  copier                         9.7.1        -->   9.16.0
  copier-templates-extensions    0.3.1        -->   0.3.2
  coverage                       7.9.1        -->   7.15.0
  cpyparsing                     2.4.7.2.4.1   -->   2.4.7.2.4.3
  cron-descriptor                1.4.5        -->   2.1.0
  cryptography                   44.0.2       -->   48.0.1
  cssselect                      1.3.0        -->   1.4.0
  debugpy                        1.8.14       -->   1.8.21
  decorator                      5.2.1        -->   5.3.1
  deepdiff                       7.0.1        -->   8.6.2
  diffsync                       2.1.0        -->   2.2.3
  django                         4.2.23       -->   4.2.30
  django-debug-toolbar           5.2.0        -->   6.3.0
  django-environ                 0.12.0       -->   0.14.0
  django-picklefield             3.3          -->   3.4.0
  drf-spectacular-sidecar        2025.7.1     -->   2026.7.1
  dunamai                        1.24.1       -->   1.26.1
  ecdsa                          0.19.1       -->   0.19.2
  exceptiongroup                 1.3.0        -->   1.3.1
  executing                      2.2.0        -->   2.2.1
  face                           24.0.0       -->   26.0.1
  fonttools                      4.58.4       -->   4.63.0
  gitpython                      3.1.44       -->   3.1.50
  glom                           24.11.0      -->   25.12.0
  google-auth                    2.40.3       -->   2.55.1
  greenlet                       3.2.3        -->   3.5.3
  grpcio                         1.73.1       -->   1.82.0
  hier-config                    2.3.1        -->   3.6.1
  idna                           3.10         -->   3.18
  iniconfig                      2.1.0        -->   2.3.0
  ipython                        8.37.0       -->   8.39.0
  jedi                           0.19.2       -->   0.20.0
  jsonschema-specifications      2025.4.1     -->   2025.9.1
  junos-eznc                     2.7.1        -->   2.8.2
  kiwisolver                     1.4.8        -->   1.5.0
  lxml                           5.2.2        -->   6.1.1
  markdown-it-py                 3.0.0        -->   4.2.0
  markupsafe                     3.0.2        -->   3.0.3
  matplotlib                     3.10.3       -->   3.10.6
  matplotlib-inline              0.1.7        -->   0.2.2
  mcpyrate                       3.6.4        -->   4.2.0
  msgpack                        1.1.1        -->   1.2.1
  multidict                      6.6.3        -->   6.7.1
  mypy                           1.16.1       -->   2.1.0
  napalm                         4.1.0        -->   5.1.0
  nautobot-device-onboarding     3.0.1        -->   4.4.0
  nautobot-golden-config         2.4.1        -->   2.5.1
  nautobot-plugin-nornir         2.2.1        -->   2.3.0
  nautobot-ssot                  3.9.0        -->   3.9.4
  ncclient                       0.6.19       -->   0.7.0
  netmiko                        4.6.0        -->   4.7.0
  netutils                       1.13.0       -->   1.17.3
  nh3                            0.2.21       -->   0.2.22
  nodejs-wheel-binaries          22.17.0      -->   24.16.0
  nornir-napalm                  0.4.0        -->   0.5.0
  nornir-nautobot                3.3.1        -->   3.6.1
  ntc-templates                  7.9.0        -->   8.1.0
  nvidia-ml-py                   12.575.51    -->   13.610.43
  packaging                      23.2         -->   26.2
  paramiko                       3.5.1        -->   4.0.0
  parso                          0.8.4        -->   0.8.7
  pathspec                       0.12.1       -->   1.1.1
  pip                            25.1.1       -->   26.1.2
  platformdirs                   4.3.8        -->   4.10.0
  plumbum                        1.9.0        -->   2.0.1
  prompt-toolkit                 3.0.51       -->   3.0.52
  propcache                      0.3.2        -->   0.5.2
  protobuf                       5.29.5       -->   5.29.6
  psutil                         7.0.0        -->   7.2.2
  psycopg                        3.2.9        -->   3.3.4
  psycopg2-binary                2.9.10       -->   2.9.12
  ptpython                       3.0.30       -->   3.0.32
  pyasn1                         0.6.1        -->   0.6.3
  pycparser                      2.22         -->   3.0
  pydantic                       2.11.7       -->   2.13.4
  pydantic-core                  2.33.2       -->   2.46.4
  pygments                       2.19.2       -->   2.20.0
  pyjwt                          2.10.1       -->   2.13.0
  pynacl                         1.5.0        -->   1.6.2
  pynautobot                     2.6.4        -->   2.7.2
  pytest                         8.4.1        -->   9.1.1
  pytest-cov                     6.2.1        -->   7.1.0
  pytest-mock                    3.14.1       -->   3.15.1
  python-box                     7.3.2        -->   7.4.1
  python-crontab                 3.2.0        -->   3.3.0
  python-dotenv                  1.1.1        -->   1.2.2
  pytz                           2025.2       -->   2026.2
  pyuwsgi                        2.0.29       -->   2.0.30.post1
  pyyaml                         6.0.2        -->   6.0.3
  questionary                    2.1.0        -->   2.1.1
  redis                          6.2.0        -->   8.0.1
  referencing                    0.36.2       -->   0.37.0
  requests                       2.32.4       -->   2.34.2
  rich                           14.0.0       -->   15.0.0
  rpds-py                        0.26.0       -->   0.30.0
  ruamel-yaml                    0.18.14      -->   0.19.1
  ruff                           0.12.1       -->   0.15.20
  scalene                        1.5.51       -->   2.3.0
  scapy                          2.6.1        -->   2.7.0
  scrapli                        2025.1.30    -->   2026.2.20
  scrapli-netconf                2025.1.30    -->   2026.1.12
  sentry-sdk                     2.60.0       -->   2.64.0
  setuptools                     80.9.0       -->   83.0.0
  setuptools-scm                 8.3.1        -->   10.2.0
  smmap                          5.0.2        -->   5.0.3
  social-auth-core               4.5.6        -->   4.9.1
  sqlalchemy                     2.0.41       -->   2.0.51
  sqlmodel                       0.0.24       -->   0.0.39
  sqlparse                       0.5.3        -->   0.5.5
  structlog                      25.4.0       -->   26.1.0
  textfsm                        1.1.3        -->   2.1.0
  tomli                          2.2.1        -->   2.4.1
  tomlkit                        0.13.3       -->   0.15.0
  traitlets                      5.14.3       -->   5.15.1
  ttp-templates                  0.3.7        -->   0.5.1
  tuna                           0.5.11       -->   0.5.15
  typer                          0.16.0       -->   0.26.8
  typing-extensions              4.14.0       -->   4.16.0
  typing-inspection              0.4.1        -->   0.4.2
  tzdata                         2025.2       -->   2026.2
  urllib3                        2.5.0        -->   2.7.0
  vcrpy                          5.1.0        -->   8.3.0
  wcwidth                        0.2.13       -->   0.8.2
  websocket-client               1.8.0        -->   1.9.0
  wrapt                          1.17.2       -->   2.2.2
  yarl                           1.20.1       -->   1.24.2
  zipp                           3.23.0       -->   3.23.1

==                      Added dependencies                      ==

  annotated-doc                  0.0.4
  aristaproto                    0.1.5
  ast-serialize                  0.6.0
  copier-template-extensions     0.3.3
  grpclib                        0.4.9
  h2                             4.3.0
  hpack                          4.2.0
  hyperframe                     6.1.0
  invoke                         3.0.3
  jdiff                          1.0.2
  jmespath                       1.1.0
  librt                          0.12.0
  orderly-set                    5.5.0
  pyavd-utils                    0.0.1
  pytokens                       0.4.1
  tstr                           0.4.1
  vcs-versioning                 2.2.2
  yamlloader                     1.6.0

==                     Removed dependencies                     ==

  cachetools                     5.5.2
  future                         1.0.0
  nornir-jinja2                  0.2.0
  ordered-set                    4.1.0
  pywin32                        310
  ruamel-yaml-clib               0.2.12
  types-python-dateutil          2.9.0.20250516
  types-pyyaml                   6.0.12.20250516
  wheel                          0.45.1
  yamlordereddictloader          0.4.2
I thought the whole idea of
--sync
was to only update the minimum set of locked deps to bring the lockfile in line with the source of deps (
pyproject.toml
in my case)
h
--sync
is supposed to work with
uv
lockfiles.
uv
does a minimal update by default if an existing lockfile is present
So something is wrong here
Just checking - is this when updating an existing
uv
lockfile, or is this the transition from
pex
lockfiles to
uv
lockfiles? In that latter case I would expect an aggressive update
b
Afaict the
.sync
branch gathers the digest of the existing uv lock, say "foo/bar/my.lock", but it does not rename it to uv.lock in the sandbox before calling `uv lock`; so uv does not see a pre-existing lock, it just ignores a custom funky path lock: github.com/pantsbuild/pants/blob/…/lockfile.py#…
A change to example-python on main seems to confirm this, after an initial lock re-gen to switch to uv, the --sync shows signs of 2 lock files in the sandbox:
Copy code
:; git diff pants.toml
diff --git a/pants.toml b/pants.toml
index 5c04bfd..7e1cf62 100644
--- a/pants.toml
+++ b/pants.toml
@@ -2,7 +2,7 @@
 # Licensed under the Apache License, Version 2.0 (see LICENSE).

 [GLOBAL]
-pants_version = "2.31.0"
+pants_version = "2.32.0"
 backend_packages.add = [
   "pants.backend.build_files.fmt.black",
   "pants.backend.python",
@@ -36,6 +36,7 @@ interpreter_constraints = ["==3.12.*"]
 # `generate-lockfiles` goal for Pants to generate the lockfile for you.
 enable_resolves = true

+resolver = "uv"
 resolves = { python-default = "python-default.lock"}

 [python-bootstrap]

:; pants --keep-sandboxes=always  --no-pantsd --no-local-cache generate-lockfiles --sync
14:25:44.30 [INFO] Preserving local process execution dir /tmp/pants-sandbox-Wxxsui for Test binary /bin/tar.
14:25:44.30 [INFO] Preserving local process execution dir /tmp/pants-sandbox-VEaLZT for Test binary /usr/bin/tar.
14:25:44.31 [INFO] Preserving local process execution dir /tmp/pants-sandbox-OaAFo1 for Extract uv-x86_64-unknown-linux-musl.tar.gz
14:25:44.71 [INFO] Preserving local process execution dir /tmp/pants-sandbox-MQw5S9 for Generate uv lockfile for python-default
14:25:45.01 [INFO] Completed: Generate uv lockfile for python-default
14:25:45.02 [INFO] Wrote lockfile for the resolve `python-default` to python-default.lock

:; ls -l /tmp/pants-sandbox-MQw5S9/
total 36
-rwxr-xr-x 1 jsirois jsirois   574 Jul 10 14:25 __run.sh
-rw-r--r-- 1 jsirois jsirois   259 Jul 10 14:25 pyproject.toml
-rw-r--r-- 1 jsirois jsirois 11295 Jul 10 14:25 python-default.lock
drwxrwxr-x 2 jsirois jsirois    80 Jul 10 14:25 uv-x86_64-unknown-linux-musl
-rw-rw-r-- 1 jsirois jsirois 11295 Jul 10 14:25 uv.lock
-rw-r--r-- 1 jsirois jsirois    59 Jul 10 14:25 uv.toml
@stale-twilight-79248 so if I'm right here and you've followed along, the workaround should be obvious.
h
Ooof yes, that is definitely the problem.
Although i still want to add a test to it