From 169656023cdd848ff0ad94521e95445d2acf6b9c Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Wed, 23 Apr 2025 18:08:59 +0200 Subject: [PATCH] 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. --- README.md | 4 ++++ pyproject.toml | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc25e65..367811b 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,13 @@ Discord bot messages. - [Different Progress Bar States](#different-progress-bar-states) - [Custom Progress Bar Length](#custom-progress-bar-length) - [Configuration](#configuration) + - [Bot Configuration](#bot-configuration) + - [Progress Bar Manager Initialization](#progress-bar-manager-initialization) + - [Custom Progress Bar Styles](#custom-progress-bar-styles) - [Limitations](#limitations) - [Getting Help](#getting-help) - [Development](#development) + - [Local Testing](#local-testing) - [Contributing](#contributing) - [License](#license) diff --git a/pyproject.toml b/pyproject.toml index 4e0430a..33964dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "\n" +end-before = "\n" + +[[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 = "" + +[[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"