Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(🎁) Support isolated dependencies that install like pyprojectx/pipx #5037

Open
2 tasks done
KotlinIsland opened this issue Jan 14, 2022 · 2 comments
Open
2 tasks done
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@KotlinIsland
Copy link
Contributor

KotlinIsland commented Jan 14, 2022

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

pseudo pyproject.toml:

[tool.poetry.group.dev.dependencies]
pytest = "6.0.0"
black = { version = "^21.12b0", isolated = true }

OR:

[tool.poetry.group.test.dependencies]
pytest = "6.0.0"
[tool.poetry.group.lint.dependencies]
black = { version = "^21.12b0", isolated = true }

I have dev dependencies that are never imported by my source code or my test code, they act more as standalone cli applications. I still want the version to be locked down, and provide a one click install for developers working with my project, but I don't want the possibility of that dependency interfering with dependency resolution or accidentally becoming imported due to it being in the pythonpath.

When declared with the optional isolated properties, I want Poetry to install the dependency like a pyprojectx context would, completely isolated from the other dependencies.

I would want it installed, isolated within the current project, but also isolated from the project dependencies.

Of course, to copy the functionality of pyprojectx, multiple dependencies could be specified into each context/group

[tool.poetry.group.list]
allisolated = true

[tool.poetry.group.lint.dependencies]
black = "^21.12b0"
flake8 = "^4.0.1"
isort = "^5.10.1"
pre-commit = "^2.16.0"
pylint = "^2.11.2"
pytest = "^7.0.0rc1"

[tool.poetry.group.lint-mypy]
isolated = true

[tool.poetry.group.lint-mypy.dependencies]
basedmypy = "^2.5.0"
types-docutils = "^0.17.4"
types-python-dateutil = "^2.8.6"
types-PyYAML = "^6.0.3"
types-requests = "^2.27.7"
types-setuptools = "^57.4.7"
types-urllib3 = "^1.26.4"

Ideally this exact scenario would benefit from some kind of sub-grouping feature such that poetry install --without lint would also not install basedmypy, but that's an extremely minor point IMO.

@KotlinIsland KotlinIsland added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jan 14, 2022
@branchvincent
Copy link
Member

There's a draft PR at #5740, feedback is welcome there

@rockandska
Copy link

This is how I expect to see this feature works and explained it originally in #7421

[tool.poetry.dependencies]
python = ">= 3.7, <= 3.11"

[tool.poetry.group.lint]
optional = true
# depends_on by default is [ 'main' ]
depends_on = []
           
[tool.poetry.group.lint.dependencies]
python = ">= 3.7, <= 3.8"
flake8 = "*"

[tool.poetry.group.typing]
optional = true
depends_on = [ 'main' ]

[tool.poetry.group.typing.dependencies]
mypy = "*"

In this example :

  • lint is only intended to be executed with python 3.7 or 3.8
  • typing is intended to be executed with the same python versions the project has
  • lint is isolated, so dependencies required by flake8 (importlib-metadata<5) doesn't influence other packages in other groups if they don't depend on lint
  • poetry install --with lint will fail because lint does not have main in depends_on
  • when doing poetry install --only typing, it will install main too since it depends on it

@KotlinIsland KotlinIsland changed the title (🎁) Support isolated dependencies that install like pipx (🎁) Support isolated dependencies that install like pyprojectx/pipx Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

3 participants