Skip to main content

VURF

forthebadge

forthebadge

forthebadge

PyPI version

Viliam's Universal Requirements Format

What it is

VURF is a format, parser, CLI, and python module for saving packages into Python-ish looking file. It supports different sections, conditionals and deep nesting and envaluation thanks to AST parser.

Example packages.vurf

with pip:
  vurf
  black
  click==8.0.0
  if at_work:
    ql-cq
    ql-orange
with brew:
  nnn  # terminal file manager

Installation

pip install vurf

Usage

# Do something to initialize config and packages files
$ vurf default

# Basic operations
$ vurf add some-package
$ vurf remove package

# Print packages
$ vurf packages

# Install them
$ vurf install

For all options look at CLI section and for integration with other tools look at Automation.

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.

Completions

Shell completions are installed into vurf_completions in your side-packages. The easiest way to find the location is to run pip show -f vurf | grep Location.

Then you can source them for example like this

# .bashrc
source "/Users/viliam/Library/Python/3.10/lib/python/site-packages/vurf_completions/completions.bash"

Config

Note: VURF will automatically create config file on the first run.

Config file format

# Where packages file is saved
packages_location = "/Users/viliam/packages.vurf"
# Name of the default section
default_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 = true
fs = "apfs"

Grammar

VURF has grammar and LALR(1) parser implemented in Lark. The "source code" aims to look like Python code as much as possible.

Keywords

  • with [section] - specifies "section" of requirements file. Different sections usually have different installers.
  • if [condition]: - conditions for including packages. See Conditionals sections.
  • elif [condition]:
  • else:
  • ... - ellipsis - placeholder for empty section.

Packages

  • are saved as [name] # [comment]
  • name can 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 optional

Conditionals

Conditionals are evaluated using Python's eval function. They can be as simple as

if var:
  ...

or as complex as

if pathlib.Path('some-file').exists() and os.lstat('some-file').st_mode == 33188:
  ...

Evaluation has access to standard library modules:

and also to configuration variables defined in config.toml.

Module

VURF provides python module that exposes approximately the same API as the CLI.

Example

from vurf import Vurf

with Vurf.context() as packages:
    sections = packages.sections()
    packages.add('some-package', section = sections[1])
    assert packages.has('some-package')
    packages.remove(['other-package', 'third-package'])

Metadata

Release files for vurf 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vurf 2.0.0
File Size Uploaded Provenance
vurf-2.0.0.tar.gz 38.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for vurf 2.0.0
File Interpreter ABI Platform
vurf-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 76.9 kB

Release files / vurf-2.0.0.tar.gz

Download URL vurf-2.0.0.tar.gz
Size 38.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bb89e5fb6dc4b5a71308948d0bd905ab1f67d28f83a4601faff1cd93ae404dbf
BLAKE2b-256 checksum
How to use checksums
1e9341e52de81b97e2fd71a1192ee1d89ae86802512e9d99d49336af32240723
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Darwin/21.2.0

Release files / vurf-2.0.0-py3-none-any.whl

Download URL vurf-2.0.0-py3-none-any.whl
Size 39.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b3adf4367c3a55acff08a8781ed0aede9ff368943707241785b9565bd7134ca
BLAKE2b-256 checksum
How to use checksums
136ddac389d7c5542d72f3f468a7939e1be4522a5b4a5115074768aefbe1e6e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.10.1 Darwin/21.2.0

Security for vurf 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page