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

Using a dynamic version causes the uv-lock pre-commit CI to fail on GitHub but pass locally. #10167

Closed
vivodi opened this issue Dec 26, 2024 · 7 comments

Comments

@vivodi
Copy link

vivodi commented Dec 26, 2024

Using a dynamic version causes the uv-lock pre-commit CI to fail on GitHub but pass locally.

Log:

uv-lock..................................................................Failed
- hook id: uv-lock
- exit code: 2

warning: `VIRTUAL_ENV=/pc/clone/JLKubma3TtiMMhmWEG5Gxg/py_env-python3` does not match the project environment path `.venv` and will be ignored
Using CPython 3.12.7 interpreter at: /usr/bin/python3.12
error: Failed to generate package metadata for `myproject==1.0.0 @ editable+.`
  Caused by: Failed to resolve requirements from `build-system.requires`
  Caused by: No solution found when resolving: `hatchling`
  Caused by: Failed to fetch: `https://pypi.org/simple/hatchling/`
  Caused by: Could not connect, are you offline?
  Caused by: Request failed after 3 retries
  Caused by: error sending request for url (https://pypi.org/simple/hatchling/)
  Caused by: client error (Connect)
  Caused by: dns error: failed to lookup address information: Temporary failure in name resolution
  Caused by: failed to lookup address information: Temporary failure in name resolution

pyproject.toml:

[project]
name = "myproject"
requires-python = ">=3.12"
dynamic = ["version"]

[tool.hatch.version]
path = "myproject/version.py"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

.pre-commit-config.yaml:

repos:
- repo: https://github.com/astral-sh/uv-pre-commit
  rev: 0.5.11
  hooks:
    - id: uv-lock

Repo: https://github.com/vivodi/myproject

@vivodi vivodi changed the title Using a dynamic version causes the uv-lock pre-commit CI to fail on GitHub but pass locally. Using a dynamic version causes the uv-lock pre-commit CI to fail on GitHub but pass locally. Dec 26, 2024
@charliermarsh
Copy link
Member

I think you're looking for #7533.

@vivodi
Copy link
Author

vivodi commented Dec 26, 2024

I think you're looking for #7533.

I don't think this issue is a duplicate of #7533. My version number is stored in a file and doesn't change automatically. Additionally, the pre-commit CI runs uv-lock without any issues locally; the error only occurs when running on GitHub.

@vivodi
Copy link
Author

vivodi commented Dec 26, 2024

I tried downgrading the version to 0.4.x as suggested in #7533, but it didn't help. Can this issue be reopened?

@charliermarsh
Copy link
Member

Apologies, you're right that it's not a duplicate, but I don't know that there's anything for us to do here. It looks like the request client can't connect to pypi.org from your GitHub runner.

@vivodi
Copy link
Author

vivodi commented Dec 26, 2024

I am not running it on a GitHub runner, but on the pre-commit CI server. And as long as I switch to the static version, uv-lock has no issues. There were no problems when using poetry-lock before, so I think it's an issue with uv-lock.

And this issue has been persistent, it's not a temporary network problem with the server.

@charliermarsh
Copy link
Member

It makes sense that it wouldn't fail when you had a static version, because there's no need to build your project. But now you have a dynamic version, so you're requiring uv to install your build dependencies and build your project. That in turn requires downloading hatchling.

I just don't know that there's anything we can do here if DNS is failing on the machine? It sounds like pre-commit.ci doesn't allow network access on the free tier: pre-commit-ci/issues#80 / pre-commit-ci/issues#47 (comment).

@vivodi
Copy link
Author

vivodi commented Dec 26, 2024

It makes sense that it wouldn't fail when you had a static version, because there's no need to build your project. But now you have a dynamic version, so you're requiring uv to install your build dependencies and build your project. That in turn requires downloading hatchling.

I just don't know that there's anything we can do here if DNS is failing on the machine? It sounds like pre-commit.ci doesn't allow network access on the free tier: pre-commit-ci/issues#80 / pre-commit-ci/issues#47 (comment).

After some research, I realized that what I really want is for uv lock --locked --offline to check the consistency between uv.lock and pyproject.toml, but it doesn’t work for projects with dynamic versions either. See #10176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants