python-poetry/poetry

Custom optional = false group in local dependency not getting installed

DivyanshuBhoyar opened this issue · 5 comments

Description

For a local dependency with custom non optional group, dependencies listed do not get installed when installing main project.

here's the local package znlp_translate

pyproject.toml
[tool.poetry.group.indirect_pinned] 
optional = false

[tool.poetry.group.indirect_pinned.dependencies]
pip-install-test = "0.5" 
poetry.lock
[[package]]
name = "pip-install-test"
version = "0.5"
description = "A minimal stub package to test success of pip install"
optional = false
python-versions = "*"
files = [
    {file = "pip-install-test-0.5.tar.gz", hash = "sha256:c33c46ced9865b59963e86e54901947520bdb73bf91849cddbb000742598bb67"},
    {file = "pip_install_test-0.5-py3-none-any.whl", hash = "sha256:623887f5ce0b4695ec3c0503aa4f394253a403e2bb952417b3a778f0802dbe0b"},
]

Main package znlp_translate_api

pyproject.toml
[tool.poetry.dependencies]
python = "^3.8"
flask = "^3.0.1"
znlp-translate = { path = "../znlp_translate"}
poetry.lock
name = "znlp-translate"
version = "1.4.6"
description = "Neural Machine Translation"
optional = false
python-versions = "^3.8"
files = []
develop = false

[package.dependencies]
beautifulsoup4 = "^4.11.1"
ctranslate2 = "^3.24"
fairseq = "0.8.0"
indic-nlp-library = "^0.81"
khmer-nltk = "1.5"
laonlp = "0.7"
nltk = "^3.5"
numpy = "1.23.0"
onnxruntime = "^1.13.1"
overrides = "^3.0.0"
pysbd = "0.3.4"
pythainlp = "5.0.2"
sentencepiece = "^0.1.92"
sinling = "0.3.6"
torch = {url = "https://download.pytorch.org/whl/cpu/torch-2.3.0%2Bcpu-cp38-cp38-linux_x86_64.whl"}
transformers = "^4.41"
turkic_sentence_tokenizer = {url = "http://integ-fileupload.csez.zohocorpin.com/zlabsnlp/santhalakshmi.kg/turkic_sentence_tokenizer-0.1.0-py3-none-any.whl"}
Unidecode = "1.3.2"
znlp = {path = "../znlp"}

[package.source]
type = "directory"
url = "../znlp_translate"

Poetry.lock of this package doesnt have entry for pip_install_test which is defined as optional = false.

This is unexpected behavior or am i missing something?
What is the other way to ensure custom group deps are also installed

Workarounds

Manually installing dependency installs custom grouped deps

Poetry Installation Method

install.python-poetry.org

Operating System

Ubuntu 22.04

Poetry Version

1.6.1

Poetry Configuration

-dir = "/home/temp/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
virtualenvs.create = false
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/temp/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"

Python Sysconfig

-

Example pyproject.toml

-

Poetry Runtime Logs

-

it is expected that groups belonging to some dependency B are irrelevant for a package A that depends on B.

B's dev-only dependencies do not make it into package metadata and are not and should not be known to A.

if pip-install-test is also a dev dependency for A - then add it to a suitable group in A's project definition

please close

@dimbleby But the the new group i created tool.poetry.group.indirect_pinned.dependencies is not a dev dependency group. It also has optional = false. Intuitively it should install that dependency, or is there any way to create a group inside main group to better manage deps ?

All groups (except main) are dev dependencies. Perhaps you want extras.

Working as expected.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.