chore(repo): initialize reproducible research workspace
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# 研究环境使用说明
|
||||
|
||||
## 激活
|
||||
|
||||
在项目根目录的 PowerShell 中运行:
|
||||
|
||||
```powershell
|
||||
. .\research\environment\activate-research.ps1
|
||||
```
|
||||
|
||||
该脚本会激活 `.venv-research`,设置项目内 R、R library、CUDA 13.4,并把 uv、renv、PyTensor、Numba、Matplotlib、Skrub、Hugging Face 与 Torch 缓存定向到项目目录。
|
||||
|
||||
## 验收
|
||||
|
||||
```powershell
|
||||
python .\research\environment\smoke_test.py
|
||||
Rscript .\research\environment\r-smoke-test.R
|
||||
cmd.exe /d /c .\research\environment\cuda-smoke-build.cmd
|
||||
```
|
||||
|
||||
期望结果:Python JSON 中所有 imports/tests 为 `passed`;R JSON 中所有 imports/tests 为 `passed` 且 mirt `converged=true`;CUDA 输出 `cuda_smoke_result=42`。
|
||||
|
||||
## Python 恢复
|
||||
|
||||
Python 版本固定为 3.12 系列,完整包版本见 `python-requirements.lock.txt`。Torch 使用 PyTorch 官方 CUDA 13.0 索引:
|
||||
|
||||
```powershell
|
||||
uv python install 3.12 --install-dir .python --no-registry --no-bin --cache-dir .uv-cache
|
||||
uv venv .venv-research --python .python\cpython-3.12.14-windows-x86_64-none\python.exe --seed --no-project --cache-dir .uv-cache
|
||||
uv pip install --python .venv-research\Scripts\python.exe --requirements research\environment\python-requirements.lock.txt --index https://download.pytorch.org/whl/cu130 --index-strategy unsafe-best-match --cache-dir .uv-cache
|
||||
```
|
||||
|
||||
若 3.12 补丁版本更新,第二条命令应使用实际安装目录,不要硬编码旧补丁版本。
|
||||
|
||||
## R 恢复
|
||||
|
||||
R 版本为 4.6.1。顶层包安装入口为 `install-r-packages.R`;完整依赖恢复使用 `renv.lock`。先激活环境,再运行:
|
||||
|
||||
```powershell
|
||||
Rscript -e "renv::restore(lockfile='research/environment/renv.lock', library='.r-library/4.6', prompt=FALSE)"
|
||||
```
|
||||
|
||||
## 约束
|
||||
|
||||
- 正式分析只使用上述项目环境;不要把系统 Python 3.13 的包状态当作项目依赖。
|
||||
- `smoke-test-result.json` 的短链 PyMC 采样只用于环境验收。
|
||||
- `cuda-smoke.exe` 是可重建产物;源码和构建脚本才是复现入口。
|
||||
- 嵌入模型权重尚未冻结,下载前仍须执行模型许可与版本审计。
|
||||
@@ -0,0 +1,25 @@
|
||||
$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
|
||||
$CacheRoot = Join-Path $ProjectRoot ".cache"
|
||||
|
||||
$env:LOCALAPPDATA = Join-Path $CacheRoot "localappdata"
|
||||
$env:MPLCONFIGDIR = Join-Path $CacheRoot "matplotlib"
|
||||
$env:NUMBA_CACHE_DIR = Join-Path $CacheRoot "numba"
|
||||
$env:SKB_DATA_DIRECTORY = Join-Path $CacheRoot "skrub"
|
||||
$env:HF_HOME = Join-Path $CacheRoot "huggingface"
|
||||
$env:TORCH_HOME = Join-Path $CacheRoot "torch"
|
||||
$env:XDG_CACHE_HOME = $CacheRoot
|
||||
$env:UV_CACHE_DIR = Join-Path $ProjectRoot ".uv-cache"
|
||||
$env:RENV_PATHS_ROOT = Join-Path $CacheRoot "renv"
|
||||
$env:PYTENSOR_FLAGS = "base_compiledir=$(Join-Path $CacheRoot 'pytensor')"
|
||||
|
||||
$env:R_HOME = Join-Path $ProjectRoot ".tools\R-4.6.1"
|
||||
$env:R_LIBS_USER = Join-Path $ProjectRoot ".r-library\4.6"
|
||||
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.4"
|
||||
$env:Path = "$(Join-Path $env:R_HOME 'bin');$(Join-Path $env:CUDA_PATH 'bin');$env:Path"
|
||||
|
||||
# Windows R uses UCRT/UTF-8 and does not recognize the POSIX locale name C.UTF-8.
|
||||
Remove-Item Env:LANG -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:LC_ALL -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:LC_CTYPE -ErrorAction SilentlyContinue
|
||||
|
||||
& (Join-Path $ProjectRoot ".venv-research\Scripts\Activate.ps1")
|
||||
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" >nul
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.4\bin\nvcc.exe" -arch=sm_120 -Xcompiler=/wd4819 "E:\Model\research\environment\cuda-smoke.cu" -o "E:\Model\research\environment\cuda-smoke.exe"
|
||||
if errorlevel 1 exit /b %errorlevel%
|
||||
|
||||
"E:\Model\research\environment\cuda-smoke.exe"
|
||||
exit /b %errorlevel%
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
__global__ void increment(int* value) {
|
||||
*value += 1;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int host_value = 41;
|
||||
int* device_value = nullptr;
|
||||
|
||||
if (cudaMalloc(&device_value, sizeof(int)) != cudaSuccess) {
|
||||
return 1;
|
||||
}
|
||||
if (cudaMemcpy(device_value, &host_value, sizeof(int), cudaMemcpyHostToDevice) != cudaSuccess) {
|
||||
cudaFree(device_value);
|
||||
return 2;
|
||||
}
|
||||
|
||||
increment<<<1, 1>>>(device_value);
|
||||
if (cudaDeviceSynchronize() != cudaSuccess) {
|
||||
cudaFree(device_value);
|
||||
return 3;
|
||||
}
|
||||
if (cudaMemcpy(&host_value, device_value, sizeof(int), cudaMemcpyDeviceToHost) != cudaSuccess) {
|
||||
cudaFree(device_value);
|
||||
return 4;
|
||||
}
|
||||
|
||||
cudaFree(device_value);
|
||||
std::printf("cuda_smoke_result=%d\n", host_value);
|
||||
return host_value == 42 ? 0 : 5;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
command_args <- commandArgs(trailingOnly = FALSE)
|
||||
script_path <- sub("^--file=", "", grep("^--file=", command_args, value = TRUE)[1])
|
||||
script_dir <- dirname(normalizePath(script_path, winslash = "/"))
|
||||
project_root <- normalizePath(file.path(script_dir, "..", ".."), winslash = "/")
|
||||
library_path <- file.path(project_root, ".r-library", "4.6")
|
||||
dir.create(library_path, recursive = TRUE, showWarnings = FALSE)
|
||||
.libPaths(c(library_path, .libPaths()))
|
||||
|
||||
required_packages <- c(
|
||||
"survey", "srvyr",
|
||||
"mirt",
|
||||
"lavaan", "semTools", "psych",
|
||||
"data.table", "jsonlite", "arrow", "haven", "readr",
|
||||
"dplyr", "tidyr", "purrr", "stringr",
|
||||
"digest", "renv", "targets", "withr"
|
||||
)
|
||||
|
||||
installed <- rownames(installed.packages(lib.loc = .libPaths()))
|
||||
missing <- setdiff(required_packages, installed)
|
||||
|
||||
if (length(missing) > 0L) {
|
||||
install.packages(
|
||||
missing,
|
||||
lib = library_path,
|
||||
repos = c(CRAN = "https://cloud.r-project.org"),
|
||||
dependencies = c("Depends", "Imports", "LinkingTo"),
|
||||
type = "binary",
|
||||
Ncpus = max(1L, parallel::detectCores(logical = TRUE) - 2L)
|
||||
)
|
||||
}
|
||||
|
||||
installed_after <- rownames(installed.packages(lib.loc = .libPaths()))
|
||||
still_missing <- setdiff(required_packages, installed_after)
|
||||
if (length(still_missing) > 0L) {
|
||||
stop("Missing R packages after installation: ", paste(still_missing, collapse = ", "))
|
||||
}
|
||||
|
||||
versions <- vapply(
|
||||
required_packages,
|
||||
function(package) as.character(packageVersion(package, lib.loc = library_path)),
|
||||
character(1)
|
||||
)
|
||||
writeLines(
|
||||
jsonlite::toJSON(as.list(versions), pretty = TRUE, auto_unbox = TRUE),
|
||||
file.path(script_dir, "r-package-versions.json"),
|
||||
useBytes = TRUE
|
||||
)
|
||||
cat("Installed and verified", length(required_packages), "required R packages.\n")
|
||||
@@ -0,0 +1,40 @@
|
||||
# Core data and statistical stack
|
||||
numpy
|
||||
scipy
|
||||
pandas
|
||||
polars
|
||||
pyarrow
|
||||
duckdb
|
||||
openpyxl
|
||||
networkx
|
||||
scikit-learn==1.6.1
|
||||
statsmodels
|
||||
patsy
|
||||
pyreadstat
|
||||
|
||||
# Bayesian modeling and diagnostics
|
||||
pymc[nutpie]
|
||||
numpyro
|
||||
blackjax
|
||||
bambi
|
||||
|
||||
# Psychometrics and measurement modeling
|
||||
semopy
|
||||
factor-analyzer
|
||||
pingouin
|
||||
girth
|
||||
|
||||
# Reproducible analysis and visualization
|
||||
matplotlib
|
||||
seaborn
|
||||
plotly
|
||||
jupyterlab
|
||||
ipykernel
|
||||
|
||||
# NLP, embeddings, and tabular baselines
|
||||
torch==2.14.0
|
||||
torchvision==0.29.0
|
||||
transformers
|
||||
sentence-transformers
|
||||
xgboost
|
||||
tabpfn
|
||||
@@ -0,0 +1,195 @@
|
||||
absl-py==2.5.0
|
||||
annotated-doc==0.0.5
|
||||
annotated-types==0.8.0
|
||||
anyio==4.15.1
|
||||
argon2-cffi==25.1.0
|
||||
argon2-cffi-bindings==26.1.0
|
||||
arro3-core==0.8.3
|
||||
arrow==1.4.0
|
||||
arviz==1.3.0
|
||||
arviz-base==1.3.0
|
||||
arviz-plots==1.3.1
|
||||
arviz-stats==1.3.2
|
||||
asttokens==3.0.2
|
||||
async-lru==2.3.0
|
||||
attrs==26.1.0
|
||||
babel==2.18.0
|
||||
bambi==0.21.0
|
||||
beautifulsoup4==4.15.0
|
||||
blackjax==1.6.2
|
||||
bleach==6.4.0
|
||||
cachetools==6.2.6
|
||||
certifi==2026.7.22
|
||||
cffi==2.1.1
|
||||
charset-normalizer==3.5.1
|
||||
click==8.5.0
|
||||
cloudpickle==3.1.2
|
||||
colorama==0.4.6
|
||||
comm==0.2.3
|
||||
contourpy==1.4.0
|
||||
cycler==0.12.1
|
||||
debugpy==1.8.22
|
||||
defusedxml==0.7.1
|
||||
donfig==0.8.1.post1
|
||||
duckdb==1.5.5
|
||||
einops==0.8.2
|
||||
et-xmlfile==2.0.0
|
||||
executing==2.2.1
|
||||
factor-analyzer==0.5.1
|
||||
fastjsonschema==2.22.2
|
||||
filelock==4.0.1
|
||||
fonttools==4.65.0
|
||||
formulae==0.6.2
|
||||
formulaic==1.2.2
|
||||
fqdn==1.5.1
|
||||
fsspec==2026.9.0
|
||||
girth==0.8.0
|
||||
google-crc32c==1.8.0
|
||||
graphviz==0.21
|
||||
h11==0.16.0
|
||||
hf-xet==1.6.0
|
||||
httpcore==1.0.9
|
||||
httpx==0.28.1
|
||||
huggingface-hub==1.32.0
|
||||
idna==3.20
|
||||
interface-meta==2.0.1
|
||||
ipykernel==7.3.0
|
||||
ipython==9.17.1
|
||||
ipython-pygments-lexers==1.1.1
|
||||
isoduration==20.11.0
|
||||
jax==0.11.2
|
||||
jaxlib==0.11.2
|
||||
jedi==0.20.0
|
||||
jinja2==3.1.6
|
||||
joblib==1.6.0
|
||||
json5==0.15.0
|
||||
jsonpointer==3.1.1
|
||||
jsonschema==4.26.0
|
||||
jsonschema-specifications==2025.9.1
|
||||
jupyter-builder==1.2.3
|
||||
jupyter-client==8.10.0
|
||||
jupyter-core==5.9.1
|
||||
jupyter-events==0.12.1
|
||||
jupyter-lsp==2.3.1
|
||||
jupyter-server==2.21.1
|
||||
jupyter-server-terminals==0.5.4
|
||||
jupyterlab==4.6.3
|
||||
jupyterlab-pygments==0.3.0
|
||||
jupyterlab-server==2.28.1
|
||||
kiwisolver==1.5.1
|
||||
lark==1.3.1
|
||||
lazy-loader==0.5
|
||||
lightgbm==4.7.0
|
||||
llvmlite==0.49.0
|
||||
markdown-it-py==4.2.0
|
||||
markupsafe==3.0.3
|
||||
matplotlib==3.11.2
|
||||
matplotlib-inline==0.2.2
|
||||
mdurl==0.1.2
|
||||
mistune==3.3.4
|
||||
ml-dtypes==0.6.0
|
||||
mpmath==1.3.0
|
||||
msgspec==0.21.1
|
||||
multipledispatch==1.0.0
|
||||
narwhals==2.26.0
|
||||
nbclient==0.11.0
|
||||
nbconvert==7.17.1
|
||||
nbformat==5.11.1
|
||||
nest-asyncio2==1.7.2
|
||||
networkx==3.6.1
|
||||
notebook-shim==0.2.4
|
||||
numba==0.67.0
|
||||
numcodecs==0.17.0
|
||||
numdifftools==0.11.1
|
||||
numpy==2.5.3
|
||||
numpyro==0.22.0
|
||||
nutpie==0.16.11
|
||||
obstore==0.11.1
|
||||
openpyxl==3.1.5
|
||||
opt-einsum==3.4.0
|
||||
optax==0.2.8
|
||||
packaging==26.3
|
||||
pandas==3.0.6
|
||||
pandas-flavor==0.8.1
|
||||
pandocfilters==1.5.1
|
||||
parso==0.8.7
|
||||
patsy==1.0.3
|
||||
pillow==12.3.0
|
||||
pingouin==0.6.1
|
||||
pip==26.2.1
|
||||
platformdirs==4.11.11
|
||||
plotly==7.1.0
|
||||
polars==1.44.2
|
||||
polars-runtime-32==1.44.2
|
||||
prometheus-client==0.26.0
|
||||
prompt-toolkit==3.0.53
|
||||
psutil==7.2.2
|
||||
pure-eval==0.2.4
|
||||
pyarrow==25.0.1
|
||||
pycparser==3.0
|
||||
pydantic==2.13.5
|
||||
pydantic-core==2.46.5
|
||||
pydantic-settings==2.15.0
|
||||
pydot==4.0.1
|
||||
pygments==2.21.0
|
||||
pymc==6.3.2
|
||||
pyparsing==3.3.2
|
||||
pyreadstat==1.3.6
|
||||
pytensor==3.3.2
|
||||
python-dateutil==2.9.0.post0
|
||||
python-dotenv==1.2.3
|
||||
python-json-logger==4.2.0
|
||||
pywinpty==3.0.5
|
||||
pyyaml==6.0.3
|
||||
pyzmq==27.2.0
|
||||
referencing==0.37.0
|
||||
regex==2026.9.10
|
||||
requests==2.34.2
|
||||
rfc3339-validator==0.1.4
|
||||
rfc3986-validator==0.1.1
|
||||
rfc3987-syntax==1.1.0
|
||||
rich==15.0.0
|
||||
rpds-py==2026.6.3
|
||||
safetensors==0.8.0
|
||||
scikit-learn==1.6.1
|
||||
scipy==1.18.1
|
||||
seaborn==0.13.2
|
||||
semopy==2.3.11
|
||||
send2trash==2.1.0
|
||||
sentence-transformers==6.1.0
|
||||
setuptools==84.0.0
|
||||
shellingham==1.5.4
|
||||
six==1.17.0
|
||||
skrub==0.10.1
|
||||
soupsieve==2.9.2
|
||||
sparse==0.17.0
|
||||
stack-data==0.6.3
|
||||
statsmodels==0.15.0
|
||||
sympy==1.14.0
|
||||
tabpfn==9.0.0
|
||||
tabulate==0.10.0
|
||||
terminado==0.18.1
|
||||
threadpoolctl==3.7.0
|
||||
tinycss2==1.5.1
|
||||
tokenizers==0.23.2
|
||||
torch==2.14.0+cu130
|
||||
torchvision==0.29.0+cu130
|
||||
tornado==6.5.10
|
||||
tqdm==4.70.1
|
||||
traitlets==5.16.1
|
||||
transformers==5.17.0
|
||||
typer==0.27.2
|
||||
typing-extensions==4.16.0
|
||||
typing-inspection==0.4.4
|
||||
tzdata==2026.4
|
||||
uri-template==1.3.0
|
||||
urllib3==2.8.0
|
||||
wcwidth==0.8.4
|
||||
webcolors==25.10.0
|
||||
webencodings==0.6.1
|
||||
websocket-client==1.9.2
|
||||
wrapt==2.4.1
|
||||
xarray==2026.7.0
|
||||
xarray-einstats==0.11.0
|
||||
xgboost==3.4.1
|
||||
zarr==3.4.0
|
||||
@@ -0,0 +1,135 @@
|
||||
"Package","Version","LibPath","Priority","Built"
|
||||
"arrow","25.0.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:03:57 UTC; windows"
|
||||
"assertthat","0.2.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:04 UTC; windows"
|
||||
"audio","0.1-12","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 11:48:59 UTC; windows"
|
||||
"backports","1.5.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 11:46:10 UTC; windows"
|
||||
"base64url","1.4","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:57:33 UTC; windows"
|
||||
"beepr","2.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:57:28 UTC; windows"
|
||||
"bit","4.6.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"bit64","4.8.6","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 01:55:57 UTC; windows"
|
||||
"brio","1.1.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"callr","3.8.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:20:58 UTC; windows"
|
||||
"cli","3.6.6","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:02 UTC; windows"
|
||||
"clipr","0.8.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:13 UTC; windows"
|
||||
"cpp11","0.5.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:02 UTC; windows"
|
||||
"crayon","1.5.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:16 UTC; windows"
|
||||
"data.table","1.18.6.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:07 UTC; windows"
|
||||
"DBI","1.3.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:06 UTC; windows"
|
||||
"dcurver","0.9.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-02 02:55:45 UTC; windows"
|
||||
"Deriv","4.3.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-03 23:51:16 UTC; windows"
|
||||
"desc","1.4.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:55:57 UTC; windows"
|
||||
"diffobj","0.3.9","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-15 21:05:06 UTC; windows"
|
||||
"digest","0.6.39","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"dplyr","1.2.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-02 04:00:08 UTC; windows"
|
||||
"e1071","1.7-17","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-02 02:33:28 UTC; windows"
|
||||
"evaluate","1.0.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:28 UTC; windows"
|
||||
"forcats","1.0.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 03:20:06 UTC; windows"
|
||||
"fs","2.1.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"future","1.75.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:55:59 UTC; windows"
|
||||
"future.apply","1.20.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:21:02 UTC; windows"
|
||||
"generics","0.1.4","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:01 UTC; windows"
|
||||
"globals","0.19.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-08-19 12:58:27 UTC; windows"
|
||||
"glue","1.8.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:02 UTC; windows"
|
||||
"GPArotation","2026.8-2","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-08-22 23:07:47 UTC; windows"
|
||||
"gridExtra","2.3.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:40:22 UTC; windows"
|
||||
"gtable","0.3.6","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:20:45 UTC; windows"
|
||||
"haven","2.5.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 04:12:04 UTC; windows"
|
||||
"highr","0.12","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:55:56 UTC; windows"
|
||||
"hms","1.1.4","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:20:54 UTC; windows"
|
||||
"igraph","2.3.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 02:21:13 UTC; windows"
|
||||
"jsonlite","2.0.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"knitr","1.52","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:20:57 UTC; windows"
|
||||
"lavaan","0.7-2","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:57:27 UTC; windows"
|
||||
"lifecycle","1.0.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:55:53 UTC; windows"
|
||||
"listenv","1.0.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:41 UTC; windows"
|
||||
"magrittr","2.0.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:02 UTC; windows"
|
||||
"minqa","1.2.8","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 01:55:53 UTC; windows"
|
||||
"mirt","1.47","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:40:33 UTC; windows"
|
||||
"mitools","2.7","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:55:02 UTC; windows"
|
||||
"mnormt","2.1.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 11:46:51 UTC; windows"
|
||||
"numDeriv","2016.8-1.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-08-19 11:46:08 UTC; windows"
|
||||
"otel","0.2.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:04 UTC; windows"
|
||||
"parallelly","1.48.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:41 UTC; windows"
|
||||
"pbapply","1.7-5","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:39 UTC; windows"
|
||||
"pbivnorm","0.6.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 11:47:43 UTC; windows"
|
||||
"permute","0.9-10","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:41 UTC; windows"
|
||||
"pillar","1.11.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:40:23 UTC; windows"
|
||||
"pkgbuild","1.4.8","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:40:26 UTC; windows"
|
||||
"pkgconfig","2.0.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:02 UTC; windows"
|
||||
"pkgload","1.5.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 03:03:44 UTC; windows"
|
||||
"praise","1.0.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:38 UTC; windows"
|
||||
"prettyunits","1.2.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:20 UTC; windows"
|
||||
"processx","3.9.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 01:55:58 UTC; windows"
|
||||
"progress","1.2.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:40:25 UTC; windows"
|
||||
"progressr","1.0.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:41 UTC; windows"
|
||||
"proxy","0.4-29","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"ps","1.9.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:50 UTC; windows"
|
||||
"psych","2.6.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:56:45 UTC; windows"
|
||||
"purrr","1.2.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-02 03:15:05 UTC; windows"
|
||||
"qs2","0.3.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 02:22:01 UTC; windows"
|
||||
"quadprog","1.5-8","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 11:46:37 UTC; windows"
|
||||
"R.methodsS3","1.8.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-08-19 11:46:20 UTC; windows"
|
||||
"R.oo","1.27.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-08-19 12:58:27 UTC; windows"
|
||||
"R.utils","2.13.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:55:10 UTC; windows"
|
||||
"R6","2.6.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:01 UTC; windows"
|
||||
"Rcpp","1.1.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:07 UTC; windows"
|
||||
"RcppArmadillo","15.6.0-1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 01:55:59 UTC; windows"
|
||||
"RcppParallel","6.2.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:53 UTC; windows"
|
||||
"readr","2.2.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:39:20 UTC; windows"
|
||||
"renv","1.2.4","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:56:08 UTC; windows"
|
||||
"rlang","1.3.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:04 UTC; windows"
|
||||
"rprojroot","2.1.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:04 UTC; windows"
|
||||
"secretbase","1.3.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 12:17:50 UTC; windows"
|
||||
"semTools","0.5-9","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:01:34 UTC; windows"
|
||||
"sessioninfo","1.2.4","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:55:58 UTC; windows"
|
||||
"SimDesign","2.27","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 03:23:09 UTC; windows"
|
||||
"splines2","0.5.4","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 01:58:08 UTC; windows"
|
||||
"srvyr","1.3.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 03:43:24 UTC; windows"
|
||||
"stringfish","0.19.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 01:56:23 UTC; windows"
|
||||
"stringi","1.8.9","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-08-19 11:46:22 UTC; windows"
|
||||
"stringr","1.6.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:40:23 UTC; windows"
|
||||
"survey","4.5","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 02:21:06 UTC; windows"
|
||||
"targets","1.12.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 03:05:11 UTC; windows"
|
||||
"testthat","3.3.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:20:10 UTC; windows"
|
||||
"tibble","3.3.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:03:39 UTC; windows"
|
||||
"tidyr","1.3.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:39:19 UTC; windows"
|
||||
"tidyselect","1.2.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 02:40:22 UTC; windows"
|
||||
"tzdb","0.5.0","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:18 UTC; windows"
|
||||
"utf8","1.2.6","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:02 UTC; windows"
|
||||
"vctrs","0.7.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-02 02:52:27 UTC; windows"
|
||||
"vegan","2.7-6","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 02:40:30 UTC; windows"
|
||||
"vroom","1.7.1","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 03:20:06 UTC; windows"
|
||||
"waldo","0.6.2","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 01:55:56 UTC; windows"
|
||||
"withr","3.0.3","E:/Model/.r-library/4.6",NA,"R 4.6.1; ; 2026-09-09 00:54:02 UTC; windows"
|
||||
"xfun","0.60","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:30 UTC; windows"
|
||||
"yaml","2.3.12","E:/Model/.r-library/4.6",NA,"R 4.6.1; x86_64-w64-mingw32; 2026-09-09 00:54:31 UTC; windows"
|
||||
"base","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; ; 2026-06-24 08:20:51 UTC; windows"
|
||||
"boot","1.3-32","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; ; 2026-06-24 08:32:04 UTC; windows"
|
||||
"class","7.3-23","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:33:04 UTC; windows"
|
||||
"cluster","2.1.8.2","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:32:11 UTC; windows"
|
||||
"codetools","0.2-20","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; ; 2026-06-24 08:32:25 UTC; windows"
|
||||
"compiler","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; ; 2026-06-24 08:14:21 UTC; windows"
|
||||
"datasets","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; ; 2026-06-24 08:19:02 UTC; windows"
|
||||
"foreign","0.8-91","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:32:28 UTC; windows"
|
||||
"graphics","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:16:56 UTC; windows"
|
||||
"grDevices","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:16:14 UTC; windows"
|
||||
"grid","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:19:46 UTC; windows"
|
||||
"KernSmooth","2.23-26","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:32:40 UTC; windows"
|
||||
"lattice","0.22-9","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:23:40 UTC; windows"
|
||||
"MASS","7.3-65","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:23:25 UTC; windows"
|
||||
"Matrix","1.7-5","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:23:58 UTC; windows"
|
||||
"methods","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:19:12 UTC; windows"
|
||||
"mgcv","1.9-4","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:33:21 UTC; windows"
|
||||
"nlme","3.1-169","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:30:23 UTC; windows"
|
||||
"nnet","7.3-20","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:33:09 UTC; windows"
|
||||
"parallel","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:20:30 UTC; windows"
|
||||
"rpart","4.1.27","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:32:48 UTC; windows"
|
||||
"spatial","7.3-18","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:33:14 UTC; windows"
|
||||
"splines","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:20:12 UTC; windows"
|
||||
"stats","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:17:23 UTC; windows"
|
||||
"stats4","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; ; 2026-06-24 08:20:17 UTC; windows"
|
||||
"survival","3.8-6","E:/Model/.tools/R-4.6.1/library","recommended","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:30:55 UTC; windows"
|
||||
"tcltk","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:20:20 UTC; windows"
|
||||
"tools","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:14:19 UTC; windows"
|
||||
"translations","4.6.1","E:/Model/.tools/R-4.6.1/library",NA,"R 4.6.1; ; 2026-06-24 08:20:37 UTC; windows"
|
||||
"utils","4.6.1","E:/Model/.tools/R-4.6.1/library","base","R 4.6.1; x86_64-w64-mingw32; 2026-06-24 08:15:23 UTC; windows"
|
||||
|
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"survey": "4.5",
|
||||
"srvyr": "1.3.1",
|
||||
"mirt": "1.47",
|
||||
"lavaan": "0.7.2",
|
||||
"semTools": "0.5.9",
|
||||
"psych": "2.6.5",
|
||||
"data.table": "1.18.6.1",
|
||||
"jsonlite": "2.0.0",
|
||||
"arrow": "25.0.1",
|
||||
"haven": "2.5.5",
|
||||
"readr": "2.2.0",
|
||||
"dplyr": "1.2.1",
|
||||
"tidyr": "1.3.2",
|
||||
"purrr": "1.2.2",
|
||||
"stringr": "1.6.0",
|
||||
"digest": "0.6.39",
|
||||
"renv": "1.2.4",
|
||||
"targets": "1.12.0",
|
||||
"withr": "3.0.3"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
R version 4.6.1 (2026-06-24 ucrt)
|
||||
Platform: x86_64-w64-mingw32/x64
|
||||
Running under: Windows 11 x64 (build 26100)
|
||||
|
||||
Matrix products: default
|
||||
LAPACK version 3.12.1
|
||||
|
||||
locale:
|
||||
[1] LC_COLLATE=Chinese (Simplified)_China.utf8
|
||||
[2] LC_CTYPE=Chinese (Simplified)_China.utf8
|
||||
[3] LC_MONETARY=Chinese (Simplified)_China.utf8
|
||||
[4] LC_NUMERIC=C
|
||||
[5] LC_TIME=Chinese (Simplified)_China.utf8
|
||||
|
||||
time zone: Pacific/Auckland
|
||||
tzcode source: internal
|
||||
|
||||
attached base packages:
|
||||
[1] stats graphics grDevices utils datasets methods base
|
||||
|
||||
loaded via a namespace (and not attached):
|
||||
[1] compiler_4.6.1 tools_4.6.1 renv_1.2.4
|
||||
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"r_version": "R version 4.6.1 (2026-06-24 ucrt)",
|
||||
"library_path": "E:/Model/.r-library/4.6",
|
||||
"imports": {
|
||||
"survey": {
|
||||
"status": "passed",
|
||||
"version": "4.5"
|
||||
},
|
||||
"srvyr": {
|
||||
"status": "passed",
|
||||
"version": "1.3.1"
|
||||
},
|
||||
"mirt": {
|
||||
"status": "passed",
|
||||
"version": "1.47"
|
||||
},
|
||||
"lavaan": {
|
||||
"status": "passed",
|
||||
"version": "0.7.2"
|
||||
},
|
||||
"semTools": {
|
||||
"status": "passed",
|
||||
"version": "0.5.9"
|
||||
},
|
||||
"psych": {
|
||||
"status": "passed",
|
||||
"version": "2.6.5"
|
||||
},
|
||||
"data.table": {
|
||||
"status": "passed",
|
||||
"version": "1.18.6.1"
|
||||
},
|
||||
"jsonlite": {
|
||||
"status": "passed",
|
||||
"version": "2.0.0"
|
||||
},
|
||||
"arrow": {
|
||||
"status": "passed",
|
||||
"version": "25.0.1"
|
||||
},
|
||||
"haven": {
|
||||
"status": "passed",
|
||||
"version": "2.5.5"
|
||||
},
|
||||
"readr": {
|
||||
"status": "passed",
|
||||
"version": "2.2.0"
|
||||
},
|
||||
"dplyr": {
|
||||
"status": "passed",
|
||||
"version": "1.2.1"
|
||||
},
|
||||
"tidyr": {
|
||||
"status": "passed",
|
||||
"version": "1.3.2"
|
||||
},
|
||||
"purrr": {
|
||||
"status": "passed",
|
||||
"version": "1.2.2"
|
||||
},
|
||||
"stringr": {
|
||||
"status": "passed",
|
||||
"version": "1.6.0"
|
||||
},
|
||||
"digest": {
|
||||
"status": "passed",
|
||||
"version": "0.6.39"
|
||||
},
|
||||
"renv": {
|
||||
"status": "passed",
|
||||
"version": "1.2.4"
|
||||
},
|
||||
"targets": {
|
||||
"status": "passed",
|
||||
"version": "1.12.0"
|
||||
},
|
||||
"withr": {
|
||||
"status": "passed",
|
||||
"version": "3.0.3"
|
||||
}
|
||||
},
|
||||
"tests": {
|
||||
"survey_weighted_mean": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"estimate": 3.6667,
|
||||
"finite": true
|
||||
}
|
||||
},
|
||||
"lavaan_cfa": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"converged": true
|
||||
}
|
||||
},
|
||||
"mirt_2pl": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"converged": true,
|
||||
"items": 8,
|
||||
"respondents": 500
|
||||
}
|
||||
},
|
||||
"arrow_parquet": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"rows": 3,
|
||||
"columns": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
command_args <- commandArgs(trailingOnly = FALSE)
|
||||
script_path <- sub("^--file=", "", grep("^--file=", command_args, value = TRUE)[1])
|
||||
script_dir <- dirname(normalizePath(script_path, winslash = "/"))
|
||||
project_root <- normalizePath(file.path(script_dir, "..", ".."), winslash = "/")
|
||||
library_path <- file.path(project_root, ".r-library", "4.6")
|
||||
.libPaths(c(library_path, .libPaths()))
|
||||
|
||||
results <- list(
|
||||
r_version = R.version.string,
|
||||
library_path = library_path,
|
||||
imports = list(),
|
||||
tests = list()
|
||||
)
|
||||
|
||||
packages <- c(
|
||||
"survey", "srvyr", "mirt", "lavaan", "semTools", "psych",
|
||||
"data.table", "jsonlite", "arrow", "haven", "readr", "dplyr",
|
||||
"tidyr", "purrr", "stringr", "digest", "renv", "targets", "withr"
|
||||
)
|
||||
|
||||
for (package in packages) {
|
||||
status <- tryCatch({
|
||||
loadNamespace(package)
|
||||
list(status = "passed", version = as.character(packageVersion(package)))
|
||||
}, error = function(error) {
|
||||
list(status = "failed", detail = conditionMessage(error))
|
||||
})
|
||||
results$imports[[package]] <- status
|
||||
}
|
||||
|
||||
run_test <- function(name, expression) {
|
||||
results$tests[[name]] <<- tryCatch({
|
||||
detail <- force(expression)
|
||||
list(status = "passed", detail = detail)
|
||||
}, error = function(error) {
|
||||
list(status = "failed", detail = conditionMessage(error))
|
||||
})
|
||||
}
|
||||
|
||||
run_test("survey_weighted_mean", {
|
||||
frame <- data.frame(
|
||||
value = c(1, 2, 3, 4, 5, 6),
|
||||
strata = c(1, 1, 1, 2, 2, 2),
|
||||
psu = c(1, 2, 3, 4, 5, 6),
|
||||
weight = c(1, 2, 1, 2, 1, 2)
|
||||
)
|
||||
design <- survey::svydesign(~psu, strata = ~strata, weights = ~weight, data = frame)
|
||||
estimate <- unname(coef(survey::svymean(~value, design))[[1]])
|
||||
list(estimate = estimate, finite = is.finite(estimate))
|
||||
})
|
||||
|
||||
run_test("lavaan_cfa", {
|
||||
set.seed(20260920)
|
||||
latent <- rnorm(180)
|
||||
frame <- data.frame(
|
||||
x1 = 0.8 * latent + rnorm(180, sd = 0.4),
|
||||
x2 = 0.7 * latent + rnorm(180, sd = 0.5),
|
||||
x3 = 0.9 * latent + rnorm(180, sd = 0.3)
|
||||
)
|
||||
fit <- lavaan::cfa("factor =~ x1 + x2 + x3", data = frame)
|
||||
list(converged = lavaan::lavInspect(fit, "converged"))
|
||||
})
|
||||
|
||||
run_test("mirt_2pl", {
|
||||
set.seed(20260920)
|
||||
sample_size <- 500
|
||||
item_count <- 8
|
||||
theta <- rnorm(sample_size)
|
||||
discrimination <- seq(0.8, 1.5, length.out = item_count)
|
||||
difficulty <- seq(-1.2, 1.2, length.out = item_count)
|
||||
probabilities <- vapply(
|
||||
seq_len(item_count),
|
||||
function(index) plogis(discrimination[index] * (theta - difficulty[index])),
|
||||
numeric(sample_size)
|
||||
)
|
||||
responses <- matrix(
|
||||
rbinom(length(probabilities), 1, as.vector(probabilities)),
|
||||
nrow = sample_size,
|
||||
ncol = item_count
|
||||
)
|
||||
colnames(responses) <- paste0("item", seq_len(ncol(responses)))
|
||||
fit <- mirt::mirt(
|
||||
responses,
|
||||
1,
|
||||
itemtype = "2PL",
|
||||
verbose = FALSE,
|
||||
technical = list(NCYCLES = 1000)
|
||||
)
|
||||
converged <- isTRUE(fit@OptimInfo$converged)
|
||||
if (!converged) stop("mirt 2PL fit did not converge")
|
||||
list(converged = converged, items = ncol(responses), respondents = nrow(responses))
|
||||
})
|
||||
|
||||
run_test("arrow_parquet", {
|
||||
cache_dir <- file.path(project_root, ".cache", "r-smoke")
|
||||
dir.create(cache_dir, recursive = TRUE, showWarnings = FALSE)
|
||||
path <- file.path(cache_dir, "arrow-smoke.parquet")
|
||||
arrow::write_parquet(data.frame(id = 1:3, value = c("a", "b", "c")), path)
|
||||
restored <- arrow::read_parquet(path)
|
||||
list(rows = nrow(restored), columns = ncol(restored))
|
||||
})
|
||||
|
||||
output_path <- file.path(script_dir, "r-smoke-test-result.json")
|
||||
writeLines(
|
||||
jsonlite::toJSON(results, pretty = TRUE, auto_unbox = TRUE, null = "null"),
|
||||
output_path,
|
||||
useBytes = TRUE
|
||||
)
|
||||
cat(readLines(output_path, warn = FALSE), sep = "\n")
|
||||
|
||||
failed_imports <- names(Filter(function(item) item$status != "passed", results$imports))
|
||||
failed_tests <- names(Filter(function(item) item$status != "passed", results$tests))
|
||||
quit(status = if (length(failed_imports) || length(failed_tests)) 1L else 0L)
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,140 @@
|
||||
{
|
||||
"python": "3.12.14 (main, Aug 14 2026, 15:40:22) [MSC v.1944 64 bit (AMD64)]",
|
||||
"imports": {
|
||||
"numpy": {
|
||||
"status": "passed",
|
||||
"version": "2.5.3"
|
||||
},
|
||||
"scipy": {
|
||||
"status": "passed",
|
||||
"version": "1.18.1"
|
||||
},
|
||||
"pandas": {
|
||||
"status": "passed",
|
||||
"version": "3.0.6"
|
||||
},
|
||||
"polars": {
|
||||
"status": "passed",
|
||||
"version": "1.44.2"
|
||||
},
|
||||
"pyarrow": {
|
||||
"status": "passed",
|
||||
"version": "25.0.1"
|
||||
},
|
||||
"duckdb": {
|
||||
"status": "passed",
|
||||
"version": "1.5.5"
|
||||
},
|
||||
"statsmodels": {
|
||||
"status": "passed",
|
||||
"version": "0.15.0"
|
||||
},
|
||||
"pymc": {
|
||||
"status": "passed",
|
||||
"version": "6.3.2"
|
||||
},
|
||||
"pytensor": {
|
||||
"status": "passed",
|
||||
"version": "3.3.2"
|
||||
},
|
||||
"arviz": {
|
||||
"status": "passed",
|
||||
"version": "1.3.0"
|
||||
},
|
||||
"nutpie": {
|
||||
"status": "passed",
|
||||
"version": "0.16.11"
|
||||
},
|
||||
"jax": {
|
||||
"status": "passed",
|
||||
"version": "0.11.2"
|
||||
},
|
||||
"numpyro": {
|
||||
"status": "passed",
|
||||
"version": "0.22.0"
|
||||
},
|
||||
"blackjax": {
|
||||
"status": "passed",
|
||||
"version": "1.6.2"
|
||||
},
|
||||
"bambi": {
|
||||
"status": "passed",
|
||||
"version": "0.21.0"
|
||||
},
|
||||
"semopy": {
|
||||
"status": "passed",
|
||||
"version": "2.3.11"
|
||||
},
|
||||
"factor_analyzer": {
|
||||
"status": "passed",
|
||||
"version": "unknown"
|
||||
},
|
||||
"pingouin": {
|
||||
"status": "passed",
|
||||
"version": "0.6.1"
|
||||
},
|
||||
"girth": {
|
||||
"status": "passed",
|
||||
"version": "unknown"
|
||||
},
|
||||
"torch": {
|
||||
"status": "passed",
|
||||
"version": "2.14.0+cu130"
|
||||
},
|
||||
"torchvision": {
|
||||
"status": "passed",
|
||||
"version": "0.29.0+cu130"
|
||||
},
|
||||
"transformers": {
|
||||
"status": "passed",
|
||||
"version": "5.17.0"
|
||||
},
|
||||
"sentence_transformers": {
|
||||
"status": "passed",
|
||||
"version": "6.1.0"
|
||||
},
|
||||
"xgboost": {
|
||||
"status": "passed",
|
||||
"version": "3.4.1"
|
||||
},
|
||||
"tabpfn": {
|
||||
"status": "passed",
|
||||
"version": "9.0.0"
|
||||
}
|
||||
},
|
||||
"tests": {
|
||||
"pymc_sampling": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"posterior_mean": 0.15326990867173734,
|
||||
"draws": 50,
|
||||
"chains": 1
|
||||
}
|
||||
},
|
||||
"semopy_cfa": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"success": true,
|
||||
"objective": 8.346892954591567e-08
|
||||
}
|
||||
},
|
||||
"factor_analyzer": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"loading_shape": [
|
||||
4,
|
||||
1
|
||||
]
|
||||
}
|
||||
},
|
||||
"torch_cuda": {
|
||||
"status": "passed",
|
||||
"detail": {
|
||||
"torch": "2.14.0+cu130",
|
||||
"cuda_runtime": "13.0",
|
||||
"device": "NVIDIA GeForce RTX 5060 Ti",
|
||||
"finite": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
import importlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
CACHE_ROOT = PROJECT_ROOT / ".cache"
|
||||
cache_settings = {
|
||||
"LOCALAPPDATA": CACHE_ROOT / "localappdata",
|
||||
"MPLCONFIGDIR": CACHE_ROOT / "matplotlib",
|
||||
"NUMBA_CACHE_DIR": CACHE_ROOT / "numba",
|
||||
"SKB_DATA_DIRECTORY": CACHE_ROOT / "skrub",
|
||||
"HF_HOME": CACHE_ROOT / "huggingface",
|
||||
"TORCH_HOME": CACHE_ROOT / "torch",
|
||||
"XDG_CACHE_HOME": CACHE_ROOT,
|
||||
}
|
||||
for key, path in cache_settings.items():
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
os.environ[key] = str(path)
|
||||
os.environ["PYTENSOR_FLAGS"] = f"base_compiledir={CACHE_ROOT / 'pytensor'}"
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
results = {"python": sys.version, "imports": {}, "tests": {}}
|
||||
|
||||
|
||||
def record(name, fn):
|
||||
try:
|
||||
value = fn()
|
||||
results["tests"][name] = {"status": "passed", "detail": value}
|
||||
except Exception as exc:
|
||||
results["tests"][name] = {
|
||||
"status": "failed",
|
||||
"detail": f"{type(exc).__name__}: {exc}",
|
||||
"traceback": traceback.format_exc(),
|
||||
}
|
||||
|
||||
|
||||
for module_name in [
|
||||
"numpy", "scipy", "pandas", "polars", "pyarrow", "duckdb",
|
||||
"statsmodels", "pymc", "pytensor", "arviz", "nutpie",
|
||||
"jax", "numpyro", "blackjax", "bambi", "semopy",
|
||||
"factor_analyzer", "pingouin", "girth", "torch", "torchvision",
|
||||
"transformers", "sentence_transformers", "xgboost",
|
||||
"tabpfn",
|
||||
]:
|
||||
try:
|
||||
module = importlib.import_module(module_name)
|
||||
results["imports"][module_name] = {
|
||||
"status": "passed",
|
||||
"version": getattr(module, "__version__", "unknown"),
|
||||
}
|
||||
except Exception as exc:
|
||||
results["imports"][module_name] = {
|
||||
"status": "failed",
|
||||
"detail": f"{type(exc).__name__}: {exc}",
|
||||
}
|
||||
|
||||
|
||||
def pymc_test():
|
||||
import pymc as pm
|
||||
|
||||
rng = np.random.default_rng(20260920)
|
||||
observed = rng.normal(0.35, 1.0, size=40)
|
||||
with pm.Model():
|
||||
mu = pm.Normal("mu", 0.0, 1.0)
|
||||
pm.Normal("y", mu, 1.0, observed=observed)
|
||||
inference = pm.sample(
|
||||
draws=50,
|
||||
tune=50,
|
||||
chains=1,
|
||||
cores=1,
|
||||
random_seed=20260920,
|
||||
progressbar=False,
|
||||
compute_convergence_checks=False,
|
||||
)
|
||||
posterior_mean = float(inference.posterior["mu"].mean())
|
||||
return {"posterior_mean": posterior_mean, "draws": 50, "chains": 1}
|
||||
|
||||
|
||||
def sem_test():
|
||||
import pandas as pd
|
||||
import semopy
|
||||
|
||||
rng = np.random.default_rng(20260920)
|
||||
latent = rng.normal(size=160)
|
||||
frame = pd.DataFrame(
|
||||
{
|
||||
"x1": 0.8 * latent + rng.normal(scale=0.4, size=160),
|
||||
"x2": 0.7 * latent + rng.normal(scale=0.5, size=160),
|
||||
"x3": 0.9 * latent + rng.normal(scale=0.3, size=160),
|
||||
}
|
||||
)
|
||||
model = semopy.Model("factor =~ x1 + x2 + x3")
|
||||
fit = model.fit(frame)
|
||||
return {"success": bool(fit.success), "objective": float(fit.fun)}
|
||||
|
||||
|
||||
def factor_test():
|
||||
from factor_analyzer import FactorAnalyzer
|
||||
|
||||
rng = np.random.default_rng(20260920)
|
||||
latent = rng.normal(size=(180, 1))
|
||||
data = latent @ np.array([[0.8, 0.7, 0.9, 0.6]]) + rng.normal(
|
||||
scale=0.45, size=(180, 4)
|
||||
)
|
||||
fitted = FactorAnalyzer(n_factors=1, rotation=None).fit(data)
|
||||
return {"loading_shape": list(fitted.loadings_.shape)}
|
||||
|
||||
|
||||
def torch_test():
|
||||
import torch
|
||||
|
||||
if not torch.cuda.is_available():
|
||||
raise RuntimeError("torch.cuda.is_available() is false")
|
||||
left = torch.randn((256, 256), device="cuda")
|
||||
right = torch.randn((256, 256), device="cuda")
|
||||
result = left @ right
|
||||
torch.cuda.synchronize()
|
||||
return {
|
||||
"torch": torch.__version__,
|
||||
"cuda_runtime": torch.version.cuda,
|
||||
"device": torch.cuda.get_device_name(0),
|
||||
"finite": bool(torch.isfinite(result).all().item()),
|
||||
}
|
||||
|
||||
|
||||
record("pymc_sampling", pymc_test)
|
||||
record("semopy_cfa", sem_test)
|
||||
record("factor_analyzer", factor_test)
|
||||
record("torch_cuda", torch_test)
|
||||
|
||||
serialized = json.dumps(results, ensure_ascii=False, indent=2)
|
||||
(Path(__file__).parent / "smoke-test-result.json").write_text(
|
||||
serialized, encoding="utf-8"
|
||||
)
|
||||
print(serialized)
|
||||
|
||||
failed_imports = [k for k, v in results["imports"].items() if v["status"] != "passed"]
|
||||
failed_tests = [k for k, v in results["tests"].items() if v["status"] != "passed"]
|
||||
raise SystemExit(1 if failed_imports or failed_tests else 0)
|
||||
Reference in New Issue
Block a user