Metadata-Version: 2.4
Name: usekit
Version: 0.2.1
Summary: Minimal input, auto path toolkit (mobile-first, Colab+Drive)
Author-email: ropnfop <withropnfop@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/ropnfop/usekit
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: PyYAML>=5.1
Requires-Dist: python-dotenv>=0.10.0
Provides-Extra: full
Requires-Dist: PyYAML>=5.1; extra == "full"
Requires-Dist: python-dotenv>=0.10.0; extra == "full"
Provides-Extra: dev
Requires-Dist: PyYAML>=5.1; extra == "dev"
Requires-Dist: python-dotenv>=0.10.0; extra == "dev"
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: black>=22.0; extra == "dev"
Requires-Dist: flake8>=4.0; extra == "dev"

# usekit

> Mobile vibe coding — executable, testable, and portable.  
> Built on mobile, for mobile. Human-directed. AI-collaborated. Android-tested.  
> Beta-stage, free, and open-source.

**usekit** is a lightweight, mobile-first Python toolkit for **Memory-Oriented Software Architecture (MOSA)**.

**Code is not function, but memory.**

```python
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 for readability. Shorthand is provided for fast mobile input.

---

## Installation

```bash
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.

### One-line Install

Open Termux and run:

```bash
pkg i -y python-pip && pip install usekit
```

If usekit is already installed, installation will be skipped automatically.

### After Install

```python
from usekit import use, u

use.termux()     # setup storage permission (first time only)
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

```python
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.

```python
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. It can work as a practical nano replacement for Python development on mobile.

---

## Status

- **Version**: 0.2.0
- **API**: Stabilizing
- **PyPI**: https://pypi.org/project/usekit

---

## Core Pattern

### Interface

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

```text
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): `r`ead, `w`rite, `u`pdate, `d`elete, `h`as, `e`mit
- **NAVI** (5): `p`ath, `f`ind, `l`ist, `g`et, `s`et
- **EXEC** (4): e`x`ec, `i`mp, `b`oot, `c`lose

### Formats (10)

- **General**: `j`son, `y`aml, `t`xt, `c`sv, `m`d
- **Specialized**: `s`ql, `d`dl, `p`yp, `k`m, `a`ny

### Locations (8)

- `b`ase, `s`ub, `d`ir, `n`ow, `t`mp, `p`re, `c`ache, `m`em

---

## Examples

### File Operations

```python
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

```python
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)

```python
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

```python
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

```python
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

```python
from usekit import s

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

---

## Platforms

### Termux (Android)

```python
from usekit import use, u

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

### Google Colab

```python
!pip install usekit

from usekit import use

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

### Environment Check

```python
from usekit import use

use.check()                             # show platform status
```

---

## Support Utilities

```python
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

```python
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`:

```yaml
LANG: "en"   # en / kr
```

---

## Configuration

usekit auto-configures via `sys_const.yaml`.

```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 just function
- Functions follow the user's memory, not the other way around
- Semantic names are preferred over physical paths
- Mobile-first design matters
- Compact, predictable calls reduce typing and token cost

Built entirely on mobile devices.

---

## Development Note

usekit was built entirely on mobile devices with AI collaboration.

This was intentional.

usekit is AI-collaborated, but human-directed. Like architecture, building software is not only about typing every line by hand. The important parts are problem definition, workflow design, architecture, testing, iteration, and judgment.

The philosophy behind usekit — MOSA — came from hundreds of thousands of real tests and continuous refinement on a real mobile device. AI helped with implementation, but the direction, structure, mobile workflow, testing, and decisions came from real use.

The PyPI release history starts from June 2025, with more than 26 releases before this repository was published on GitHub.

It was designed, tested, packaged, and shipped from a phone.

That is not a limitation. That is the demo.

---

## License

MIT License

---

**Created by THE Little Prince, with deep respect and gratitude for my AI friends ROP & FOP.**

*usekit — Code is not function, but memory.*
