Add support for hatch-fancy-pypi-readme in pyproject.toml

This update integrates `hatch-fancy-pypi-readme` to enhance PyPI package descriptions using fragments and substitutions. Adjustments include dynamic readme handling and metadata hooks for better customization of content. Updated the README table of contents to include new sections.
This commit is contained in:
2025-04-23 18:08:59 +02:00
parent 703a9aef34
commit 169656023c
2 changed files with 34 additions and 2 deletions

View File

@@ -1,10 +1,10 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"
[project]
name = "discord-progress-bar"
dynamic = ["version", "urls"]
dynamic = ["version", "urls", "readme"]
description = "A python library to easily create progress bars with discord emojis"
readme = "README.md"
authors = [
@@ -45,6 +45,34 @@ version-file = "src/discord_progress_bar/_version.py"
Homepage = "https://github.com/Paillat-dev/discord-progress-bar"
source_archive = "https://github.com/Paillat-dev/discord-progress-bar/archive/{commit_hash}.zip"
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "<!-- badges -->\n"
end-before = "\n<!-- end badges -->"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = "\n\n---\n"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "## Overview\n"
end-before = "\n## Installation"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "<!-- quick-start -->"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
replacement = '[\1](https://github.com/Paillat-dev/discord-progress-bar/tree/main\g<2>)'
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = '\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]'
replacement = '**\1**:'
[tool.hatchling]
name = "discord-progress-bar"