Closed beucismis closed 1 year ago
@beucismis I solved this just now. You can try to follow this. it may work.
Add long_description_content_type='text/markdown' to your setup.py.
setup( ... long_description=open('README.md').read(), long_description_content_type='text/markdown', ... )
@kabeor How should it be for pyproject.toml
file?
@beucismis I'm not very sure, but from pep-0621
Format: String or table
Core metadata: Description (link)
Synonyms
Flit: description-file (link)
Poetry: readme (link)
Setuptools: long_description (link)
I guess you can try to use description-file
.
@kabeor Thanks. I'm trying.
@beucismis Having the same error here with poetry + pyproject.toml + readme.md + gh-action-pypi-publish This workflow is working on other repos, with pretty much the same settings, but Ive never pushed this particular repo to Pypi earlier.
Ive tried deleting the README.md file and recreating it from scratch, didnt work...
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
ERROR `long_description` has syntax errors in markup and would not be
rendered on PyPI.
No content rendered from RST source.
WARNING `long_description_content_type` missing. defaulting to `text/x-rst`.
Checking dist/ssb_fagfunksjoner-0.0.4.tar.gz: PASSED with warnings
WARNING `long_description_content_type` missing. defaulting to `text/x-rst`.
WARNING `long_description` missing.```
After trying a bunch of steps, I did these two steps and it worked:
So probably follow the links according to tool, and be specific about readme-file: https://peps.python.org/pep-0621/#readme
If Im to guess what's going on here, something might have broken somewhere on how the readme is identified (using readme.md not readme.rst for example), or that the tool breaks on some weirdness with the markdown-file itself...
Btw Im using v1.5.1 pypa/gh-action-pypi-publish@v1.5.1
Btw Im using v1.5.1 pypa/gh-action-pypi-publish@v1.5.1
That's an old version, and you really should upgrade to the recent release. Though, it's not related. What fails is a twine check --strict
call. It doesn't check your repo or any files in the source checkout, it checks the artifact you're going to upload. This means that you've built your artifact wrong, and it didn't end up having the correct metadata internally.
With https://github.com/marketplace/actions/pypi-publish#disabling-metadata-verification you can disable the check, of course, and it'll likely make the upload if the artifact is not fully broken. But you should really have that twine check --strict
somewhere in your CI to catch such things earlier than the release publishing job.
Also, you need to fix your artifact generation. That'll depend on your PEP 517 build backend. setuptools/hatch/flit/poetry/whatever. You need to consult with those projects in order to fix your artifacts. This action takes artifacts you provide and publishes them, nothing else, it doesn't build them, you do. You can use that twine check --strict
to check your artifact generation locally.
Once you have your artifacts generated correctly, the metadata check will stop failing. Closing as this is not an issue with the action project.
@beucismis I solved this just now. You can try to follow this. it may work.
Add long_description_content_type='text/markdown' to your setup.py.
setup( ... long_description=open('README.md').read(), long_description_content_type='text/markdown', ... )
Thank you you are a genius. You saved my life.
I'm also encountering this problem for https://github.com/astro-informatics/sleplet/blob/main/pyproject.toml. I have published before with this action (last time 2023-10-05) and now I'm blocked by the long_description
error.
Just FYI, so people coming here from Google would know. This is a crappy python/twine way to notify you about: "you're missing a README file" So, to solve it:
README.md
file, write something into it, should not be empty.pyproject.toml
under [project]
[project]
readme = "README.md"
Thanks, @pkit, I actually already have one. I've tracked the bug down to python -m build; twine check dist/*
. Something is wrong in my README.md
and currently trying to work out what that is...
@paddyroddy there's no problem in your README.md
I have downloaded it from wget https://raw.githubusercontent.com/astro-informatics/sleplet/main/README.md
And then built my project with it (instead of my own README):
rm -fr dist && python -m build --wheel && twine check dist/*
it passes.
Thanks for checking @pkit! I hadn't thought of trying that. Okay, must be a pyproject.toml
problem. Will see if I can work it out.
Sorry for the noise. I've solved my issue. I was trying to wrap the urls
block of my pyproject.toml
urls = {Code = """
https://github.com/astro-informatics/sleplet
""", Documentation = """
https://astro-informatics.github.io/sleplet
""", Download = """
https://pypi.org/project/sleplet
""", Homepage = """
https://github.com/astro-informatics/sleplet
""", Issues = """
https://github.com/astro-informatics/sleplet/issues
"""}
reverting back to (which was new since October)
urls = {Code = "https://github.com/astro-informatics/sleplet", Documentation = "https://astro-informatics.github.io/sleplet", Download = "https://pypi.org/project/sleplet", Homepage = "https://github.com/astro-informatics/sleplet", Issues = "https://github.com/astro-informatics/sleplet/issues"}
has fixed my issue.
I have the same issue on my repo. It took some time to figure out that "long_description" was the peculiar way to spell "readme", as the toml entry is "readme" and not "long_description". Besides this, it flags an error of "unexpected indentation" at line 25 of my readme, even though changing that line's indentation yields a very different result so it's not actually a mistake.
Not providing any readme (by commenting the toml line) also ends in failure for the wheel file, but not for the tar.gz file. But upload still failed because of that.
I solved it with adding content-type = "text/markdown"
[project]
name="PVNet"
description = "PVNet"
authors = [{name="Peter Dudfield", email="info@openclimatefix.org"}]
dynamic = ["version", "readme"]
license={file="LICENCE"}
[tool.setuptools.dynamic]
version = {attr = "pvnet.__version__"}
readme = {file = "README.md", content-type = "text/markdown"}
TOML file: https://github.com/beucismis/ozgursozluk/blob/main/pyproject.toml Failed job: https://github.com/beucismis/ozgursozluk/actions/runs/5272889540/jobs/9535689902