astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
26.01k stars 762 forks source link

Mismatch error introduced by #2484 makes it impossible to create some trivial packages #7714

Open jsbueno opened 1 month ago

jsbueno commented 1 month ago

Relative to issue #2484

What is even the purpose of that artificial restriction?

Anyway, I don't think it is mimicking whatever PIP does (if it does): To be specific - I am editting a package with

[tool.setuptools]
# required named for package importing:
packages = ["pgu"]

@ ... 

[project]
# project name as published on pypi:
name = "pygame-pgu"

And uv pip fails with this mismatch error.

It installs without any issue with native pip.

I am ok if there is any workaround that could be set in a [tool.uv] session, but I obviously need a workaround, or fix - this can't really be such an uncomon thing. Just in the same project I have to deal with pygame-ce which is imported as pygame - but then the specifier is a suffix. Thank you for taking the time to report an issue! We're glad to have you involved with uv.

My terminal output:

(env312) [jsbueno@fedora pgu]$ uv pip install .
error: Failed to build: `pgu @ file:///home/jsbueno/projetos/pgu`
  Caused by: Package metadata name `pygame-pgu` does not match given name `pgu`
(env312) [jsbueno@fedora pgu]$ uv --version
uv 0.4.16

I am attaching the current pyproject.toml (being activelly modified) bellow

jsbueno commented 1 month ago
[build-system]
requires = ["setuptools", "wheel", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true
packages = ["pgu", "pgu.scripts", "pgu.examples", "pgu.data"]

[tool.setuptools.dynamic]
version = {attr = "pgu.__version__"}

[tool.setuptools.package-dir]
"pgu" = "pgu"
"pgu.scripts" = "scripts"
"pgu.examples" = "examples"
"pgu.data" = "data"

[project]
name = "pygame-pgu"
dynamic = ["version"]
description = "Phil's Pygame Utilities - a collection of handy modules and scripts for PyGame."
readme = {file = "README.md", content-type = "text/markdown"}
requires-python = ">= 3.8"
dependencies = [
    "pygame-ce > 2.0"
]
authors = [{ name = "Joao S. O. Bueno" }, { name = "Peter Rogers" }, { name = "Phil Hassey" }]
classifiers = [
    "Development Status :: 5 - Production/Stable",
    "Intended Audience :: Developers",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Programming Language :: Python :: Implementation :: CPython",
    "Programming Language :: Python :: Implementation :: PyPy",
    "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
    "Operating System :: OS Independent",
]

[project.urls]
repository = "https://github.com/parogers/pgu"

[project.optional-dependencies]
dev = []

[tool.pytest.ini_options]
testpaths = "tests"
python_files = "test_*.py"
python_functions = "test_*"
addopts = "-v --doctest-modules"

[tool.mypy]
mypy_path = "typecheck"
implicit_reexport = true
charliermarsh commented 1 month ago

Can you share the output of running with--verbose? The invocation you'd want to see is pygame-pgu @ file:///home/jsbueno/projetos/pgu -- pgu @ file:///home/jsbueno/projetos/pgu is legitimately wrong.

jsbueno commented 1 month ago

Thanks - The thing is then putting the project name separated by an @ of the project location - typing in uv install "pygame-pgu @ ." worked for me

So I am ok if you consider this can be closed now - but the behavior from pip still differs - pip install ., without the project name just works.

Attaching the run with verbose next. (different machine and venv)

jsbueno commented 1 month ago

uv_pip_verbose.txt

charliermarsh commented 1 month ago

It looks like you have a PKG-INFO file in the directory that lists the name as pgu. Is that true?

charliermarsh commented 1 month ago

(Also, is this open-source? Can I test with it?)

jsbueno commented 1 month ago

Yes, there is indeed a PKG-INFO file there.

The project is here: https://github.com/parogers/pgu - I have had commit access there for a while, and this week I took it to "ressurect" the thing - as it provide some tooling for pygame that is not widely available.

I am setting up the shift to pyproject.toml in the "pyproject" branch - https://github.com/parogers/pgu/tree/pyproject

charliermarsh commented 1 month ago

The issue is that PKG-INFO lists Name: pgu. But, isn't that incorrect? That's not the name of the package.