chore: use micromamba and uv to manage python environment

This commit is contained in:
2026-03-18 17:46:11 +08:00
parent 431f6844ef
commit 5885702bed
10 changed files with 1066 additions and 1503 deletions

2
.envrc
View File

@@ -9,4 +9,4 @@ eval "$(devenv direnvrc)"
# To silence all output, use `--quiet`.
#
# Example usage: use devenv --quiet --impure --option services.postgres.enable:bool true
use devenv -i
use devenv

View File

@@ -0,0 +1,17 @@
upload:
rsync -avLh --progress --stats --itemize-changes \
--exclude='.jj/' \
--exclude='.git/' \
--exclude='.devenv/' \
--exclude='.direnv/' \
--exclude='deps/' \
--exclude='outputs/' \
--exclude='data/versioned_data/' \
. ial-jumper-ial-pangyg:/home/ial-pangyg/docker-workspace/projects/mini-nav/
sync-pkgs:
export UV_PROJECT_ENVIRONMENT="/workspace/envs/mini-nav/" && uv sync --inexact
sync-data:
python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path data/
python -m habitat_sim.utils.datasets_download --uids habitat_example_objects --data-path data/

View File

@@ -1 +1 @@
3.13
3.10

104
AGENTS.md
View File

@@ -1,104 +0,0 @@
# Memorix — Automatic Memory Rules
You have access to Memorix memory tools. Follow these rules to maintain persistent context across sessions.
## RULE 1: Session Start — Load Context
At the **beginning of every conversation**, BEFORE responding to the user:
1. Call `memorix_session_start` to get the previous session summary and key memories (this is a direct read, not a search — no fragmentation risk)
2. Then call `memorix_search` with a query related to the user's first message for additional context
3. If search results are found, use `memorix_detail` to fetch the most relevant ones
4. Reference relevant memories naturally — the user should feel you "remember" them
## RULE 2: Store Important Context
**Proactively** call `memorix_store` when any of the following happen:
### What MUST be recorded:
- Architecture/design decisions → type: `decision`
- Bug identified and fixed → type: `problem-solution`
- Unexpected behavior or gotcha → type: `gotcha`
- Config changed (env vars, ports, deps) → type: `what-changed`
- Feature completed or milestone → type: `what-changed`
- Trade-off discussed with conclusion → type: `trade-off`
### What should NOT be recorded:
- Simple file reads, greetings, trivial commands (ls, pwd, git status)
### Use topicKey for evolving topics:
For decisions, architecture docs, or any topic that evolves over time, ALWAYS use `topicKey` parameter.
This ensures the memory is UPDATED instead of creating duplicates.
Use `memorix_suggest_topic_key` to generate a stable key.
Example: `topicKey: "architecture/auth-model"` — subsequent stores with the same key update the existing memory.
### Track progress with the progress parameter:
When working on features or tasks, include the `progress` parameter:
```json
{
"progress": {
"feature": "user authentication",
"status": "in-progress",
"completion": 60
}
}
```
Status values: `in-progress`, `completed`, `blocked`
## RULE 3: Resolve Completed Memories
When a task is completed, a bug is fixed, or information becomes outdated:
1. Call `memorix_resolve` with the observation IDs to mark them as resolved
2. Resolved memories are hidden from default search, preventing context pollution
This is critical — without resolving, old bug reports and completed tasks will keep appearing in future searches.
## RULE 4: Session End — Store Decision Chain Summary
When the conversation is ending, create a **decision chain summary** (not just a checklist):
1. Call `memorix_store` with type `session-request` and `topicKey: "session/latest-summary"`:
**Required structure:**
```
## Goal
[What we were working on — specific, not vague]
## Key Decisions & Reasoning
- Chose X because Y. Rejected Z because [reason].
- [Every architectural/design decision with WHY]
## What Changed
- [File path] — [what changed and why]
## Current State
- [What works now, what's pending]
- [Any blockers or risks]
## Next Steps
- [Concrete next actions, in priority order]
```
**Critical: Include the "Key Decisions & Reasoning" section.** Without it, the next AI session will lack the context to understand WHY things were done a certain way and may suggest conflicting approaches.
2. Call `memorix_resolve` on any memories for tasks completed in this session
## RULE 5: Compact Awareness
Memorix automatically compacts memories on store:
- **With LLM API configured:** Smart dedup — extracts facts, compares with existing, merges or skips duplicates
- **Without LLM (free mode):** Heuristic dedup — uses similarity scores to detect and merge duplicate memories
- **You don't need to manually deduplicate.** Just store naturally and compact handles the rest.
- If you notice excessive duplicate memories, call `memorix_deduplicate` for batch cleanup.
## Guidelines
- **Use concise titles** (~5-10 words) and structured facts
- **Include file paths** in filesModified when relevant
- **Include related concepts** for better searchability
- **Always use topicKey** for recurring topics to prevent duplicates
- **Always resolve** completed tasks and fixed bugs
- **Always include reasoning** — "chose X because Y" is 10x more valuable than "did X"
- Search defaults to `status="active"` — use `status="all"` to include resolved memories

View File

@@ -3,10 +3,11 @@
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1769601151,
"lastModified": 1773767086,
"narHash": "sha256-3eKyl4LXswf6P17/u59x8oQXDgCfYX+UX0uh7YHFwJc=",
"owner": "cachix",
"repo": "devenv",
"rev": "b2ef1164b4f330d6b11c6ad3da962452eab7b3bb",
"rev": "a5e5a7f8b1c9a7f33f9d82192b692768b39ec710",
"type": "github"
},
"original": {
@@ -16,27 +17,13 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
@@ -48,47 +35,6 @@
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1769069492,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "a1ef738813b15cf8ec759bdff5761b027e3e1d23",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762808025,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixgl": {
"inputs": {
"flake-utils": "flake-utils",
@@ -98,6 +44,7 @@
},
"locked": {
"lastModified": 1762090880,
"narHash": "sha256-fbRQzIGPkjZa83MowjbD2ALaJf9y6KMDdJBQMKFeY/8=",
"owner": "nix-community",
"repo": "nixGL",
"rev": "b6105297e6f0cd041670c3e8628394d4ee247ed5",
@@ -110,11 +57,15 @@
}
},
"nixpkgs": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
},
"locked": {
"lastModified": 1767052823,
"lastModified": 1773704619,
"narHash": "sha256-LKtmit8Sr81z8+N2vpIaN/fyiQJ8f7XJ6tMSKyDVQ9s=",
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "538a5124359f0b3d466e1160378c87887e3b51a4",
"rev": "906534d75b0e2fe74a719559dfb1ad3563485f43",
"type": "github"
},
"original": {
@@ -124,20 +75,34 @@
"type": "github"
}
},
"nixpkgs-src": {
"flake": false,
"locked": {
"lastModified": 1773597492,
"narHash": "sha256-hQ284SkIeNaeyud+LS0WVLX+WL2rxcVZLFEaK0e03zg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a07d4ce6bee67d7c838a8a5796e75dff9caa21ef",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",

View File

@@ -15,47 +15,18 @@
nvidiaVersion = "580.126.09";
};
in {
# https://devenv.sh/basics/
# env.GREET = "devenv";
# https://devenv.sh/packages/
packages = [
pkgs-nixgl.auto.nixGLNvidia
];
# https://devenv.sh/languages/
# languages.rust.enable = true;
# https://devenv.sh/processes/
# processes.dev.exec = "${lib.getExe pkgs.watchexec} -n -- ls -la";
# https://devenv.sh/services/
# services.postgres.enable = true;
# https://devenv.sh/scripts/
# scripts.hello.exec = ''
# echo hello from $GREET
# '';
# https://devenv.sh/basics/
enterShell = ''
source ./.venv/bin/activate
export UV_PROJECT_ENVIRONMENT=$HOME/local/share/mamba/envs/mini-nav/bin/
eval "$(micromamba shell hook --shell bash)"
micromamba activate mini-nav
which uv
which python
'';
# https://devenv.sh/tasks/
# tasks = {
# "myproj:setup".exec = "mytool build";
# "devenv:enterShell".after = [ "myproj:setup" ];
# };
# https://devenv.sh/tests/
# enterTest = ''
# echo "Running tests"
# git --version | grep --color=auto "${pkgs.git.version}"
# '';
# https://devenv.sh/git-hooks/
# git-hooks.hooks.shellcheck.enable = true;
# See full reference at https://devenv.sh/reference/options/
}

19
environment.yml Normal file
View File

@@ -0,0 +1,19 @@
name: mini-nav
channels:
- pytorch
- nvidia
- conda-forge
- aihabitat-nightly
dependencies:
- python=3.10
- pip
- habitat-sim=0.3.3
- withbullet
- pytorch
- torchvision
- pytorch-cuda=12.1
# Toolsets
- uv
- just
- git
- git-lfs

21
mini-nav/habitat/test.py Normal file
View File

@@ -0,0 +1,21 @@
import habitat_sim
sim_cfg = habitat_sim.SimulatorConfiguration()
sim_cfg.scene_id = "data/scene_datasets/habitat-test-scenes/skokloster-castle.glb"
color_sensor = habitat_sim.CameraSensorSpec()
color_sensor.uuid = "color_sensor"
color_sensor.sensor_type = habitat_sim.SensorType.COLOR
color_sensor.resolution = [480, 640]
color_sensor.position = [0.0, 1.5, 0.0]
agent_cfg = habitat_sim.AgentConfiguration()
agent_cfg.sensor_specifications = [color_sensor]
cfg = habitat_sim.Configuration(sim_cfg, [agent_cfg])
sim = habitat_sim.Simulator(cfg)
obs = sim.get_sensor_observations()
print("obs keys:", obs.keys())
rgb = obs["color_sensor"]
print(rgb.shape)

View File

@@ -3,24 +3,18 @@ name = "mini-nav"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
requires-python = ">=3.10"
dependencies = [
"accelerate>=1.12.0",
"dash>=3.4.0",
"dash-ag-grid>=33.3.3",
"dash-mantine-components>=2.5.1",
"datasets>=4.5.0",
"habitat-baselines>=0.3.320250127",
"habitat-lab>=0.3.320250127",
"habitat-sim-uv-wheels-experimental>=0.2.2a2",
"httpx[socks]>=0.28.1",
"lancedb>=0.27.1",
"polars[database,numpy,pandas,pydantic]>=1.37.1",
"pyarrow>=23.0.0",
"pydantic>=2.12.5",
"scikit-learn>=1.7.2",
"torch>=2.10.0",
"torchvision>=0.25.0",
"transformers>=5.0.0",
"typer>=0.24.1",
]
@@ -28,22 +22,10 @@ dependencies = [
[dependency-groups]
dev = [
"basedpyright>=1.37.4",
"pip>=26.0.1",
"pytest>=9.0.2",
"pytest-mpi>=0.6",
]
[[tool.uv.index]]
name = "pytorch-cu130"
url = "https://download.pytorch.org/whl/cu130"
explicit = true
[tool.uv.sources]
torch = [
{ index = "pytorch-cu130", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
torchvision = [
{ index = "pytorch-cu130", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
]
[tool.ty.environment]
root = ["./mini-nav"]

2242
uv.lock generated

File diff suppressed because it is too large Load Diff