|
1 | 1 | [build-system]
|
2 |
| -requires = ["hatchling >=1.11.1,<2.0.0", "hatch-vcs >=0.3.0,<0.4"] |
| 2 | +requires = ["hatchling >=1.11.1,<2.0.0", "hatch-vcs >=0.3.0,<0.4", "hatch-fancy-pypi-readme"] |
3 | 3 | build-backend = "hatchling.build"
|
4 | 4 |
|
5 | 5 | [project]
|
6 | 6 | name = "labelle"
|
7 | 7 | description = "Open-source label printing software"
|
8 |
| -readme = "README.md" |
9 | 8 | url = "https://github.com/labelle-org/labelle"
|
10 | 9 | authors = [{ name = "Sebastian J. Bronner", email = "[email protected]"}]
|
11 | 10 | maintainers = [
|
@@ -35,7 +34,7 @@ classifiers = [
|
35 | 34 | "Programming Language :: Python :: 3.12",
|
36 | 35 | "Topic :: Printing",
|
37 | 36 | ]
|
38 |
| -dynamic = ["version"] |
| 37 | +dynamic = ["version", "readme"] |
39 | 38 | requires-python = ">=3.8,<4"
|
40 | 39 |
|
41 | 40 | [project.optional-dependencies]
|
@@ -66,6 +65,30 @@ version-file = "src/labelle/_version.py"
|
66 | 65 | [tool.hatch.build.targets.wheel]
|
67 | 66 | packages = ["src/labelle"]
|
68 | 67 |
|
| 68 | +# <https://github.com/hynek/hatch-fancy-pypi-readme> |
| 69 | +[tool.hatch.metadata.hooks.fancy-pypi-readme] |
| 70 | +content-type = "text/markdown" |
| 71 | + |
| 72 | +[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] |
| 73 | +path = "README.md" |
| 74 | + |
| 75 | +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] |
| 76 | +# Image links should go to the raw content on GitHub |
| 77 | +# <https://stackoverflow.com/a/46875147> |
| 78 | +pattern = '\[(.*?)\]\(((?!https?://)\S+\.(png|jpe?g|svg|gif))\)' |
| 79 | +replacement = '[\1](https://raw.githubusercontent.com/labelle-org/labelle/main/\g<2>)' |
| 80 | + |
| 81 | +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] |
| 82 | +# Handle also HTML image tags |
| 83 | +pattern = '''(<img\b[^>]*\bsrc=)(['"])((?!https?://)[^'"]+)(['"][^>]*>)''' |
| 84 | +replacement = '<img src="https://raw.githubusercontent.com/labelle-org/labelle/main/\g<3>\g<4>' |
| 85 | + |
| 86 | +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] |
| 87 | +# Remaining non-image relative links map to the normal absolute GitHub URL |
| 88 | +# <https://stackoverflow.com/a/46875147> |
| 89 | +pattern = '\[(.*?)\]\(((?!https?://)\S+)\)' |
| 90 | +replacement = '[\1](https://github.com/labelle-org/labelle/tree/main/\g<2>)' |
| 91 | + |
69 | 92 | [tool.tox]
|
70 | 93 | legacy_tox_ini = """
|
71 | 94 | [tox]
|
|
0 commit comments