Skip to main content

Utility for Research (URes)

semantic-release: angular pre-commit Code style: black License: MIT Super-Linter Trufflehog Code Testing


Overview

URes (Utility for Research) is a Python library that centralizes reusable utilities for research and development. It provides batteries-included helpers for Docker workflows, Markdown and Zettelkasten notes, data structures, filesystem and network tasks, time/date conversion, string manipulation, and more.

Key Features

  • Docker management: Build, run, and orchestrate Docker images and containers with structured configuration objects.
  • Markdown & Zettelkasten: Work with Markdown files and front matter, and manage Zettelkasten-style notes with required metadata.
  • Data structures: Use tree and bi-directional link structures for organizing and traversing complex data.
  • Core utilities: File, time/date, string, secrets, and network helpers used across projects.
  • Literature tooling: Search across literature sources and manage citation data (when those modules are enabled).

Installation

pip install ures

API reference is generated from source on the documentation site: https://stone-home.github.io/Python-URes/.

Modules

Docker

The ures.docker module provides a high-level interface for managing Docker images and containers.

Key Features:

  • Programmatically build Docker images from a BuildConfig object.
  • Run containers with detailed runtime configurations using RuntimeConfig.
  • Orchestrate the building of multiple images with dependencies using ImageOrchestrator.

Example:

from ures.docker import Image, BuildConfig, Containers

# Define build configuration
build_config = BuildConfig(
    base_image="python:3.10-slim",
    python_dependencies=["flask", "gunicorn"],
    copies=[{"src": "./app", "dest": "/app"}],
    entrypoint=["gunicorn", "-b", "0.0.0.0:80", "app:app"]
)

# Build the image
image = Image("my-web-app")
image.build_image(build_config, dest=".")

# Run the container
containers = Containers(image)
container = containers.create()
containers.run()

Markdown & Zettelkasten

The ures.markdown module offers tools for working with Markdown files, including YAML front matter. The Zettelkasten class builds on this for note-taking with structured metadata.

  • MarkdownDocument: Load, create, and manipulate Markdown files with front matter.
  • Zettelkasten: Create Zettelkasten notes with required fields such as title, type, and tags.

Data structures

The ures.data_structure module provides reusable data structures:

  • TreeNode: A tree structure with methods for adding, removing, and traversing nodes.
  • BiDirectional: A bi-directional linked list for forward and backward traversal.

Core utilities

  • ures.files: File system helpers (recursive file listing, filtering by name, listing directories, creating temp folders).
  • ures.timedate: Time/date conversion helpers (datetimes and Unix timestamps to formatted strings, getting the current time).
  • ures.string: String utilities such as Zettelkasten-style IDs, unique IDs, memory-size formatting, and capitalization.
  • ures.secrets: SecureKeyManager for managing API keys and other secrets via different storage methods.
  • ures.network: IP and subnet helpers (validation, containment checks, and IP generation from subnets).

Literature tooling (optional)

If you use the literature search and citation modules, URes can also help with:

  • Literature search: Configuration-driven multi-source paper search, with adapters and caching.
  • Literature citation: Extractors and helpers to manage citation data and apply citation rules.

Development

To contribute to URes, please follow these steps:

  1. Clone the repository:
    git clone https://github.com/stone-home/Python-URes.git
    
  2. Install the dependencies:
    cd Python-URes
    poetry install
    
  3. Run the tests:
    poetry run pytest
    

License

This project is licensed under the MIT License – see the LICENSE file for details.

Release files for ures 3.1.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 ures 3.1.0
File Size Uploaded
ures-3.1.0.tar.gz 121.0 kB Details

Built distribution (wheel)

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

Total release size: 261.7 kB

Release files / ures-3.1.0.tar.gz

Download URL ures-3.1.0.tar.gz
Size 121.0 kB
Tags Source
SHA-256 checksum
How to use checksums
15e2ff88ccd7b1db55a9daf172b614ebe0da861110eceb63bc810b493c3225f8
BLAKE2b-256 checksum
How to use checksums
1aa5d3d8ab48ec4e6353e44f037a9f8118b6b37ea65100544231dee0ec0e8132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.14 Linux/6.17.0-1022-azure

Release files / ures-3.1.0-py3-none-any.whl

Download URL ures-3.1.0-py3-none-any.whl
Size 140.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f36a1967dc1751f1949f61026179bea183d3fe8933e3a53bce531ec8006650f6
BLAKE2b-256 checksum
How to use checksums
d4a8796fc0f02c0cf20973f32288a2ca9e8ec458d5d005a7c34a8b1a6101a3a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.14 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

3.2.0

2 release files

3.1.1

2 release files

This release

3.1.0 This release

2 release files

3.0.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.1

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

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