Skip to main content

A collection of Python utilities ported from the R ecosystem.

Project description

ruru

ruru

PyPI Version uv Ruff usethis

A collection of Python utilities ported from the R ecosystem.

Features

base module

The ruru.base module provides core utilities:

  • match_arg: A Python equivalent of R's match.arg function for verifying function arguments against a set of valid options. Recommended usage:
from ruru.base import match_arg

user_choice = "apple"
available_choices = ["Apple", "Banana", "Cherry"]

# Normalize user input before passing it to match_arg.
# Which transformation to use depends on the style of available_choices:
#   - .title() if choices look like "Apple"
#   - .upper() if choices look like "APPLE"
#   - .lower() if choices look like "apple"

user_choice = match_arg(user_choice.title(), available_choices)
  • pmatch: A Python equivalent of R's pmatch function for finding partial substring matches against a set of reference strings.

Inspired by the R base package.

config module

The ruru.config module gives an easy way to manage of configuration settings in Python applications via YAML files.

Recommended usage:

from importlib.resources import files
from ruru import config

config_path = files("<mypkg>.cli").joinpath("config.yml") 
config_dict = config.get(file = config_path)

Inspired by the R config package.

cli module

The ruru.cli module provides utilities for enhanced command-line interface output, including colored text, formatted headings, alert messages, and bullet-point lists.

Recommended usage:

from ruru import cli
cli.h1("Heading")
cli.alert("This is an alert message")

Inspired by the R cli package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruru-0.3.6.tar.gz (196.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ruru-0.3.6-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file ruru-0.3.6.tar.gz.

File metadata

  • Download URL: ruru-0.3.6.tar.gz
  • Upload date:
  • Size: 196.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.3

File hashes

Hashes for ruru-0.3.6.tar.gz
Algorithm Hash digest
SHA256 52cfbacde085322aef0184c2b03a6981375dcc4d6cc668f0e8641d770575e11c
MD5 285a80ecb8f5bef3a3227b7f47d5b9c8
BLAKE2b-256 ac3dcdea731202be755030ca4346f7d9bb09249da86ce5ce2bf54de05321ef9e

See more details on using hashes here.

File details

Details for the file ruru-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: ruru-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.3

File hashes

Hashes for ruru-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eb177d20b82e0b6799b48d8d6d931c0d8ef310243c4e8abe3e11aefe14e73d48
MD5 22ad1bc92e0613d27a1cdbc22181ffc0
BLAKE2b-256 ca4ea911a53ade8a9b6b7092092b81bb7c4ccb44d3dd478e574223c735d08c90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page