Package: vurf
VURFViliam's Universal Requirements FormatWhat it isVURFis a format, parser, CLI, and python module for saving packages into Python-ish looking file.
It supports differentsections,conditionalsand deep nesting and envaluation thanks to AST parser.Example packages.vurfwithpip:vurfblackclick==8.0.0ifat_work:ql-cqql-orangewithbrew:nnn# terminal file managerInstallationpipinstallvurfUsage# Do something to initialize config and packages files$vurfdefault# Basic operations$vurfaddsome-package
$vurfremovepackage# Print packages$vurfpackages# Install them$vurfinstallFor all options look atCLIsection and for integration with other tools look atAutomation.CLI$ vurf
Usage: vurf [OPTIONS] COMMAND [ARGS]...

Options:
  -q, --quiet  Don't produce unnecessary output.
  --version    Show the version and exit.
  --help       Show this message and exit.

Commands:
  add              Add package(s).
  config           Edit config file.
  default          Print default section.
  edit             Edit packages file.
  format           Format packages file.
  has              Exit with indication if package is in packages.
  has-section      Exit with indication if section is in sections.
  install          Install packages.
  package-section  Print the first section that contains the package.
  packages         Print list of packages.
  print            Print contents of packages file.
  remove           Remove package(s).
  sections         Print list of sections.
  uninstall        Uninstall packages.CompletionsShell completions are installed intovurf_completionsin yourside-packages.
The easiest way to find the location is to runpip show -f vurf | grep Location.Then you can source them for example like this# .bashrcsource"/Users/viliam/Library/Python/3.10/lib/python/site-packages/vurf_completions/completions.bash"ConfigNote:VURFwill automatically create config file on the first run.Config file format# Where packages file is savedpackages_location="/Users/viliam/packages.vurf"# Name of the default sectiondefault_section="brew"# Sections can be though of as installers for different packages# `install` and `uninstall` attributes are optional and default to `echo`# `sequential` attribute is optional and defaults to `false`# Use `sequential = true` if you want to install/uninstall packages one by one[[sections]]name="brew"install="brew install"uninstall="brew uninstall"sequential=false[[sections]]name="cask"install="brew install --cask"[[sections]]name="python"install="pip install --quiet --user"uninstall="pip uninstall"# Parameters are constants that can be accessed from conditionals[parameters]hostname="mac"primary_computer=truefs="apfs"GrammarVURFhasgrammarand LALR(1) parser implemented inLark.
The "source code" aims to look like Python code as much as possible.Keywordswith [section]- specifies "section" of requirements file. Different sections usually have different installers.if [condition]:- conditions for including packages. SeeConditionalssections.elif [condition]:else:...- ellipsis - placeholder for empty section.Packagesare saved as[name]  # [comment]namecan be almost any valid package name (cannot start with "." or contain tabs or newline characters)names containing spaces must be quoted. E.g.'multi word package name'comments are optionalConditionalsConditionals are evaluated using Python'sevalfunction.
They can be as simple asifvar:...or as complex asifpathlib.Path('some-file').exists()andos.lstat('some-file').st_mode==33188:...Evaluation has access to standard library modules:ospathlibsubprocessand also to configuration variables defined inconfig.toml.ModuleVURFprovides python module that exposes approximately the same API as the CLI.ExamplefromvurfimportVurfwithVurf.context()aspackages:sections=packages.sections()packages.add('some-package',section=sections[1])assertpackages.has('some-package')packages.remove(['other-package','third-package'])