From 15bc223865de096c18df06f8617387759d0a6b00 Mon Sep 17 00:00:00 2001 From: Hansong Zhang <107070759+kirklandsign@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:02:58 -0700 Subject: [PATCH 1/7] Update conf.py --- docs/source/conf.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index 7128e34ed8d..fd7dd25b7ea 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -142,6 +142,12 @@ autodoc_typehints = "none" +html_context = { + "version": version, + "aar_version": "0.7.0", +} + + # Add any paths that contain templates here, relative to this directory. # templates_path = ["../_templates"] From d11b50f8dd4d6734c18e4a83aac77c459d894bf2 Mon Sep 17 00:00:00 2001 From: Hansong Zhang <107070759+kirklandsign@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:04:01 -0700 Subject: [PATCH 2/7] Update getting-started.md --- docs/source/getting-started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index be15e7d6ea2..0e19da4daab 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -124,7 +124,7 @@ To add the library to your app, add the following dependency to gradle build rul ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:0.6.0") + implementation("org.pytorch:executorch-android:{{ aar_version }}") } # See latest available versions in https://mvnrepository.com/artifact/org.pytorch/executorch-android From 9f0e5b1a579a7cf48c1afecae5e03a7f50b0b13f Mon Sep 17 00:00:00 2001 From: Hansong Zhang <107070759+kirklandsign@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:05:01 -0700 Subject: [PATCH 3/7] Update using-executorch-android.md --- docs/source/using-executorch-android.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/using-executorch-android.md b/docs/source/using-executorch-android.md index 8ac179d325d..bd7afd726aa 100644 --- a/docs/source/using-executorch-android.md +++ b/docs/source/using-executorch-android.md @@ -28,13 +28,13 @@ The AAR library can be used for generic Android device with arm64-v8a or x86_64 ExecuTorch is available on [Maven Central](https://mvnrepository.com/artifact/org.pytorch/executorch-android). -Simply add the target [`org.pytorch:executorch-android:0.6.0-rc1`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/0.6.0-rc1/) to your Android app dependency (build.gradle), and build your app. +Simply add the target [`org.pytorch:executorch-android:{{ aar_version }}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/{{ aar_version }}/) to your Android app dependency (build.gradle), and build your app. For example: ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:0.6.0-rc1") + implementation("org.pytorch:executorch-android:{{ aar_version }}") } ``` @@ -53,7 +53,7 @@ You can also directly specify an AAR file in the app. We upload pre-built AAR to | Version | AAR | SHASUMS | | ------- | --- | ------- | -| [v0.6.0-rc1](https://github.com/pytorch/executorch/releases/tag/v0.6.0-rc1) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0-rc1/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0-rc1/executorch.aar.sha256sums) | +| [{{ aar_version }}](https://github.com/pytorch/executorch/releases/tag/{{ aar_version }}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/{{ aar_version }}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/{{ aar_version }}/executorch.aar.sha256sums) | | [v0.5.0](https://github.com/pytorch/executorch/releases/tag/v0.5.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar.sha256sums) | ### Snapshots from main branch @@ -90,7 +90,7 @@ implementation("com.facebook.fbjni:fbjni:0.5.1") In your app working directory, such as executorch/examples/demo-apps/android/LlamaDemo, ``` mkdir -p app/libs -curl https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0-rc1/executorch.aar -o app/libs/executorch.aar +curl https://ossci-android.s3.amazonaws.com/executorch/release/{{ aar_version }}/executorch.aar -o app/libs/executorch.aar ``` And include it in gradle: From 70edd923e4b478cd5f980ab9072fa439ae3b8595 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 12 Aug 2025 15:59:06 -0700 Subject: [PATCH 4/7] Another approach --- docs/source/conf.py | 6 ------ docs/source/executorch_custom_versions.py | 7 ++++++- docs/source/getting-started.md | 2 +- docs/source/using-executorch-android.md | 9 +++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index fd7dd25b7ea..7128e34ed8d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -142,12 +142,6 @@ autodoc_typehints = "none" -html_context = { - "version": version, - "aar_version": "0.7.0", -} - - # Add any paths that contain templates here, relative to this directory. # templates_path = ["../_templates"] diff --git a/docs/source/executorch_custom_versions.py b/docs/source/executorch_custom_versions.py index 29c48a337ea..bb03e989a18 100644 --- a/docs/source/executorch_custom_versions.py +++ b/docs/source/executorch_custom_versions.py @@ -11,6 +11,8 @@ .ci/docker/ci_commit_pins directory, and uses them to expand specific strings in markdown files. +Users can also specify their custom version strings in the global variable `variables` + For example, `${executorch_version:pytorch}` will be replaced with the appropriate pytorch version string used by CI. """ @@ -24,7 +26,10 @@ "pytorch.txt", ] -variables: dict[str, str] = {} + +variables: dict[str, str] = { + "aar_version": "0.7.0", +} def read_version_files(): diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index 0e19da4daab..cbec5557785 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -124,7 +124,7 @@ To add the library to your app, add the following dependency to gradle build rul ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:{{ aar_version }}") + implementation("org.pytorch:executorch-android:{{ executorch_version:aar_version }}") } # See latest available versions in https://mvnrepository.com/artifact/org.pytorch/executorch-android diff --git a/docs/source/using-executorch-android.md b/docs/source/using-executorch-android.md index bd7afd726aa..16f53572c24 100644 --- a/docs/source/using-executorch-android.md +++ b/docs/source/using-executorch-android.md @@ -28,13 +28,13 @@ The AAR library can be used for generic Android device with arm64-v8a or x86_64 ExecuTorch is available on [Maven Central](https://mvnrepository.com/artifact/org.pytorch/executorch-android). -Simply add the target [`org.pytorch:executorch-android:{{ aar_version }}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/{{ aar_version }}/) to your Android app dependency (build.gradle), and build your app. +Simply add the target [`org.pytorch:executorch-android:{{ executorch_version:aar_version }}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/{{ executorch_version:aar_version }}/) to your Android app dependency (build.gradle), and build your app. For example: ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:{{ aar_version }}") + implementation("org.pytorch:executorch-android:{{ executorch_version:aar_version }}") } ``` @@ -53,7 +53,8 @@ You can also directly specify an AAR file in the app. We upload pre-built AAR to | Version | AAR | SHASUMS | | ------- | --- | ------- | -| [{{ aar_version }}](https://github.com/pytorch/executorch/releases/tag/{{ aar_version }}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/{{ aar_version }}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/{{ aar_version }}/executorch.aar.sha256sums) | +| [{{ executorch_version:aar_version }}](https://github.com/pytorch/executorch/releases/tag/{{ executorch_version:aar_version }}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/{{ executorch_version:aar_version }}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/{{ executorch_version:aar_version }}/executorch.aar.sha256sums) | +| [v0.6.0](https://github.com/pytorch/executorch/releases/tag/v0.6.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar.sha256sums) | | [v0.5.0](https://github.com/pytorch/executorch/releases/tag/v0.5.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar.sha256sums) | ### Snapshots from main branch @@ -90,7 +91,7 @@ implementation("com.facebook.fbjni:fbjni:0.5.1") In your app working directory, such as executorch/examples/demo-apps/android/LlamaDemo, ``` mkdir -p app/libs -curl https://ossci-android.s3.amazonaws.com/executorch/release/{{ aar_version }}/executorch.aar -o app/libs/executorch.aar +curl https://ossci-android.s3.amazonaws.com/executorch/release/{{ executorch_version:aar_version }}/executorch.aar -o app/libs/executorch.aar ``` And include it in gradle: From e1fa7708afe5ef74509f7cbdcd252947481c512d Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 12 Aug 2025 16:47:55 -0700 Subject: [PATCH 5/7] Fix --- docs/source/getting-started.md | 2 +- docs/source/using-executorch-android.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index cbec5557785..d5d0a36cd2e 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -124,7 +124,7 @@ To add the library to your app, add the following dependency to gradle build rul ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:{{ executorch_version:aar_version }}") + implementation("org.pytorch:executorch-android:${executorch_version:aar_version}") } # See latest available versions in https://mvnrepository.com/artifact/org.pytorch/executorch-android diff --git a/docs/source/using-executorch-android.md b/docs/source/using-executorch-android.md index 16f53572c24..943d9810f7c 100644 --- a/docs/source/using-executorch-android.md +++ b/docs/source/using-executorch-android.md @@ -28,13 +28,13 @@ The AAR library can be used for generic Android device with arm64-v8a or x86_64 ExecuTorch is available on [Maven Central](https://mvnrepository.com/artifact/org.pytorch/executorch-android). -Simply add the target [`org.pytorch:executorch-android:{{ executorch_version:aar_version }}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/{{ executorch_version:aar_version }}/) to your Android app dependency (build.gradle), and build your app. +Simply add the target [`org.pytorch:executorch-android:${executorch_version:aar_version}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/${executorch_version:aar_version}/) to your Android app dependency (build.gradle), and build your app. For example: ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:{{ executorch_version:aar_version }}") + implementation("org.pytorch:executorch-android:${executorch_version:aar_version}") } ``` @@ -53,7 +53,7 @@ You can also directly specify an AAR file in the app. We upload pre-built AAR to | Version | AAR | SHASUMS | | ------- | --- | ------- | -| [{{ executorch_version:aar_version }}](https://github.com/pytorch/executorch/releases/tag/{{ executorch_version:aar_version }}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/{{ executorch_version:aar_version }}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/{{ executorch_version:aar_version }}/executorch.aar.sha256sums) | +| [${executorch_version:aar_version}](https://github.com/pytorch/executorch/releases/tag/${executorch_version:aar_version}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version:aar_version}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version:aar_version}/executorch.aar.sha256sums) | | [v0.6.0](https://github.com/pytorch/executorch/releases/tag/v0.6.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar.sha256sums) | | [v0.5.0](https://github.com/pytorch/executorch/releases/tag/v0.5.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar.sha256sums) | @@ -91,7 +91,7 @@ implementation("com.facebook.fbjni:fbjni:0.5.1") In your app working directory, such as executorch/examples/demo-apps/android/LlamaDemo, ``` mkdir -p app/libs -curl https://ossci-android.s3.amazonaws.com/executorch/release/{{ executorch_version:aar_version }}/executorch.aar -o app/libs/executorch.aar +curl https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version:aar_version}/executorch.aar -o app/libs/executorch.aar ``` And include it in gradle: From 9f3c320ff46b311a2d48369f0b5765018aa3fbde Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 12 Aug 2025 17:37:26 -0700 Subject: [PATCH 6/7] Update --- docs/source/executorch_custom_versions.py | 15 +++++++-------- docs/source/getting-started.md | 2 +- docs/source/using-executorch-android.md | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/source/executorch_custom_versions.py b/docs/source/executorch_custom_versions.py index bb03e989a18..da873a004d2 100644 --- a/docs/source/executorch_custom_versions.py +++ b/docs/source/executorch_custom_versions.py @@ -7,12 +7,13 @@ """ Sphinx extension to replace ${executorch_version:TAG} with version numbers. +It also defines a special variable ${executorch_version} that is set to the value +of `EXECUTORCH_VERSION` defined in this file. + This custom extension pulls third-party version strings from files in the .ci/docker/ci_commit_pins directory, and uses them to expand specific strings in markdown files. -Users can also specify their custom version strings in the global variable `variables` - For example, `${executorch_version:pytorch}` will be replaced with the appropriate pytorch version string used by CI. """ @@ -26,13 +27,11 @@ "pytorch.txt", ] - -variables: dict[str, str] = { - "aar_version": "0.7.0", -} +EXECUTORCH_VERSION = "0.7.0" -def read_version_files(): +def populate_version_variable(): + variables["${executorch_version}"] = EXECUTORCH_VERSION cwd = os.getcwd() version_file_path = os.path.join(cwd, "..", ".ci", "docker", "ci_commit_pins") @@ -43,7 +42,7 @@ def read_version_files(): variables[var_name] = f.read().strip() -read_version_files() +populate_version_variable() def replace_variables(app, doctree, docname): diff --git a/docs/source/getting-started.md b/docs/source/getting-started.md index d5d0a36cd2e..dc0cade3fbb 100644 --- a/docs/source/getting-started.md +++ b/docs/source/getting-started.md @@ -124,7 +124,7 @@ To add the library to your app, add the following dependency to gradle build rul ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:${executorch_version:aar_version}") + implementation("org.pytorch:executorch-android:${executorch_version}") } # See latest available versions in https://mvnrepository.com/artifact/org.pytorch/executorch-android diff --git a/docs/source/using-executorch-android.md b/docs/source/using-executorch-android.md index 943d9810f7c..ade9a8d665c 100644 --- a/docs/source/using-executorch-android.md +++ b/docs/source/using-executorch-android.md @@ -28,13 +28,13 @@ The AAR library can be used for generic Android device with arm64-v8a or x86_64 ExecuTorch is available on [Maven Central](https://mvnrepository.com/artifact/org.pytorch/executorch-android). -Simply add the target [`org.pytorch:executorch-android:${executorch_version:aar_version}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/${executorch_version:aar_version}/) to your Android app dependency (build.gradle), and build your app. +Simply add the target [`org.pytorch:executorch-android:${executorch_version}`](https://repo.maven.apache.org/maven2/org/pytorch/executorch-android/${executorch_version}/) to your Android app dependency (build.gradle), and build your app. For example: ``` # app/build.gradle.kts dependencies { - implementation("org.pytorch:executorch-android:${executorch_version:aar_version}") + implementation("org.pytorch:executorch-android:${executorch_version}") } ``` @@ -53,7 +53,7 @@ You can also directly specify an AAR file in the app. We upload pre-built AAR to | Version | AAR | SHASUMS | | ------- | --- | ------- | -| [${executorch_version:aar_version}](https://github.com/pytorch/executorch/releases/tag/${executorch_version:aar_version}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version:aar_version}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version:aar_version}/executorch.aar.sha256sums) | +| [${executorch_version}](https://github.com/pytorch/executorch/releases/tag/${executorch_version}) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version}/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version}/executorch.aar.sha256sums) | | [v0.6.0](https://github.com/pytorch/executorch/releases/tag/v0.6.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.6.0/executorch.aar.sha256sums) | | [v0.5.0](https://github.com/pytorch/executorch/releases/tag/v0.5.0) | [executorch.aar](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar) | [executorch.aar.sha256sums](https://ossci-android.s3.amazonaws.com/executorch/release/v0.5.0-rc3/executorch.aar.sha256sums) | @@ -91,7 +91,7 @@ implementation("com.facebook.fbjni:fbjni:0.5.1") In your app working directory, such as executorch/examples/demo-apps/android/LlamaDemo, ``` mkdir -p app/libs -curl https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version:aar_version}/executorch.aar -o app/libs/executorch.aar +curl https://ossci-android.s3.amazonaws.com/executorch/release/${executorch_version}/executorch.aar -o app/libs/executorch.aar ``` And include it in gradle: From 4c03d305838f95dde533075810fdf5590f37917f Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 12 Aug 2025 17:50:20 -0700 Subject: [PATCH 7/7] Fix --- docs/source/executorch_custom_versions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/executorch_custom_versions.py b/docs/source/executorch_custom_versions.py index da873a004d2..590f21b10ec 100644 --- a/docs/source/executorch_custom_versions.py +++ b/docs/source/executorch_custom_versions.py @@ -29,6 +29,8 @@ EXECUTORCH_VERSION = "0.7.0" +variables: dict[str, str] = {} + def populate_version_variable(): variables["${executorch_version}"] = EXECUTORCH_VERSION