Skip to content

poetry sync --only=main doesn't remove package from other groups like poetry install --sync --only=main do #9943

@trim21

Description

@trim21

Description

I'm not sure if --with and --without works as expected, but --only doesn't work as expected.

(test) ❯❯ ~\..\test (master) uvx poetry sync --only=main
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: project (0.0.0)
(test) ❯❯ ~\..\test (master) uvx poetry install --sync --only=main
The `--sync` option is deprecated and slated for removal in the next minor release after June 2025, use the `poetry sync` command instead.
Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 16 removals

  - Removing botocore-stubs (1.35.92)
  - Removing google-re2-stubs (0.1.1): Cancelled
  - Removing iniconfig (2.0.0  - Removing iniconfig (2.0.0)
  - Removing lxml-stubs (0.5.1)
  - Removing msgpack-types (0.5.0)
  - Removing mypy (1.14.1)
  - Removing mypy-extensions (1.0.0)
  - Removing objprint (0.3.0)
  - Removing pluggy (1.5.0)
  - Removing pytest (8.3.4)
  - Removing types-awscrt (0.23.6)
  - Removing types-pyyaml (6.0.12.20241230)
  - Removing types-requests (2.32.0.20241016)
  - Removing types-six (1.17.0.20241205)
  - Removing types-tqdm (4.67.0.20241221)
  - Removing viztracer (1.0.0)
  ...

Workarounds

use poetry install --sync --only=main

Poetry Installation Method

other

Operating System

win32

Poetry Version

Poetry (version 2.0.0)

Poetry Configuration

cache-dir = "D:\\.cache\\pypoetry"
installer.max-workers = 10
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # D:\.cache\pypoetry\virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false

Python Sysconfig

No response

Example pyproject.toml

#[project]
#name = 'project'
#requires-python = '~=3.10'
#
#dependencies = [
#    'apscheduler == 3.11.0',
#    'beautifulsoup4 == 4.12.3',
#    'bencode2 == 0.3.21',
#    'bgm-tv-wiki == 0.0.29',
#    'sslog == 0.0.0a51',
#    'botocore == 1.35.92',
#    'click == 8.1.8',
#    'colorama == 0.4.6',
#    'cryptography == 44.0.0',
#    'fastapi == 0.115.6',
#    'httpx[http2, socks, brotli] == 0.28.1',
#    'jinja2 == 3.1.5',
#    'limits == 3.14.1',
#    'loguru == 0.7.3',
#    'orjson == 3.10.13',
#    'pillow == 11.1.0',
#    'psycopg[binary, pool] == 3.2.3',
#    'pydantic == 2.10.4',
#    'python-hosts == 1.0.7',
#    'pyyaml == 6.0.2',
#    'qbittorrent-api == 2024.12.71',
#    'redis[hiredis] == 5.2.1',
#    'rich == 13.9.4',
#    'rtorrent-rpc == 0.9.4',
#    'tenacity == 9.0.0',
#    'tqdm == 4.67.1',
#    'tzdata == 2024.2',
#    'uvicorn == 0.34.0',
#    'xxhash == 3.5.0',
#    'yarl == 1.18.3',
#    'zstd == 1.5.6.1',
#    'jmespath == 1.0.1',
#    'uuid-utils == 0.10.0',
#    'msgpack == 1.1.0',
#    'lxml == 5.3.0',
#    'google-re2 == 1.1.20240702',
#    'tomli == 2.2.1',
#    'pgqueuer[psycopg, asyncpg] == 0.18.4',
#    'asyncpg == 0.30.0',
#    'msgspec == 0.19.0',
#    'opendal == 0.45.13',
#    'durationpy == 0.9',
#]

[tool.poetry]
name = 'project'
version = '0.0.0'
authors = []
description = ''
packages = [
    { include = 'lib' },
]

[tool.poetry.dependencies]
python = "~3.10.0"
#
apscheduler = "3.11.0"
beautifulsoup4 = "4.12.3"
bencode2 = "0.3.21"
bgm-tv-wiki = "0.0.29"
sslog = "0.0.0a51"
botocore = "1.35.92"
click = "8.1.8"
colorama = "0.4.6"
cryptography = "44.0.0"
fastapi = "0.115.6"
httpx = { version = "0.28.1", extras = ["http2", "socks", "brotli"] }
jinja2 = "3.1.5"
limits = "3.14.1"
loguru = "0.7.3"
orjson = "3.10.13"
pillow = "11.1.0"
psycopg = { version = "3.2.3", extras = ["binary", "pool"] }
pydantic = "2.10.4"
python-hosts = "1.0.7"
pyyaml = "6.0.2"
qbittorrent-api = "2024.12.71"
redis = { version = "5.2.1", extras = ["hiredis"] }
rich = "13.9.4"
rtorrent-rpc = { version = "0.9.4", extras = ['orjson'] }
tenacity = "9.0.0"
tqdm = "4.67.1"
tzdata = "2024.2"
uvicorn = { version = "0.34.0" }
xxhash = "3.5.0"
yarl = "1.18.3"
zstd = "1.5.6.1"
jmespath = "1.0.1"
uuid-utils = "0.10.0"
msgpack = "1.1.0"
lxml = "5.3.0"
google-re2 = "1.1.20240702"
tomli = "2.2.1"
pgqueuer = { version = "0.18.4", extras = ["psycopg", 'asyncpg'] }
asyncpg = "0.30.0"
msgspec = "0.19.0"
opendal = "0.45.13"
durationpy = "0.9"

#[project.optional-dependencies]
#dev = [
#    'viztracer == 1.0.0',
#    'mypy == 1.14.1',
#    'pytest == 8.3.4',
#    # type stubs
#    'types-six == 1.17.0.20241205',
#    'types-tqdm == 4.67.0.20241221',
#    'types-pyyaml == 6.0.12.20241230',
#    'types-requests == 2.32.0.20241016',
#    'botocore-stubs == 1.35.92',
#    'msgpack-types == 0.5.0',
#    'lxml-stubs == 0.5.1',
#    'google-re2-stubs == 0.1.1',
#]

[tool.poetry.group.dev.dependencies]
viztracer = "1.0.0"
mypy = "1.14.1"
pytest = "8.3.4"
# type stubs
types-six = "1.17.0.20241205"
types-tqdm = "4.67.0.20241221"
types-pyyaml = "6.0.12.20241230"
types-requests = "2.32.0.20241016"
botocore-stubs = '1.35.92'
msgpack-types = '0.5.0'
lxml-stubs = "0.5.1"
google-re2-stubs = "0.1.1"

Poetry Runtime Logs

already provided

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliRelated to the command linekind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions