Commit 31a7e9ad

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2024-03-29 22:09:18
fix(project): use absolute github links on PyPi (#1280)
1 parent 1e55d60
Changed files (1)
pyproject.toml
@@ -2,7 +2,7 @@
 name = "openai"
 version = "1.14.3"
 description = "The official Python library for the openai API"
-readme = "README.md"
+dynamic = ["readme"]
 license = "Apache-2.0"
 authors = [
 { name = "OpenAI", email = "support@openai.com" },
@@ -93,7 +93,7 @@ typecheck = { chain = [
 "typecheck:mypy" = "mypy ."
 
 [build-system]
-requires = ["hatchling"]
+requires = ["hatchling", "hatch-fancy-pypi-readme"]
 build-backend = "hatchling.build"
 
 [tool.hatch.build]
@@ -104,6 +104,17 @@ include = [
 [tool.hatch.build.targets.wheel]
 packages = ["src/openai"]
 
+[tool.hatch.metadata.hooks.fancy-pypi-readme]
+content-type = "text/markdown"
+
+[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
+path = "README.md"
+
+[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
+# replace relative links with absolute links
+pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
+replacement = '[\1](https://github.com/openai/openai-python/tree/main/\g<2>)'
+
 [tool.black]
 line-length = 120
 target-version = ["py37"]