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

Adding httpx - infinity loop #1119

Closed
PushUpek opened this issue Jun 6, 2022 · 4 comments · Fixed by #1129
Closed

Adding httpx - infinity loop #1119

PushUpek opened this issue Jun 6, 2022 · 4 comments · Fixed by #1129
Labels
🐛 bug Something isn't working 🧩 dependency resolution Resolution failures

Comments

@PushUpek
Copy link

PushUpek commented Jun 6, 2022

I’m trying to add httpx to my existing project. But after pdm add httpx resolving the dependencies not ends - infinity loop in console.

Steps to reproduce

# pyproject.toml

[project]
name = "test"
version = ""
description = ""
authors = []
dependencies = [
    "sanic>=22.3.1",
    "sanic-jwt>=1.7.0",
    "bcrypt>=3.2.0",
    "aiobotocore>=2.2.0",
    "alembic>=1.7.7",
    "psycopg2-binary>=2.9.3",
    "aio-pika>=7.1.2",
    "motor>=2.5.1",
    "aiohttp>=3.8.1",
    "pymongo>=3.12.3",
    "typing-extensions>=4.2.0",
    "py-zabbix>=1.1.7",
    "psutil>=5.9.0",
    "pytz>=2022.1",
    "asn1>=2.5.0",
    "ujson>=5.2.0",
    "defusedxml>=0.7.1",
    "ecpy>=1.2.5",
    "sanic-ext==22.3.0",
    "aioredis[hiredis]>=2.0.1",
    "pydantic>=1.9.0",
    "tortoise-orm[asyncpg]>=0.19.0",
]
requires-python = ">=3.10"
license = {text = "MIT"}
[project.optional-dependencies]

[tool.pdm]
allow_prereleases = false

[tool.pdm.dev-dependencies]
dev = [
    "pytest>=7.1.1",
    "coverage<6.4",
    "coverage[toml]<6.4",
    "pytest-cov>=3.0.0",
    "flake8>=4.0.1",
    "blue>=0.8.0",
    "mypy>=0.942",
    "pytest-asyncio>=0.18.3",
    "pytest-watch>=4.2.0",
    "pytest-benchmark>=3.4.1",
    "bandit>=1.7.4",
    "sanic-testing>=22.3.0",
]

[build-system]
requires = ["pdm-pep517>=0.12.0"]
build-backend = "pdm.pep517.api"

[tool.pyright]
extraPaths = ["__pypackages__/3.10/lib/"]

pdm install --prod
pdm add httpx

Actual behavior

Resolving of dependecies not ends

Expected behavior

Resolving of dependencies should ends in some way - error or success

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:        1.15.0
Python Interpreter: /Users/pushupek/.pyenv/versions/3.10.4/bin/python3 (3.10)
Project Root:       /Users/pushupek/Praca/FrameLogic/src/gps-api
Project Packages:   /Users/pushupek/Praca/FrameLogic/src/gps-api/__pypackages__/3.10
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.4",
  "os_name": "posix",
  "platform_machine": "arm64",
  "platform_release": "21.5.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101",
  "python_full_version": "3.10.4",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "darwin"
}
@PushUpek PushUpek added the 🐛 bug Something isn't working label Jun 6, 2022
@frostming
Copy link
Collaborator

frostming commented Jun 6, 2022

May I ask for a minimal reproducible example? I will need you to reduce the number of dependencies as much as possible.

@frostming frostming added the 🤔 waiting for feedback Requires more information to clarify the issue label Jun 6, 2022
@PushUpek
Copy link
Author

PushUpek commented Jun 6, 2022

I think this is minimal I can provide

[project]
name = "test"
version = ""
description = ""
authors = []
dependencies = [
]
requires-python = ">=3.10"
license = {text = "MIT"}
[project.optional-dependencies]

[tool.pdm]
allow_prereleases = false

[tool.pdm.dev-dependencies]
dev = [
    "coverage<6.4",
    "coverage[toml]<6.4",
    "sanic-testing>=21.3.0",
]

[build-system]
requires = ["pdm-pep517>=0.12.0"]
build-backend = "pdm.pep517.api"

[tool.pyright]
extraPaths = ["__pypackages__/3.10/lib/"]

@frostming frostming added 🧩 dependency resolution Resolution failures and removed 🤔 waiting for feedback Requires more information to clarify the issue labels Jun 7, 2022
@frostming
Copy link
Collaborator

frostming commented Jun 8, 2022

The MRE does help. This is a known issue with resolvelib, it just needs incredibly many rounds to find the resolution, not infinite. The conflict is brought by sanic-teting -> httpx<0.23 and httpx, the coverage dependencies make the situation worse by introducing plenty of candidiates, so the resolver must traverse the list all way up to finally find out it should decrease the version of resolved httpx.

As a workaround, you can add httpx with version cap: pdm add 'httpx<0.23'

@PushUpek
Copy link
Author

PushUpek commented Jun 9, 2022

Hmmmm.... i think that something is wrong. Almost 51 minutes is way too long.

pipenv

❯ time pipenv install httpx
Executed in   11.84 secs    fish           external
   usr time    7.01 secs   45.00 micros    7.01 secs
   sys time    1.38 secs  812.00 micros    1.38 secs

pdm

❯ time pdm add httpx
Executed in   50.41 mins    fish           external
   usr time   49.15 mins    0.09 millis   49.15 mins
   sys time    0.59 mins    2.28 millis    0.59 mins

Pipfile

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
httpx = "*"

[dev-packages]
coverage = {extras = ["toml"], version = "<6.4"}
sanic-testing = ">=22.3.0"

[requires]
python_version = "3.10"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🧩 dependency resolution Resolution failures
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants