From a94e2213458786bb0075d8a802dcb2fc6ae07b6f Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Mon, 2 Jun 2025 19:07:49 +1000 Subject: [PATCH 1/5] feat: add a Makefile goal `simple-index` that generates a PEP-503 compatible Simple Index directory inside the dist --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index 061534ff..b3461862 100644 --- a/Makefile +++ b/Makefile @@ -187,6 +187,18 @@ dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-docs-md.zip: docs-md dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt: echo $(SOURCE_DATE_EPOCH) > dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt +# Build a PEP-503 compatible Simple Repository compatible directory inside of dist/. +# For details on the layout of that directory, see: https://peps.python.org/pep-0503/ +# This directory can then be used to install (hashed) artifacts from using `pip` and +# its `--extra-index-url` argument: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url +.PHONY: simple-index +simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz + mkdir -p dist/simple-index/$(PACKAGE_NAME) + echo -e "\n$(PACKAGE_NAME)" > dist/simple-index/index.html + echo -e "\n$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PACKAGE_NAME)/index.html + cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PACKAGE_NAME)/ + cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PACKAGE_NAME)/ + # Build the HTML and Markdown documentation from the package's source. DOCS_SOURCE := $(shell git ls-files docs/source) .PHONY: docs docs-html docs-md From 6a21f859f68286f95a37fce9b68702ad0ee4dc72 Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Mon, 2 Jun 2025 19:29:42 +1000 Subject: [PATCH 2/5] chore: gah, fixt typos --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b3461862..9c362764 100644 --- a/Makefile +++ b/Makefile @@ -187,9 +187,9 @@ dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-docs-md.zip: docs-md dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt: echo $(SOURCE_DATE_EPOCH) > dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt -# Build a PEP-503 compatible Simple Repository compatible directory inside of dist/. -# For details on the layout of that directory, see: https://peps.python.org/pep-0503/ -# This directory can then be used to install (hashed) artifacts from using `pip` and +# Build a PEP-503 compatible Simple Repository directory inside of dist/. For details on +# the layout of that directory, see: https://peps.python.org/pep-0503/ +# The directory can then be used to install (hashed) artifacts by using `pip` and # its `--extra-index-url` argument: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url .PHONY: simple-index simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz From 1e30330d21bc2b691a74d15767aecb3cfb38d110 Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Wed, 4 Jun 2025 10:56:08 +1000 Subject: [PATCH 3/5] fix: normalize the Simple Repo project name from the package name as per PEP 503 --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9c362764..efb03a88 100644 --- a/Makefile +++ b/Makefile @@ -188,16 +188,17 @@ dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt: echo $(SOURCE_DATE_EPOCH) > dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-build-epoch.txt # Build a PEP-503 compatible Simple Repository directory inside of dist/. For details on -# the layout of that directory, see: https://peps.python.org/pep-0503/ +# the layout of that directory and the normalized project name, see: https://peps.python.org/pep-0503/ # The directory can then be used to install (hashed) artifacts by using `pip` and # its `--extra-index-url` argument: https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url +PROJECT_NAME := $(shell python -c $$'import re; print(re.sub(r"[-_.]+", "-", "$(PACKAGE_NAME)").lower());') .PHONY: simple-index simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz - mkdir -p dist/simple-index/$(PACKAGE_NAME) + mkdir -p dist/simple-index/$(PROJECT_NAME) echo -e "\n$(PACKAGE_NAME)" > dist/simple-index/index.html - echo -e "\n$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PACKAGE_NAME)/index.html - cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PACKAGE_NAME)/ - cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PACKAGE_NAME)/ + echo -e "\n$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PROJECT_NAME)/index.html + cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PROJECT_NAME)/ + cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PROJECT_NAME)/ # Build the HTML and Markdown documentation from the package's source. DOCS_SOURCE := $(shell git ls-files docs/source) From 90afde88f89caf191757cd47370b3775594a3baf Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Thu, 5 Jun 2025 10:00:19 -1000 Subject: [PATCH 4/5] chore: add hash fragments to package URLs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index efb03a88..07e80d89 100644 --- a/Makefile +++ b/Makefile @@ -196,7 +196,7 @@ PROJECT_NAME := $(shell python -c $$'import re; print(re.sub(r"[-_.]+", "-", "$( simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz mkdir -p dist/simple-index/$(PROJECT_NAME) echo -e "\n$(PACKAGE_NAME)" > dist/simple-index/index.html - echo -e "\n$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PROJECT_NAME)/index.html + echo -e "\n$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PROJECT_NAME)/index.html cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PROJECT_NAME)/ cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PROJECT_NAME)/ From ea850986a485c3e26adadf9d7ab69e33c12f90d6 Mon Sep 17 00:00:00 2001 From: Jens Troeger Date: Thu, 5 Jun 2025 10:10:49 -1000 Subject: [PATCH 5/5] chore: validate generated index.html files --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 07e80d89..581903e6 100644 --- a/Makefile +++ b/Makefile @@ -195,8 +195,8 @@ PROJECT_NAME := $(shell python -c $$'import re; print(re.sub(r"[-_.]+", "-", "$( .PHONY: simple-index simple-index: dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz mkdir -p dist/simple-index/$(PROJECT_NAME) - echo -e "\n$(PACKAGE_NAME)" > dist/simple-index/index.html - echo -e "\n$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PROJECT_NAME)/index.html + echo -e "\nSimple Index$(PACKAGE_NAME)" > dist/simple-index/index.html + echo -e "\nSimple Index: $(PROJECT_NAME)$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz" > dist/simple-index/$(PROJECT_NAME)/index.html cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)-py3-none-any.whl dist/simple-index/$(PROJECT_NAME)/ cp -f dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz dist/simple-index/$(PROJECT_NAME)/