python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.57k stars 2.27k forks source link

Homepage doesn't show up on PyPI #9646

Closed notpushkin closed 2 weeks ago

notpushkin commented 2 months ago

Description

I've published a package on PyPI, and the homepage URL wasn't picked up from [tool.poetry]: https://test.pypi.org/project/poetry-homepage-bug-repro/

[tool.poetry]
# ...
homepage = "https://example.com/"
repository = "https://example.net/repo.git"
documentation = "https://example.com/docs"

I've looked at the METADATA file in the wheel and it seems that Poetry puts homepage URL into Home-page property only and doesn't create a Project-URL entry like for other [tool.poetry] URLs. PyPI on the other hand seems to ignore Home-page altogether now. This issue might be related: https://github.com/pypi/warehouse/issues/11220

Workarounds

If you put homepage URL in [tool.poetry.urls], it does show up on PyPI just fine: https://test.pypi.org/project/poetry-homepage-bug-workaround/

[tool.poetry.urls]
"Homepage" = "https://example.com/"

Poetry Installation Method

pipx

Operating System

Fedora 40

Poetry Version

Poetry (version 1.8.3)

Poetry Configuration

cache-dir = "/home/ale/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
repositories.testpypi.url = "https://test.pypi.org/legacy/"
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/ale/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

No response

Example pyproject.toml

[tool.poetry]
name = "poetry-homepage-bug-repro"
version = "0.1.0"
description = ""
authors = ["Alexander Pushkov <alexander@notpushk.in>"]
readme = "README.md"
homepage = "https://example.com/"
repository = "https://example.net/repo.git"
documentation = "https://example.com/docs"

[tool.poetry.dependencies]
python = "^3.12"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Poetry Runtime Logs

$ poetry publish --build -r testpypi -vvv
Loading configuration file /home/ale/.config/pypoetry/config.toml
Loading configuration file /tmp/poetry-homepage-bug-repro/poetry.toml
Using virtualenv: /tmp/poetry-homepage-bug-repro/.venv
Building poetry-homepage-bug-repro (0.1.0)
  - Building sdist
  - Adding: /tmp/poetry-homepage-bug-repro/poetry_homepage_bug_repro/__init__.py
  - Adding: pyproject.toml
  - Adding: README.md
  - Built poetry_homepage_bug_repro-0.1.0.tar.gz
  - Building wheel
  - Adding: /tmp/poetry-homepage-bug-repro/poetry_homepage_bug_repro/__init__.py
  - Built poetry_homepage_bug_repro-0.1.0-py3-none-any.whl

Found an API token for testpypi.
Publishing poetry-homepage-bug-repro (0.1.0) to testpypi
 - Uploading poetry_homepage_bug_repro-0.1.0-py3-none-any.whl 0%[urllib3:urllib3.connectionpool] Starting new HTTPS connection (1): test.pypi.org:443
 - Uploading poetry_homepage_bug_repro-0.1.0-py3-none-any.whl 100%[urllib3:urllib3.connectionpool] https://test.pypi.org:443 "POST /legacy/ HTTP/11" 200 106
 - Uploading poetry_homepage_bug_repro-0.1.0-py3-none-any.whl 100%
 - Uploading poetry_homepage_bug_repro-0.1.0.tar.gz 100%[urllib3:urllib3.connectionpool] https://test.pypi.org:443 "POST /legacy/ HTTP/11" 200 106
 - Uploading poetry_homepage_bug_repro-0.1.0.tar.gz 100%
Secrus commented 2 months ago

I would say that this is a Warehouse issue, since packaging guide doesn't deprecate the fields Poetry is setting. However, we can add an extra case in our build to make it compatible with how Warehouse works.

radoering commented 2 weeks ago

@notpushkin @Secrus Am I missing something or has this been fixed by Warehouse? I can see a homepage link for both https://test.pypi.org/project/poetry-homepage-bug-repro/ and https://test.pypi.org/project/poetry-homepage-bug-workaround/

Secrus commented 2 weeks ago

@notpushkin @Secrus Am I missing something or has this been fixed by Warehouse? I can see a homepage link for both https://test.pypi.org/project/poetry-homepage-bug-repro/ and https://test.pypi.org/project/poetry-homepage-bug-workaround/

Probably a recent deploy or something. Seems like my work wasn't needed after all.