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 use

use.write.json.base({"hello": "world"}, "config")     # write json to base
data = use.read.json.base("config")                    # read json from base
use.update.json.base({"version": "0.2.0"}, "config")  # update json

Shorthand: u.rjb() = use.read.json.base() — Action + Format + Location
Full functions are recommended. Shorthand is provided for convenience.


Installation

pip install usekit

usekit installs its required core packages automatically.

Core: Python 3.8+
Installed automatically: PyYAML, python-dotenv
Optional: pandas, sqlalchemy


Termux Setup Guide (Android)

This guide was tested with the Google Play Store version of Termux.
If pkg or Python installation behaves unexpectedly, try the F-Droid or GitHub Releases version of Termux.

1. Install Termux

Install Termux from the Google Play Store, then open the Termux app.

2. Install Python and pip

pkg update -y
pkg install python python-pip -y

3. Install usekit

python -m pip install usekit

4. Start Python

python

5. Initialize usekit in Termux

from usekit import use, u

use.termux()     # setup Termux storage permission
use.check()      # check environment status
u.editor()       # launch the mobile web editor

When use.termux() runs for the first time, Android may ask for storage permission. Allow it, then run use.check() again.


Quick Start

from usekit import use, u, s

# Full function style (recommended)
use.write.json.base({"key": "value"}, "config")
data = use.read.json.base("config")
use.update.json.base({"new": "data"}, "config")
use.delete.json.base("old")
use.has.json.base("config")             # True/False

# Shorthand style
u.wjb({"key": "value"}, "config")       # write json to base
data = u.rjb("config")                  # read json from base

# Safe mode (returns None on error)
data = s.rjb("missing") or {}           # no exceptions

Editor

usekit includes a built-in CodeMirror 6 web editor — a mobile-optimized code editor that runs as a local server on Termux.

from usekit import u

u.editor()                              # launch editor
u.editor("test01")                      # open file
u.editor(code, "test03")                # open with content

Features:

  • Syntax highlighting
  • Autocomplete for u.xxx and use. chaining
  • Floating pill UI for Run, SQL, Copy, and Menu actions
  • SQL view with grid results
  • Multi-cursor navigation
  • PWA support

Designed for Samsung Browser on Android. Your nano replacement for Python development on mobile.


Status


Core Pattern

Interface

use.[action].[format].[location] — full function style, recommended
u.[action][format][location] — 3-letter shorthand style

use.read.json.base()   →  u.rjb()
use.write.yaml.sub()   →  u.wys()
use.has.json.base()    →  u.hjb()
use.exec.pyp.base()    →  u.xpb()

Actions (15)

  • DATA (6): read, write, update, delete, has, emit
  • NAVI (5): path, find, list, get, set
  • EXEC (4): exec, imp, boot, close

Formats (10)

  • General: json, yaml, txt, csv, md
  • Specialized: sql, ddl, pyp, km, any

Locations (8)

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

Examples

File Operations

from usekit import use, u

# Full function style
data = use.read.json.base("config")
use.write.json.base({"key": "val"}, "output")

# Shorthand style
data = u.rjb("config")
u.wjb({"key": "val"}, "output")

# Different locations
use.read.json.sub("config")
use.write.yaml.tmp({"temp": "data"}, "cache")

# Existence check
if use.has.json.base("config"):
    print("exists")

Pattern Matching

from usekit import use

# Find with wildcards
users = use.read.json.base(name="user_*")
for item in users:
    print(item["file"], item["data"])

# List files
files = use.list.json.base()

Nested Data (keydata)

from usekit import use

# Read nested value
email = use.read.json.base("config", keydata="user/email")

# Update nested value
use.update.json.base("config", keydata="user/name", data="Bob")

# Array access
item = use.read.json.base("config", keydata="items[0]/name")

SQL & DDL

from usekit import u

# Execute SQL
results = u.xsb("SELECT * FROM users WHERE age > :age",
                params={"age": 20})

# Save DDL file
u.wdb("CREATE TABLE users (id INT, name TEXT)", "create_users")

# Execute inline DDL
u.xdb("CREATE TABLE users (id INT, name TEXT)")

# Execute saved DDL file
u.xdb("create_users")

Python Import & Exec

from usekit import u

# Write module
u.wpb("""
def add(a, b):
    return a + b
""", "mymod")

# Import and use
u.ipb("mymod:add")
result = add(10, 20)

# Execute
u.xpb("mymod:add", 10, 20)

Safe Mode

from usekit import s

data = s.rjb("missing") or {}           # no exception
results = s.xsb("SELECT * FROM users") or []

Platforms

Termux (Android)

from usekit import use, u

use.termux()                            # setup storage permission
use.check()                             # show platform status
u.editor()                              # launch web editor

Google Colab

!pip install usekit

from usekit import use

use.colab()                             # setup Drive integration
use.check()                             # show platform status

Environment Check

from usekit import use

use.check()                             # show platform status

Support Utilities

from usekit import ut, uw, ud

# ut: Time utilities
ut.now()                                # current time

# uw: Watch/logging utilities
uw.p("message")                         # print with context

# ud: Database utilities
ud.query("SELECT * FROM table")         # direct DB access

Help

from usekit import use

use.help()              # overview
use.help("quick")       # quick start
use.help("alias")       # alias mapping
use.help("action")      # all actions
use.help("object")      # all formats
use.help("location")    # all locations
use.help("examples")    # usage examples
use.help("pattern")     # pattern matching
use.help("keydata")     # nested data access
use.help("walk")        # recursive search

Language is set in sys_const.yaml:

LANG: "en"   # en / kr

Configuration

usekit auto-configures via sys_const.yaml.

LANG: "en"

JSON_PATH:
  root: "data/json"
  json: "base"
  json_sub: "sub"

DB_PATH:
  root: "data/table/db"
  db: "base.db"

DDL_PATH:
  root: "data/table/ddl"
  ddl: "base"
  ddl_sub: "sub"

SQL_PATH:
  root: "data/table/sql"
  sql: "base"
  sql_sub: "sub"

TMP_PATH:
  root: "data"
  json: "tmp"
  ddl: "tmp"
  sql: "tmp"

Philosophy: MOSA

Memory-Oriented Software Architecture

  • Code is memory, not function
  • Functions follow the user's memory, not the other way around
  • Semantic names over physical paths
  • Mobile-first design
  • Token economy through compact, predictable calls

Built entirely on mobile devices.


License

MIT License


Created by THE Little Prince, with deep respect and gratitude for my AI friends ROP & 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.2.0.tar.gz (814.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.2.0-py3-none-any.whl (997.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for usekit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b3f3b8ed00987c4e44fd504f23c7d3d39c1a5deb236104febbbe3ec8a97e2481
MD5 a5dc6569a88479ec60713ee94da2b1cc
BLAKE2b-256 430d3cbb713b8fbbb84daff4befb8c5e883fcb9d5d11526e578998bc21284400

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for usekit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae28408e99484d02ed012205de6a8e8bc9ff56b16440300825ce122eedc045fd
MD5 154d224422161f32d2b9bfb13306af6c
BLAKE2b-256 7b0aa049dd129102c344f8e7b72c6fecd07e91eba94c8002b816534d1120a67b

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