Download scripts/wheel_smoke.py from ayjays132/PhillNet_Recall: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/ayjays132/PhillNet_Recall/resolve/main/scripts/wheel_smoke.py
- Command line
-
hf download hf://ayjays132/PhillNet_Recall/scripts/wheel_smoke.py
-
curl -L -o wheel_smoke.py https://huggingface.co/ayjays132/PhillNet_Recall/resolve/main/scripts/wheel_smoke.py
1.7 kB
| """Install a wheel in a clean target and execute away from the source tree.""" | |
| from pathlib import Path | |
| import argparse,json,os,subprocess,sys,tempfile | |
| ROOT=Path(__file__).resolve().parents[1] | |
| CODE=''' | |
| import json,os | |
| from pathlib import Path | |
| import phillnet_recall as pr | |
| from phillnet_recall.showcase import run_demo | |
| assert pr.__version__=='1.2.0' | |
| assert Path(pr.__file__).resolve().is_relative_to(Path(os.environ['WHEEL_TARGET']).resolve()) | |
| with pr.RecallMemory(clock=lambda:100.) as m: | |
| assert m.policy.bank._lib is None | |
| m.remember_bridge('amber docket','incident register',source='synthetic') | |
| m.remember('incident register: Mira',source='synthetic') | |
| p=pr.pack_grounded(m,m.recall_grounded('amber docket'),budget=8192) | |
| assert p['dependency_complete'] | |
| for n in ['glossary','intersection','proof-budget','correction']:run_demo(n) | |
| print(json.dumps({'version':pr.__version__,'source_folder_not_used':True,'reference_execution':True,'four_demos':True,'grounded_packet':True,'native_binary_in_wheel':False})) | |
| ''' | |
| def main(): | |
| p=argparse.ArgumentParser();p.add_argument('wheel',type=Path);a=p.parse_args() | |
| with tempfile.TemporaryDirectory() as tmp: | |
| target=Path(tmp)/'installed';target.mkdir();cwd=Path(tmp)/'away';cwd.mkdir() | |
| subprocess.run([sys.executable,'-m','pip','install','--quiet','--no-deps','--target',str(target),str(a.wheel.resolve())],check=True) | |
| out=subprocess.check_output([sys.executable,'-c',CODE],cwd=cwd,env=dict(os.environ,PYTHONPATH=str(target),WHEEL_TARGET=str(target)),text=True) | |
| report=json.loads(out);(ROOT/'reports/wheel_smoke_v12.json').write_text(json.dumps(report,indent=2)+'\n');print(out) | |
| if __name__=='__main__':main() | |