Skip to content

Commit 11607f9

Browse files
fix(project): use absolute github links on PyPi (#335)
1 parent b8b7ca0 commit 11607f9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pyproject.toml

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "finch-api"
33
version = "0.16.8"
44
description = "The official Python library for the Finch API"
5-
readme = "README.md"
5+
dynamic = ["readme"]
66
license = "Apache-2.0"
77
authors = [
88
{ name = "Finch", email = "[email protected]" },
@@ -88,7 +88,7 @@ typecheck = { chain = [
8888
"typecheck:mypy" = "mypy ."
8989

9090
[build-system]
91-
requires = ["hatchling"]
91+
requires = ["hatchling", "hatch-fancy-pypi-readme"]
9292
build-backend = "hatchling.build"
9393

9494
[tool.hatch.build]
@@ -99,6 +99,17 @@ include = [
9999
[tool.hatch.build.targets.wheel]
100100
packages = ["src/finch"]
101101

102+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
103+
content-type = "text/markdown"
104+
105+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
106+
path = "README.md"
107+
108+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
109+
# replace relative links with absolute links
110+
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
111+
replacement = '[\1](https://github.com/Finch-API/finch-api-python/tree/main/\g<2>)'
112+
102113
[tool.black]
103114
line-length = 120
104115
target-version = ["py37"]

0 commit comments

Comments
 (0)