Description¶
Determines the minimum CRAN snapshot date for a set of pinned R packages. Given a file specifying R package versions (R script, renv.lock, DESCRIPTION, or CSV), this tool queries the crandb API to find when all specified package versions were simultaneously available on CRAN, then reports matching Docker images and Posit Package Manager snapshot URLs.
Usage¶
python tools/find_cran_date.py <input_file> [--output <path>] [--verbose]Arguments¶
input_file (required) - File containing R package specifications
Supported formats: R script, renv.lock, DESCRIPTION, CSV
--output- Output file path for saving results (optional)--verbose- Enable verbose output (optional)
Examples¶
# Analyze R setup script
python tools/find_cran_date.py 209465/Code/0_setup.R
# Save results to file
python tools/find_cran_date.py renv.lock --output generated/notes-for-r.md
# Verbose mode
python tools/find_cran_date.py packages.csv --verboseOutput¶
The tool reports:
Minimum CRAN snapshot date when all package versions existed
Matching
rocker/verseDocker container imagePosit Package Manager snapshot URL for reproducible installations
Compatible R version(s)
Requirements¶
Python >= 3.6
Standard library only (urllib, json, datetime, argparse)
Internet connection to query crandb API
Use Cases¶
Determine the correct CRAN snapshot for reproducible R environments
Find appropriate
rocker/verseDocker images for historical package versionsGenerate Posit Package Manager URLs for package installation
Verify package availability on specific dates
Technical Details¶
Queries https://
crandb .r -pkg .org for package publication dates Caches API responses in
~/.cache/cran-pkg-dates/to minimize requestsSupports R versions 4.0.0 through 4.5.3
Parses multiple input formats automatically
See Also¶
Pipeline
9-find-cran-datein bitbucket-pipelines .yml check_r_deps.R - Find R package dependencies