Skip to main content

Minimal input, auto path toolkit (mobile-first, Colab+Drive)

Project description

usekit

A lightweight, mobile-first Python toolkit for Memory-Oriented Software Architecture (MOSA).

Code is not function, but memory.

from usekit import u

u.wjb({"hello": "world"}, "config")     # write json to base
data = u.rjb("config")                  # read json from base
u.ujb({"version": "1.0"})               # update json

3-letter interface: Verb + Object + Location
Minimal typing. Semantic paths. Mobile-optimized.


Quick Start

Installation

pip install usekit

30-Second Demo

import usekit
from usekit import use, u, s

print("usekit:", usekit.__version__)

# Basic DATA operations
u.wjb({"hello": "MOSA"}, "config")      # write json base
data = u.rjb("config")                  # read json from base
u.ujb({"version": "1.0"})               # update json

# Safe operations (returns None on error)
data = s.rjb("missing")                 # safe read

Status

  • Version: 0.1.1
  • Stage: Alpha (API may change)
  • Focus: Stable DATA/NAVI core, EXEC layer expanding

Links:


Core Concept

3-Letter Interface

Pattern: u.[action][format][location]

u.rjb()  →  read json base
u.wys()  →  write yaml sub
u.ujt()  →  update json tmp

Actions

DATA I/O: read, write, update, delete, exists
NAVI: path, find, list, get, set
EXEC: exec, import, rerun, quit

Formats

Basic: json, yaml, txt, md, csv
Advanced: sql, ddl, pyp (Python), any

Locations

base, sub, now, tmp, dir, pre, cache


Usage Examples

File Operations

from usekit import u

# JSON operations
data = u.rjb("config")                  # read
u.wjb({"key": "value"}, "output")       # write
u.ujb({"new": "data"}, "config")        # update
u.djb("old")                            # delete
exists = u.ejb("config")                # check exists

# Different locations
u.rjs("config")                         # read json sub
u.wyt({"temp": "data"}, "cache")        # write yaml tmp
u.rtb("readme")                         # read text base

Pattern Matching

# Find files with wildcards
users = u.fjb("user_*")                 # find user_*.json
for item in users:
    print(item["file"], item["data"])

# List all files
json_files = u.ljb()                    # list all json in base

# Recursive search
logs = u.fjb("log_*", walk=True)        # search subdirectories

KeyData (Nested Access)

# Data: {"user": {"profile": {"email": "a@b.com"}}}

# Read nested value
email = u.rjb("config", keydata="user/profile/email")

# Update nested value
u.ujb("config", keydata="user/profile/email", data="new@example.com")

# Array access
name = u.rjb("data", keydata="items[0]/name")

# Get field from multiple files
emails = u.rjb("user_*", keydata="email")

Python Module Operations

from usekit import use

# 1) Write a Python file
data = """
def add(a, b):
    return a + b

def multiply(x, y, z=1):
    return x * y * z

def greet(name, title="Mr.", greeting="Hello"):
    return f"{greeting}, {title} {name}!"
"""
use.write.pyp.base(data, nm="test_import")

# 2) Import functions (no path needed)
use.imp.pyp.base("test_import:add, multiply")

print(add(10, 20))                      # 30
print(multiply(10, 2, 3))               # 60

# 3) Execute function directly
use.exec.pyp.base(
    "test_import:greet",
    "Alice",
    title="Dr."
)

SQL Operations

# Execute SQL
results = u.esb("SELECT * FROM users")

# With parameters
u.esb(
    "SELECT * FROM users WHERE age > :age",
    params={"age": 18}
)

# Read SQL file
query = u.rsb("queries/select_users")

Safe Mode

from usekit import s

# Returns None instead of exceptions
data = s.rjb("missing")                 # returns None if error
config = s.rjb("config") or {}

Google Colab

# Mount Google Drive
from google.colab import drive
drive.mount("/content/drive")

# Use usekit
from usekit import u

data = u.rjd("config", dir_path="/content/drive/MyDrive/project")
u.wjd(results, "output", dir_path="/content/drive/MyDrive/project")

Semantic Paths

# Configure in .env
# PATH_BASE=/content/project
# PATH_DATA=/content/drive/MyDrive/datasets

# Use @ paths
data = u.rjb("@base/config")            # reads from PATH_BASE
model = u.rjb("@data/training")         # reads from PATH_DATA

Configuration

Environment File

usekit auto-generates .env:

# Core paths
PATH_BASE=/content/project
PATH_SUB=/content/project/data
PATH_NOW=/content
PATH_TMP=/tmp
PATH_DIR=/content/drive/MyDrive
PATH_PRE=/content/presets
PATH_CACHE=/tmp/cache

# Database (optional)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydb

Parameter Aliases

# Full form (IDE-friendly)
u.rjb(name="config", keydata="user/email", default=None)

# Short form (mobile-optimized)
u.rjb(nm="config", kd="user/email", df=None)

# Direct path (most common)
u.rjb("config")

Alias Rules: 4+ chars → 2-letter alias
namenm, keydatakd, defaultdf, dir_pathdp


Philosophy: MOSA

Memory-Oriented Software Architecture

  1. Code is Memory: Focus on data meaning, not file location
  2. Semantic Over Physical: Use meaningful names, not paths
  3. Mobile-First: Optimized for constrained environments
  4. Rule of 5: Keep cognitive chunks ≤ 5 elements
  5. SmallBig Design: 90% simple, 10% powerful

Token Economy

usekit saves ~65% tokens vs natural language:

Natural: "Read the JSON file named config from the base directory"
usekit:  u.rjb("config")

Tokens: ~12 → ~3

Ideal for LLM-assisted development.


Requirements

  • Python 3.7+
  • PyYAML
  • python-dotenv

Optional: pandas, beautifulsoup4, sqlalchemy


Roadmap

Current v0.1.1 (Alpha)

  • Stable DATA/NAVI layers
  • Expanding EXEC layer
  • 30+ format support

v0.2.0: Complete EXEC, enhanced SQL
v0.3.0: KeyMemory format, KQL language
v1.0.0: Stable API, full docs


Help System

from usekit import u

u.help()                                # overview
u.help("quick")                         # quick start
u.help("examples")                      # usage examples
u.help("pattern")                       # pattern matching
u.help("keydata")                       # nested access

License

MIT License


Links


Created by THE Little Prince, in harmony with ROP and FOP

usekit - Code is memory, not function

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

usekit-0.1.1.tar.gz (338.5 kB view details)

Uploaded Source

Built Distribution

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

usekit-0.1.1-py3-none-any.whl (471.2 kB view details)

Uploaded Python 3

File details

Details for the file usekit-0.1.1.tar.gz.

File metadata

  • Download URL: usekit-0.1.1.tar.gz
  • Upload date:
  • Size: 338.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for usekit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 35da0ae09d2e89a8d0e62b5f07f741ec1bbd11e5b128b3d9dc52b466e61ef504
MD5 1d0c94aac9656561f8a102c7617470ae
BLAKE2b-256 22c4625a77ceb2072a070c84661c151739de33ec06fd2a76649239e7a4a13d63

See more details on using hashes here.

File details

Details for the file usekit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: usekit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 471.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for usekit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 862982ae6d2fb635056707b8d0a0c0df9530af3c3e5fba6a296a5235518c6ad8
MD5 7a5dc7ed1f2479f6b3f3d5e037960e89
BLAKE2b-256 0da72df8204aaa25ce6036f0231de88a82e0244683b4eaa26e055e83a9aa9bc0

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