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

Is there a way to specify that you don't care about pypy when creating a lockfile? #9473

Closed
wlach opened this issue Nov 27, 2024 · 3 comments · Fixed by #9475
Closed

Is there a way to specify that you don't care about pypy when creating a lockfile? #9473

wlach opened this issue Nov 27, 2024 · 3 comments · Fixed by #9475
Labels
great writeup A wonderful example of a quality contribution 💜 question Asking for clarification or support

Comments

@wlach
Copy link

wlach commented Nov 27, 2024

Consider this pyproject.toml:

[project]
name = "test-clickhouse-driver"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
    "databricks-sql-connector==3.6.0",
    "clickhouse-driver[lz4]==0.2.9",
]

These dependencies are mutually compatible using regular cpython, but not with pypy because clickhouse-driver[lz4] specifies that you need an older version of lz4 (that's incompatible with databricks-sql-connector) on that platform:

https://github.com/mymarilyn/clickhouse-driver/blob/8a4e7c5b99b532df2b015651d893a6f36288a22c/setup.py#L131

Thus running uv sync fails:

❯ uv sync
Using CPython 3.11.9 interpreter at: /Users/wlach/.local/share/mise/installs/python/3.11/bin/python3.11
Creating virtual environment at: .venv
  × No solution found when resolving dependencies for split
  │ (implementation_name == 'pypy'):
  ╰─▶ Because only the following versions of lz4{implementation_name ==
      'pypy'} are available:
          lz4{implementation_name == 'pypy'}==0.1
          lz4{implementation_name == 'pypy'}==0.2
          ...
          lz4{implementation_name == 'pypy'}>=3.0.1
      and databricks-sql-connector==3.6.0 depends on lz4>=4.0.2,
      we can conclude that databricks-sql-connector==3.6.0 and
      lz4{implementation_name == 'pypy'}<=3.0.1 are incompatible.
      And because clickhouse-driver[lz4]==0.2.9 depends on
      lz4{implementation_name == 'pypy'}<=3.0.1, we can conclude that
      databricks-sql-connector==3.6.0 and clickhouse-driver[lz4]==0.2.9 are
      incompatible.
      And because your project depends on clickhouse-driver[lz4]==0.2.9 and
      databricks-sql-connector==3.6.0, we can conclude that your project's
      requirements are unsatisfiable.

Locally we can workaround this by adding ;implementation_name != 'pypy' to the clickhouse driver specification:

[project]
name = "test-clickhouse-driver"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
    "databricks-sql-connector==3.6.0",
    "clickhouse-driver[lz4]==0.2.9;implementation_name != 'pypy'",
]

However that doesn't help if one of your dependencies is also depending on the generic clickhouse-driver[lz4]. Is there any way I can say that I just don't care about pypy when creating a uv lockfile? I know they're supposed to be cross-platform/implementation but for our use cases at least we don't really need this guarantee.

@zanieb
Copy link
Member

zanieb commented Nov 27, 2024

Does a limited resolution environment work for you?

I think it'd be

[tool.uv]
environments = [
    "implementation_name != 'pypy'"
]

@zanieb
Copy link
Member

zanieb commented Nov 27, 2024

You can also use dependency overrides to override a transitive dependency

@zanieb zanieb added question Asking for clarification or support great writeup A wonderful example of a quality contribution 💜 labels Nov 27, 2024
@wlach
Copy link
Author

wlach commented Nov 27, 2024

Does a limited resolution environment work for you?

I think it'd be

[tool.uv]
environments = [
"implementation_name != 'pypy'"
]

Yes! That was exactly what I was looking for. Might make sense to mention pypy there as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
great writeup A wonderful example of a quality contribution 💜 question Asking for clarification or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants