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

TypeError: Unable to determine the content-type based on the extension of readme file: INFO.adoc #1730

Open
AllanDaemon opened this issue Sep 21, 2024 · 0 comments

Comments

@AllanDaemon
Copy link

AllanDaemon commented Sep 21, 2024

I'm migrating a project from Poetry to Rye. The default build in rye is hatch.

When I try to do anything in Rye with the package (like adding a dependency), it runs hatch.

But it fails due to not being able to support Asciidoc (.adoc) files in the readme property:

[project]
...
readme = "INFO.adoc"

This package is not intended to be published in PyPA or anything.

$ rye sync
Reusing already existing virtualenv
Generating production lockfile: /project/requirements.lock
error: Failed to build: `client @ file:///project/client`
  Caused by: Build backend failed to determine metadata through `prepare_metadata_for_build_editable` with exit status: 1
--- stdout:

--- stderr:
Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/home/user/.cache/uv/builds-v0/.tmpHaowpa/lib/python3.12/site-packages/hatchling/build.py", line 142, in prepare_metadata_for_build_editable
    f.write(builder.config.core_metadata_constructor(builder.metadata, extra_dependencies=extra_dependencies))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.cache/uv/builds-v0/.tmpHaowpa/lib/python3.12/site-packages/hatchling/metadata/spec.py", line 515, in construct_metadata_file_2_3
    if metadata.core.readme:
       ^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.cache/uv/builds-v0/.tmpHaowpa/lib/python3.12/site-packages/hatchling/metadata/core.py", line 526, in readme
    raise TypeError(message)
TypeError: Unable to determine the content-type based on the extension of readme file: INFO.adoc
---
error: could not write production lockfile for workspace

Caused by:
    Failed to run uv compile /tmp/.tmpnrYKTz/requirements.txt. uv exited with status: exit status: 2

Specifying the content type with:
readme = {file = "INFO.adoc", content-type = "text/asciidoc"}
generates the error:

ValueError: Field `content-type` in the `project.readme` table must be one of the following: text/markdown, text/x-rst, text/plain

I tried to create a PR to add support for it but reading things around made me realize that it isn't as simple as adding the lines to support Asciidoc, but I couldn't get it from the specification it this is something totally forbidden.

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

1 participant