locksmith

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

locksmith

build

locksmith is a utility to generate renv.lock file containing all dependencies of given set of R packages.

Given the input list of git repositories containing the R packages, as well as a list of R package repositories (e.g. in a package manager, CRAN, BioConductor etc.), locksmith will try to determine the list of all dependencies and their versions required to make the input list of packages work. It will then save the result in an renv.lock-compatible file.

Installation

Simply download the project for your distribution from the releases page. locksmith is distributed as a single binary file and does not require any additional system requirements.

Alternatively, you can install the latest version by running:

go install github.com/insightsengineering/locksmith@latest

Usage

locksmith is a command line utility, so after installing the binary in your PATH, simply run the following command to view its capabilities:

locksmith --help

Example usage with multiple flags:

locksmith --logLevel debug --exampleParameter 'exampleValue'

Real-life example with multiple input packages and repositories. Please see below for an example how to set package and repository lists more easily in a configuration file.

locksmith --inputPackageList https://raw.githubusercontent.com/insightsengineering/formatters/main/DESCRIPTION,https://raw.githubusercontent.com/insightsengineering/rtables/main/DESCRIPTION,https://raw.githubusercontent.com/insightsengineering/scda/main/DESCRIPTION,https://raw.githubusercontent.com/insightsengineering/scda.2022/main/DESCRIPTION,https://raw.githubusercontent.com/insightsengineering/nestcolor/main/DESCRIPTION,https://raw.githubusercontent.com/insightsengineering/tern/main/DESCRIPTION,https://raw.githubusercontent.com/insightsengineering/rlistings/main/DESCRIPTION --inputRepositoryList BioC=https://bioconductor.org/packages/release/bioc,CRAN=https://cran.rstudio.com/

In order to download the packages from GitHub or GitLab repositories, please set the environment variables containing the Personal Access Tokens.

  • For GitHub, set the LOCKSMITH_GITHUBTOKEN environment variable.
  • For GitLab, set the LOCKSMITH_GITLABTOKEN environment variable.

By default locksmith will save the resulting output file to renv.lock.

Configuration file

If you'd like to set the above options in a configuration file, by default locksmith checks ~/.locksmith, ~/.locksmith.yaml and ~/.locksmith.yml files.

If any of these files exist, locksmith will use options defined there, unless they are overridden by command line flags or environment variables.

You can also specify custom path to configuration file with --config <your-configuration-file>.yml command line flag. When using custom configuration file, if you specify command line flags, the latter will still take precedence.

Example contents of configuration file:

logLevel: debug
inputPackages:
  - https://raw.githubusercontent.com/insightsengineering/formatters/main/DESCRIPTION
  - https://raw.githubusercontent.com/insightsengineering/rtables/main/DESCRIPTION
  - https://raw.githubusercontent.com/insightsengineering/scda/main/DESCRIPTION
  - https://raw.githubusercontent.com/insightsengineering/scda.2022/main/DESCRIPTION
inputRepositories:
  - Bioconductor.BioCsoft=https://bioconductor.org/packages/release/bioc/
  - CRAN=https://cran.rstudio.com/

The example above shows an alternative way of providing input packages, and input repositories, as opposed to inputPackageList and inputRepositoryList CLI flags/YAML keys.

Additionally, inputPackageList/inputRepositoryList CLI flags take precendence over inputPackages/inputRepositories YAML keys.

Environment variables

locksmith reads environment variables with LOCKSMITH_ prefix and tries to match them with CLI flags. For example, setting the following variables will override the respective values from configuration file: LOCKSMITH_LOGLEVEL, LOCKSMITH_EXAMPLEPARAMETER etc.

The order of precedence is:

CLI flag → environment variable → configuration file → default value.

Development

This project is built with the Go programming language.

Development Environment

It is recommended to use Go 1.21+ for developing this project. This project uses a pre-commit configuration and it is recommended to install and use pre-commit when you are developing this project.

Common Commands

Run make help to list all related targets that will aid local development.

License

locksmith is licensed under the Apache 2.0 license. See LICENSE for details.

Documentation

Overview

Package main is the main package of locksmith - the renv.lock generator.

Directories

Path Synopsis
Package cmd implements the core functionality of locksmith - the renv.lock generator.
Package cmd implements the core functionality of locksmith - the renv.lock generator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL