-
Notifications
You must be signed in to change notification settings - Fork 802
Make the SDK installable outside its repository #4044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5463811
fix(native): build bundled SDK sources in writable caches
TomCC7 73c2fd8
fix(packaging): build SDK assets during source installation
TomCC7 3b3d94d
Merge branch 'fix/sdk-source-install' into fix/sdk-native-builds
TomCC7 599e1a9
Merge branch 'feat/dimup-setup' into fix/sdk-source-install
TomCC7 a025256
fix(native): build Point-LIO without PCL visualization dependencies
TomCC7 3d4ce56
Merge branch 'feat/dimup-setup' into fix/sdk-source-install
TomCC7 4597864
Merge branch 'fix/sdk-source-install' into fix/sdk-native-builds
TomCC7 f01e5a6
Merge branch 'feat/dimup-setup' into fix/sdk-source-install
TomCC7 2dfcb43
Merge branch 'fix/sdk-source-install' into fix/sdk-native-builds
TomCC7 0d6b0c4
Merge branch 'feat/dimup-setup' into fix/sdk-source-install
TomCC7 e8fd54f
Merge branch 'fix/sdk-source-install' into fix/sdk-native-builds
TomCC7 e1db3b9
Merge branch 'feat/dimup-setup' into fix/sdk-source-install
TomCC7 4aac98e
Merge branch 'fix/sdk-source-install' into fix/sdk-native-builds
TomCC7 ab892b8
Merge branch 'feat/dimup-setup' into fix/sdk-native-builds
TomCC7 d09c757
refactor(installer): isolate SDK packaging from application creation
TomCC7 de0cd37
Merge branch 'feat/dimup-setup' into fix/sdk-native-builds
TomCC7 523b041
Merge branch 'feat/dimup-setup' into fix/sdk-native-builds
TomCC7 e18c102
Merge branch 'feat/dimup-setup' into fix/sdk-native-builds
TomCC7 b78d8b4
Merge branch 'feat/dimup-setup' into fix/sdk-native-builds
TomCC7 0264bc1
fix(packaging): make generated frontend assets optional
TomCC7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Writable native build sources belonging to the installed SDK.""" | ||
|
|
||
| from hashlib import sha256 | ||
| import os | ||
| from pathlib import Path | ||
| import platform | ||
| import shutil | ||
| import subprocess | ||
| import tarfile | ||
| import tempfile | ||
|
|
||
| from filelock import FileLock | ||
|
|
||
| from dimos.constants import CACHE_DIR, DIMOS_PROJECT_ROOT | ||
|
|
||
|
|
||
| def unpack_sources(bundle: Path, cache: Path) -> Path: | ||
| digest = sha256(bundle.read_bytes()).hexdigest() | ||
| root = cache / f"{digest}-{platform.system()}-{platform.machine()}" | ||
| cache.mkdir(parents=True, exist_ok=True) | ||
| with FileLock(str(root) + ".lock"): | ||
| if (root / ".git").is_dir(): | ||
| return root | ||
| temporary = Path(tempfile.mkdtemp(prefix="native-", dir=cache)) | ||
| try: | ||
| with tarfile.open(bundle) as archive: | ||
| archive.extractall(temporary, filter="data") | ||
| # Existing nested flakes use repository-relative inputs. A local | ||
| # snapshot lets Nix include their sibling sources without fetching | ||
| # another DimOS checkout or writing into site-packages. | ||
| (temporary / ".gitignore").write_text("target/\nresult\nresult-*\n.build.lock\n") | ||
| git_env = { | ||
| key: value for key, value in os.environ.items() if not key.startswith("GIT_") | ||
| } | ||
| git_env.update(GIT_CONFIG_GLOBAL=os.devnull, GIT_CONFIG_NOSYSTEM="1") | ||
| for args in ( | ||
| ["init", "--quiet"], | ||
| ["add", "."], | ||
| [ | ||
| "-c", | ||
| "user.name=DimOS", | ||
| "-c", | ||
| "user.email=build@dimos.invalid", | ||
| "-c", | ||
| "core.hooksPath=/dev/null", | ||
| "commit", | ||
| "--quiet", | ||
| "--no-gpg-sign", | ||
| "-m", | ||
| "Native SDK sources", | ||
| ], | ||
| ): | ||
| subprocess.run( | ||
| ["git", *args], cwd=temporary, env=git_env, check=True, capture_output=True | ||
| ) | ||
| temporary.rename(root) | ||
| finally: | ||
| if temporary.exists(): | ||
| shutil.rmtree(temporary) | ||
| return root | ||
|
|
||
|
|
||
| def native_source_root() -> Path: | ||
| bundle = Path(__file__).resolve().parents[1] / "_native_sources.tar" | ||
| if bundle.is_file(): | ||
| return unpack_sources(bundle, CACHE_DIR / "native") | ||
| if (DIMOS_PROJECT_ROOT / "Cargo.toml").is_file(): | ||
| return DIMOS_PROJECT_ROOT | ||
| raise FileNotFoundError("The DimOS SDK is missing its native sources. Reinstall the SDK.") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import tarfile | ||
|
|
||
| from dimos.core.native_sources import unpack_sources | ||
|
|
||
|
|
||
| def test_native_sources_are_reusable_writable_snapshots(tmp_path): | ||
| source = tmp_path / "Cargo.toml" | ||
| source.write_text("[workspace]\nmembers = []\n") | ||
| bundle = tmp_path / "sources.tar" | ||
| with tarfile.open(bundle, "w") as archive: | ||
| archive.add(source, arcname="Cargo.toml") | ||
| root = unpack_sources(bundle, tmp_path / "cache") | ||
| assert (root / "Cargo.toml").read_text() == source.read_text() | ||
| assert (root / ".git").is_dir() | ||
| (root / "target").mkdir() | ||
| assert unpack_sources(bundle, tmp_path / "cache") == root | ||
| assert (root / "target").is_dir() | ||
|
|
||
|
|
||
| def test_source_content_selects_separate_build_roots(tmp_path): | ||
| source = tmp_path / "Cargo.toml" | ||
| bundle = tmp_path / "sources.tar" | ||
| roots = [] | ||
| for version in ("one", "two"): | ||
| source.write_text(version) | ||
| with tarfile.open(bundle, "w") as archive: | ||
| archive.add(source, arcname="Cargo.toml") | ||
| roots.append(unpack_sources(bundle, tmp_path / "cache")) | ||
| assert roots[0] != roots[1] | ||
| assert (roots[0] / "Cargo.toml").read_text() == "one" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,6 +95,7 @@ class RustRecorderConfig(NativeModuleConfig): | |
|
|
||
| executable: str = "result/bin/dimos-memory-recorder" | ||
| build_command: str = "nix build -L .#dimos-memory-recorder" | ||
| bundled_sources: bool = True | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this mod? |
||
| cwd: str = "rust" | ||
| stdin_config: bool = True | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this single change allow source build to be working from pypi installation?