Skip to content

Commit 94cd528

Browse files
fix(project): use absolute github links on PyPi (#1280)
1 parent fdc126e commit 94cd528

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 = "openai"
33
version = "1.14.3"
44
description = "The official Python library for the openai API"
5-
readme = "README.md"
5+
dynamic = ["readme"]
66
license = "Apache-2.0"
77
authors = [
88
{ name = "OpenAI", email = "[email protected]" },
@@ -93,7 +93,7 @@ typecheck = { chain = [
9393
"typecheck:mypy" = "mypy ."
9494

9595
[build-system]
96-
requires = ["hatchling"]
96+
requires = ["hatchling", "hatch-fancy-pypi-readme"]
9797
build-backend = "hatchling.build"
9898

9999
[tool.hatch.build]
@@ -104,6 +104,17 @@ include = [
104104
[tool.hatch.build.targets.wheel]
105105
packages = ["src/openai"]
106106

107+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
108+
content-type = "text/markdown"
109+
110+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
111+
path = "README.md"
112+
113+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
114+
# replace relative links with absolute links
115+
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
116+
replacement = '[\1](https://github.com/openai/openai-python/tree/main/\g<2>)'
117+
107118
[tool.black]
108119
line-length = 120
109120
target-version = ["py37"]

0 commit comments

Comments
 (0)