core

Kosha is a tool for building a context for code generation based on your repo and environment.

Utils

Utility functions for finding the repo root, copying the SKILL.md file, running async code from sync contexts, and getting installed package versions.


parse


def parse(
    code:NoneType=None, p:NoneType=None
):

Parse source, tag parents, return (tree, imp, top_fns, all_fns, imp2mod). Cached — called freely.


mv_skill_md


def mv_skill_md(
    dry_run:bool=True, dir:NoneType=None
)->None:

Copy bundled SKILL.md to skill directories.


repo_root


def repo_root(
    
)->Path:

Find the root of the current git repository, or None if not in a repo.


arun


def arun(
    coro
)->any:

Run an async coroutine from sync code, even if already inside an event loop

async def _add(a, b): return a + b
assert arun(_add(1, 2)) == L(3)
print('arun: sync context ok')
arun: sync context ok
async def _test_nested():
    result = arun(_add(10, 20))
    assert first(result) == 30, f'got {result}'
arun(_test_nested())
print('arun: nested-loop context ok')
arun: nested-loop context ok
mv_skill_md()
Would copy /Users/71293/code/personal/orgs/kosha/nbs/SKILL.md to: ['/Users/71293/code/personal/orgs/kosha/.agents/skills/kosha/SKILL.md', '.claude/skills/kosha/SKILL.md']
mv_skill_md(dir='.')
Would copy /Users/71293/code/personal/orgs/kosha/nbs/SKILL.md to: ['.agents/skills/kosha/SKILL.md', '.claude/skills/kosha/SKILL.md']

pkg_trans_deps


def pkg_trans_deps(
    seeds:list, depth:int=2
)->L:

BFS over importlib.metadata requires: return seeds + all transitive deps up to depth levels (installed only, no optional extras).


env_pkg_versions


def env_pkg_versions(
    pyproject:bool=True, depth:int=1
)->dict:

Get a dict of installed package versions using importlib.metadata. passing depth traverse multiple layers of dependencies

installed_packages(pyproject=True)
['litesearch', 'pyan3', 'pyskills', 'watchfiles']
pkg_trans_deps(['litesearch'], depth=1)
['pdf-oxide', 'onnxruntime', 'codesigs', 'usearch', 'notebook', 'chonkie', 'yake', 'tokenizers', 'litesearch', 'pandas', 'model2vec', 'pillow', 'fastlite']
# httpx depends on httpcore; depth=1 should include both httpx + httpcore
d1 = pkg_trans_deps(['httpx'], depth=1)
assert 'httpx' in d1, "seeds must be in result"
assert 'httpcore' in d1, f"depth=1 should include httpcore (direct dep of httpx): {d1}"
# depth=0 returns only seeds
assert list(pkg_trans_deps(['httpx'], depth=0)) == ['httpx'], "depth=0 should return only seeds"
# pyproject seeds → depth=2 expansion
pyp = installed_packages(pyproject=True)
if pyp:
    deep = pkg_trans_deps(list(pyp), depth=2)
    assert set(pyp).issubset(set(deep)), "seeds must be a subset of result"
    assert len(deep) >= len(pyp), "depth=2 should expand beyond pyproject direct deps"
    print(f"pkg_trans_deps ok: {len(pyp)} pyproject seeds → {len(deep)} packages at depth=2")
else:
    print("pkg_trans_deps ok (no pyproject deps to test)")
pkg_trans_deps ok: 4 pyproject seeds → 51 packages at depth=2
env_pkg_versions()
{'usearch': '2.25.2',
 'chonkie': '1.6.5',
 'pyan3': '2.6.0',
 'tokenizers': '0.23.1',
 'pyskills': '0.0.7',
 'watchfiles': '1.1.1',
 'fastlite': '0.2.4',
 'pandas': '3.0.2',
 'fastcore': '1.12.47',
 'model2vec': '0.8.1',
 'anyio': '4.13.0',
 'pdf_oxide': '0.3.45',
 'onnxruntime': '1.26.0',
 'codesigs': '0.0.2',
 'Jinja2': '3.1.6',
 'pillow': '12.2.0',
 'yake': '0.7.3',
 'litesearch': '0.0.29',
 'notebook': '7.5.6'}

embedder

jina-embeddings-v2-base-code is a model designed for code understanding and generation tasks


emb_query


def emb_query(
    e, # embedder factory — callable returning a FastEncode or AutoEmbeddings instance
):

Curry an embedder factory into a query-embedding function t,**kw -> embedding.


emb_doc


def emb_doc(
    e, # embedder factory — callable returning a FastEncode or AutoEmbeddings instance
):

Curry an embedder factory into a document-embedding function t,**kw -> embedding.


static_embedder


def static_embedder(
    emb_model:str='minishlab/potion-retrieval-32M', # HuggingFace model id for static embeddings
)->BaseEmbeddings:

Load or return cached static (potion-retrieval) embedder (24h TTL).


embedder


def embedder(
    emb_model:AttrDict={'model': 'mrsladoje/CodeRankEmbed-onnx-int8', 'onnx_path': 'onnx/model.onnx', 'prompt': {'query': 'Represent this query for searching relevant code: {text}', 'document': '{text}'}}, # model config AttrDict (model name, onnx_path, prompt instructions)
    model_dict:AttrDict={'model': 'onnx-community/embeddinggemma-300m-ONNX', 'onnx_path': 'onnx/model.onnx', 'prompt': {'document': 'Instruct: document \n document: {text}', 'query': 'Instruct: query \n query: {text}'}},
    repo_id:NoneType=None, md:NoneType=None, md_nm:NoneType=None, normalize:bool=True, dtype:type=float16,
    tti:bool=False, prompt:NoneType=None, hf_token:NoneType=None, batch_size:int=32, parallel:int=0,
    quantize:NoneType=None, max_seq_len:NoneType=None
)->FastEncode:

Load or return cached CodeRankEmbed ONNX document embedder (24h TTL). Hardware-aware: tunes parallel/batch_size to host (override via KOSHA_EMBED_PARALLEL / KOSHA_EMBED_BATCH).

emb_doc(embedder)('def add(a, b): return a + b')
array([[ 1.1848e-02, -3.0869e-02,  2.4231e-02, -1.4404e-02, -8.3590e-04,
         4.9469e-02, -4.8828e-02, -2.7969e-02, -9.0027e-03, -2.9724e-02,
         4.6539e-02,  6.9458e-02, -1.0262e-02, -4.5319e-02,  1.8244e-03,
        -4.2694e-02,  3.5950e-02, -1.4320e-02, -5.1086e-02,  5.8098e-03,
         1.0651e-01, -4.6417e-02,  1.8097e-02, -4.7485e-02,  5.7495e-02,
        -3.5004e-02, -5.4047e-02,  1.2405e-02,  8.4152e-03,  3.8361e-02,
        -7.0129e-02,  6.0272e-02,  3.6346e-02,  2.6718e-02,  2.9480e-02,
         2.7222e-02,  3.1738e-02, -3.4058e-02, -5.7465e-02, -3.3966e-02,
        -2.2888e-02,  5.6030e-02,  3.2043e-02,  2.3209e-02,  4.4769e-02,
         6.5651e-03, -3.4142e-03,  1.6022e-02,  7.7515e-02, -2.0081e-02,
         3.2883e-03, -7.1045e-02, -7.4341e-02,  7.9575e-03,  2.4155e-02,
         1.9791e-02, -5.1880e-03, -2.0493e-02,  5.5237e-02, -2.2171e-02,
         7.5989e-02,  7.3181e-02,  4.8752e-03,  2.5543e-02,  8.8730e-03,
        -2.0798e-02,  9.5825e-03,  3.5309e-02,  1.0292e-02, -9.3765e-03,
         1.3924e-02, -5.5695e-02,  3.5767e-02, -1.5228e-02, -4.6234e-03,
         2.3346e-02, -9.1629e-03,  2.6489e-02,  9.2545e-03, -1.0910e-03,
         9.2163e-03, -5.5206e-02,  1.1029e-01, -5.1231e-03, -7.5134e-02,
         6.8848e-02, -4.6783e-02,  2.9037e-02, -1.0658e-02, -1.4297e-02,
        -2.2232e-02, -6.0364e-02, -2.3376e-02,  1.7487e-02, -1.1499e-01,
        -1.2428e-02,  4.2145e-02,  6.9809e-03,  1.1841e-02,  5.0323e-02,
         4.0512e-03,  2.7420e-02,  1.9028e-02,  4.5166e-03,  1.8845e-02,
        -3.7048e-02, -6.0196e-03, -1.5717e-02, -2.6581e-02, -2.7817e-02,
        -1.9669e-02,  2.8870e-02,  1.7105e-02, -4.1595e-02, -3.1616e-02,
         2.9617e-02, -5.8716e-02,  2.7969e-02,  2.9251e-02,  4.0283e-02,
        -3.5889e-02,  3.9917e-02, -5.0751e-02,  4.1504e-02, -3.9291e-03,
         4.4525e-02,  4.0894e-02, -1.7670e-02,  1.7563e-02, -1.6449e-02,
         2.0203e-02, -6.3904e-02,  7.6477e-02,  3.1433e-02,  1.0193e-02,
         8.7433e-03,  3.1769e-02,  3.2410e-02,  1.3588e-02,  7.5340e-03,
         7.1449e-03,  1.2276e-02, -1.0498e-02,  1.7639e-02, -6.3721e-02,
        -1.3985e-02,  7.0763e-03,  4.7226e-03, -2.4200e-02, -8.1329e-03,
         4.2480e-02,  4.2633e-02, -2.5196e-03,  6.4209e-02, -1.3374e-02,
        -2.5589e-02,  3.6011e-02,  1.5793e-02,  1.5244e-02, -3.8910e-02,
         8.1421e-02,  7.9193e-03, -6.5979e-02, -6.8550e-03, -1.8555e-02,
        -4.5959e-02,  1.6332e-04, -9.7809e-03, -2.9297e-03,  3.1342e-02,
         4.9500e-02, -5.3131e-02,  3.4515e-02,  3.2288e-02,  1.7681e-03,
        -2.3132e-02, -3.9673e-02,  1.4772e-03, -1.1215e-02, -4.7119e-02,
        -1.2939e-02, -7.3814e-03,  4.9927e-02, -1.1468e-04, -2.9297e-03,
        -4.8248e-02, -3.5645e-02, -8.3160e-03, -3.4943e-02,  3.1166e-03,
         5.9843e-04,  3.5217e-02,  1.0616e-04,  1.4458e-02, -4.1565e-02,
         5.7098e-02,  4.1618e-03,  6.2042e-02,  1.0826e-02,  6.6528e-02,
         3.9703e-02, -7.8064e-02,  1.6968e-02, -4.3274e-02, -1.9470e-02,
         3.2196e-02, -3.7727e-03, -1.3908e-02,  1.6663e-02, -9.3567e-02,
         3.2562e-02,  1.9196e-02, -2.5787e-02,  1.9638e-02,  7.2266e-02,
        -5.6610e-02, -2.2339e-02, -5.0018e-02, -4.0039e-02, -5.7190e-02,
         2.6627e-02,  6.9389e-03,  4.9194e-02, -5.2368e-02,  5.3894e-02,
         3.8433e-03, -3.6438e-02,  6.8848e-02, -4.4067e-02,  6.4941e-02,
        -2.6123e-02, -1.5121e-02,  6.2500e-02,  5.0171e-02,  4.7974e-02,
         1.4830e-04,  8.7814e-03,  4.0039e-02,  4.6051e-02, -2.9572e-02,
         3.6072e-02, -2.1301e-02, -5.3749e-03,  4.5441e-02, -1.7212e-02,
         1.7014e-02, -6.3354e-02, -3.5706e-02, -5.2567e-03,  3.0670e-03,
        -6.1279e-02, -2.9190e-02,  7.2510e-02, -2.5055e-02,  2.2217e-02,
         7.3204e-03, -6.4087e-02, -2.1194e-02, -5.9021e-02,  7.2289e-03,
         7.0496e-02,  4.8492e-02, -6.6872e-03,  3.0384e-03,  1.3954e-02,
         3.1250e-02, -1.3199e-02, -4.6143e-02,  5.1514e-02, -4.7180e-02,
        -6.9641e-02, -3.5828e-02, -1.0651e-02,  1.3535e-02, -1.9440e-02,
         2.6169e-02,  1.0077e-01, -9.6817e-03,  2.0844e-02,  2.4204e-03,
        -3.8666e-02,  3.6011e-02,  3.3112e-02,  6.7627e-02, -5.0232e-02,
         5.7953e-02,  7.9117e-03,  9.3002e-03,  1.3809e-02, -3.6621e-02,
         2.1942e-02, -1.1589e-02, -3.1342e-02,  8.3313e-03, -1.1681e-02,
         2.0233e-02,  1.2299e-02,  2.2936e-04, -1.1734e-02, -2.6703e-02,
        -5.8319e-02,  3.3844e-02, -1.2650e-02, -2.2934e-02, -2.4612e-02,
         4.4373e-02, -1.8682e-03, -1.0300e-02,  2.8046e-02,  7.3608e-02,
        -3.7201e-02,  1.3313e-02,  1.2054e-02, -1.5793e-02,  9.5415e-04,
         2.7847e-02, -1.8555e-02, -2.2936e-04,  5.7831e-02, -1.2268e-02,
        -2.4109e-02, -4.9957e-02,  1.3458e-02,  1.8494e-02, -2.7145e-02,
        -2.8366e-02, -2.3251e-03,  8.1787e-03,  6.2218e-03, -3.8788e-02,
        -4.8096e-02,  7.4577e-04, -2.0111e-02, -2.0432e-02, -2.0660e-02,
        -1.4168e-02,  3.8696e-02, -5.5817e-02, -2.3346e-02, -1.2970e-02,
         8.6609e-02,  5.4443e-02, -1.3947e-02,  3.2104e-02,  9.5291e-03,
         1.0277e-02,  5.7922e-02, -3.1982e-02, -2.8183e-02,  5.5054e-02,
        -3.6102e-02, -3.2440e-02,  1.6190e-02,  3.0182e-02, -2.4658e-02,
        -5.1788e-02,  5.5656e-03, -3.3691e-02,  6.3705e-03, -1.6266e-02,
        -3.1872e-03,  2.5620e-02, -1.4427e-02,  1.8082e-02,  8.6060e-03,
        -1.0815e-01,  1.8402e-02, -5.7526e-02,  2.9724e-02, -7.4341e-02,
         1.1154e-02,  3.2104e-02, -1.6907e-02,  2.2064e-02,  1.1719e-02,
        -2.2064e-02, -2.4185e-02,  3.6224e-02, -1.8539e-02, -2.2964e-02,
         2.1347e-02,  6.5430e-02,  3.0472e-02, -5.6839e-03, -5.5023e-02,
        -4.9133e-02, -3.1555e-02, -5.6610e-03,  4.2419e-02, -2.6184e-02,
        -1.3588e-02,  6.3934e-03,  2.8931e-02,  1.5350e-02, -4.1260e-02,
         1.9455e-02, -8.3771e-03, -1.6174e-02, -1.2505e-02, -1.4923e-02,
        -2.6337e-02, -4.1962e-02,  2.2614e-04,  1.4641e-02, -9.3231e-03,
        -4.9500e-02,  1.7029e-02, -4.8752e-03,  3.0869e-02, -5.8228e-02,
        -2.0233e-02,  2.2984e-03, -6.2675e-03, -5.8174e-03,  1.3664e-02,
         4.2511e-02,  5.1819e-02, -6.8321e-03,  2.6794e-02,  2.2491e-02,
        -2.3682e-02,  1.2863e-02,  1.7365e-02, -2.6283e-03,  6.3744e-03,
        -2.6077e-02, -3.8422e-02,  4.2816e-02,  2.1992e-03, -4.2999e-02,
         9.3002e-03,  4.1321e-02, -1.7120e-02,  1.7868e-02,  4.2297e-02,
         1.6708e-02, -2.2903e-02,  1.9592e-02,  8.5571e-02, -3.9307e-02,
         5.6610e-02, -1.3504e-02,  7.0374e-02, -1.1169e-02, -6.3629e-03,
         5.5511e-02,  1.2405e-02, -2.0351e-03, -1.6098e-02, -1.2894e-03,
         5.7030e-03,  4.8462e-02,  6.9824e-02,  9.3994e-03, -2.2644e-02,
         2.3880e-02,  3.3936e-02,  3.7903e-02, -4.7516e-02,  4.6814e-02,
        -3.3020e-02, -2.4155e-02,  5.8289e-02, -1.1177e-02,  1.5083e-02,
        -1.3977e-02,  6.9214e-02, -5.3345e-02, -1.0490e-02,  2.2526e-03,
        -1.7502e-02,  3.0792e-02,  3.5034e-02,  2.6321e-02,  1.1581e-02,
         7.3669e-02, -1.3565e-02,  8.0322e-02,  2.7771e-03,  5.9929e-03,
        -2.9572e-02,  3.1738e-02,  2.4658e-02,  9.8133e-04,  1.8784e-02,
        -2.4277e-02,  2.4918e-02,  5.0049e-02, -1.9928e-02, -1.2581e-02,
         4.1718e-02, -3.2562e-02,  4.0527e-02, -6.8512e-03, -5.1514e-02,
         1.7181e-02, -4.5929e-02,  2.5116e-02, -6.0181e-02,  2.1423e-02,
        -3.9673e-02, -3.8696e-02, -5.7129e-02, -2.3621e-02, -2.3758e-02,
         4.3427e-02, -3.9429e-02, -1.9485e-02,  1.0727e-02, -1.9363e-02,
        -4.0527e-02, -5.4901e-02, -1.7029e-02, -2.9221e-02,  1.1757e-02,
         5.2643e-02,  1.5198e-02, -4.7119e-02,  6.0921e-03,  3.5156e-02,
        -1.1314e-02,  2.4307e-02,  3.0762e-02,  2.9633e-02,  2.7939e-02,
        -2.5833e-02,  5.7281e-02, -3.1281e-03,  8.4305e-03, -2.0046e-03,
        -4.0405e-02,  8.2397e-02,  5.6335e-02,  5.9395e-03, -3.3226e-03,
        -2.2202e-03, -2.6276e-02,  1.4465e-02,  2.8992e-02, -5.1819e-02,
         3.3966e-02,  3.1525e-02, -3.1921e-02,  3.4332e-02,  6.1523e-02,
        -7.2693e-02, -3.8929e-03, -1.9302e-03,  1.0956e-02, -3.3813e-02,
        -1.4801e-02, -4.9622e-02,  1.7700e-02,  2.1347e-02, -2.8946e-02,
        -1.7960e-02, -3.0396e-02, -4.3945e-03,  4.1473e-02,  1.7151e-02,
        -8.0566e-03, -3.0060e-02, -4.0558e-02, -2.4780e-02, -1.1139e-01,
        -6.0730e-02, -2.9388e-02,  7.7393e-02, -5.5145e-02, -7.5760e-03,
         4.5509e-03, -5.7739e-02,  2.6382e-02,  6.9857e-04,  5.3131e-02,
        -2.1637e-02, -1.9104e-02, -3.1021e-02, -2.6993e-02, -2.9087e-03,
        -2.2297e-03, -4.3213e-02, -6.0791e-02,  1.5732e-02, -3.5461e-02,
        -5.4169e-02, -2.8793e-02, -1.0735e-04,  1.5656e-02, -2.8595e-02,
         5.5359e-02, -3.8544e-02,  1.4214e-02, -2.8351e-02, -5.2460e-02,
         1.6327e-02, -1.6613e-03,  1.6800e-02,  4.8706e-02,  4.4312e-02,
        -3.0960e-02,  8.1024e-03,  1.2405e-02,  3.6377e-02,  2.5314e-02,
        -1.8250e-02, -2.0538e-02, -2.0447e-02, -4.3365e-02, -3.2562e-02,
        -4.7363e-02, -3.5950e-02, -5.0598e-02,  5.0812e-02,  8.6899e-03,
         8.4381e-03,  2.7206e-02, -3.5461e-02,  9.5520e-03, -1.9485e-02,
        -7.1239e-04, -1.3557e-02, -3.7048e-02,  7.5607e-03,  3.3386e-02,
         3.6163e-02, -3.1567e-03,  3.7537e-02,  7.3051e-03, -4.4250e-03,
        -6.5536e-03, -1.9241e-02, -1.9241e-02, -4.7516e-02, -3.6499e-02,
         4.2953e-03,  7.6723e-04,  4.2236e-02, -2.1877e-03, -2.3376e-02,
        -1.0254e-02,  1.2001e-02,  2.4353e-02,  6.2317e-02,  2.3331e-02,
        -8.0811e-02, -2.3849e-02, -1.4786e-02, -3.3844e-02, -1.4610e-02,
        -9.1919e-02, -1.1627e-02,  5.6000e-02,  3.7567e-02,  3.1525e-02,
        -2.6688e-02,  1.6418e-02,  2.8458e-02, -7.0992e-03, -1.4557e-02,
        -7.9193e-03, -1.0719e-02, -2.4582e-02, -2.7359e-02, -1.3382e-02,
        -1.2314e-02, -4.6448e-02,  3.0090e-02, -3.1464e-02,  2.7557e-02,
         1.4374e-02,  8.4534e-03, -4.0985e-02, -1.3802e-02,  3.7354e-02,
         1.2230e-02,  1.8677e-02,  1.6937e-02,  8.1787e-03, -8.7952e-02,
         8.6975e-02, -4.3152e-02, -3.6285e-02,  1.3382e-02, -3.0777e-02,
         4.7302e-03,  3.2684e-02, -2.0294e-02, -4.9042e-02, -1.1169e-02,
         7.0618e-02,  4.4495e-02,  5.5267e-02, -1.7548e-02, -2.5253e-02,
         2.4002e-02, -3.6377e-02, -4.3411e-03, -1.2341e-03, -2.9907e-03,
         4.3716e-03, -4.1412e-02,  3.4851e-02, -4.0497e-02, -7.4158e-02,
         1.1093e-02,  7.8552e-02, -1.8448e-02, -5.4550e-04, -6.8298e-02,
         7.8506e-03, -1.5320e-02,  4.8187e-02,  5.2155e-02, -1.8463e-02,
        -2.5406e-02, -6.1760e-03,  2.6276e-02, -6.1378e-03, -4.2152e-03,
         1.6815e-02, -5.7800e-02, -2.3407e-02, -2.3697e-02, -8.0322e-02,
         4.7058e-02, -2.8625e-02,  4.2267e-03,  4.7722e-03, -4.8950e-02,
         3.3508e-02, -1.9592e-02,  3.7872e-02,  1.3170e-03, -3.4393e-02,
        -4.7913e-02, -9.9335e-03,  1.7426e-02, -7.7332e-02, -2.6733e-02,
        -5.5389e-02, -1.0735e-02, -1.7662e-03,  4.4708e-02,  2.9037e-02,
        -2.6611e-02, -3.1555e-02,  2.7435e-02, -1.9653e-02,  1.7365e-02,
         1.7166e-02, -2.8801e-03,  2.8976e-02,  3.9154e-02,  8.1787e-02,
         6.3049e-02, -1.2482e-02,  3.8300e-02, -2.7466e-02,  6.8176e-02,
        -1.8082e-02,  2.2202e-02,  4.3121e-02,  1.2802e-02,  4.9164e-02,
        -1.5795e-04,  2.6840e-02, -4.5135e-02]], dtype=float16)

Kosha

The main class for managing the code and environment databases, updating package metadata, embedding code snippets, and performing context-aware searches.


Kosha


def Kosha(
    dir:Path=None, install_skill:bool=False, xdg_dir:Path=None, efn:function=embedder
):

Kosha allows you to build a context for code generation based on your repo and environment.

k=Kosha()
k.emb_doc('def add(a, b): return a + b')[:5]
array([[ 1.3954e-02, -2.5146e-02,  2.2491e-02, -1.3031e-02,  2.8496e-03,
         5.9265e-02, -4.7455e-02, -2.2934e-02, -9.8190e-03, -1.1307e-02,
         3.8971e-02,  7.4951e-02, -4.2915e-03, -5.3009e-02,  1.0384e-02,
        -1.9043e-02,  1.9760e-02, -1.7395e-02, -5.3375e-02, -1.3027e-03,
         1.0101e-01, -4.6722e-02,  1.8021e-02, -4.7028e-02,  6.4087e-02,
        -3.5492e-02, -6.1462e-02,  9.9106e-03,  9.7942e-04,  4.2450e-02,
        -5.3284e-02,  6.7383e-02,  4.2755e-02,  2.7069e-02,  3.4912e-02,
         1.9119e-02,  3.2288e-02, -2.0523e-02, -6.4636e-02, -2.6794e-02,
        -8.5907e-03,  6.6895e-02,  2.6825e-02,  1.1925e-02,  4.3701e-02,
         6.4621e-03, -3.2997e-03,  3.1471e-03,  7.7209e-02, -1.3374e-02,
        -1.2016e-02, -7.0496e-02, -8.1848e-02,  6.0387e-03,  3.0457e-02,
         1.9684e-02,  9.3765e-03, -2.5528e-02,  6.4697e-02, -2.3788e-02,
         8.3740e-02,  5.1270e-02,  1.9577e-02,  2.8046e-02,  2.8419e-03,
        -2.7145e-02,  1.6129e-02,  4.5441e-02, -8.0872e-03, -1.0284e-02,
         1.2344e-02, -4.9011e-02,  3.8757e-02, -1.0590e-02, -1.1086e-02,
         1.7212e-02, -8.3923e-03,  3.0853e-02,  1.3840e-02, -9.6130e-03,
         2.2827e-02, -5.7861e-02,  1.0291e-01, -8.8272e-03, -7.8064e-02,
         6.3721e-02, -5.6976e-02,  2.1088e-02, -1.4008e-02, -1.5961e-02,
        -1.2650e-02, -4.6387e-02, -2.5574e-02,  2.6932e-02, -1.0626e-01,
        -1.6693e-02,  5.1147e-02,  1.8066e-02,  3.7212e-03,  5.9998e-02,
         7.5188e-03,  3.6713e-02,  1.3138e-02, -1.7433e-03,  2.4536e-02,
        -2.0126e-02, -1.5297e-03, -2.3376e-02, -3.9368e-02, -3.2074e-02,
        -2.0798e-02,  1.0391e-02, -3.1033e-03, -4.4739e-02, -2.2324e-02,
         2.9480e-02, -4.8981e-02,  4.3640e-02,  3.0334e-02,  3.1494e-02,
        -2.7130e-02,  5.0934e-02, -4.4220e-02,  4.9377e-02,  1.0239e-02,
         4.1016e-02,  4.0833e-02, -1.4572e-02,  7.1259e-03, -2.8763e-02,
         1.4488e-02, -5.8746e-02,  7.4585e-02,  3.1342e-02,  5.2490e-03,
         2.0462e-02,  3.1464e-02,  2.4704e-02,  1.2245e-02,  7.2441e-03,
        -7.7133e-03,  1.6815e-02,  5.1613e-03,  2.1454e-02, -5.9357e-02,
        -9.9182e-03, -2.9812e-03,  8.0872e-03, -1.4519e-02,  6.7635e-03,
         4.3457e-02,  4.2175e-02,  2.0721e-02,  8.1970e-02, -2.1820e-02,
        -2.4857e-02,  3.1860e-02,  2.5513e-02,  1.5007e-02, -4.5441e-02,
         7.1838e-02,  1.2642e-02, -6.7993e-02, -1.1520e-02, -2.5589e-02,
        -6.4087e-02,  8.3466e-03, -7.9803e-03,  2.0809e-03,  2.3651e-02,
         4.1809e-02, -4.8706e-02,  2.5528e-02,  2.9694e-02,  1.2245e-02,
        -3.0823e-02, -4.6082e-02,  1.0071e-02, -9.7656e-03, -4.8492e-02,
         1.2341e-03, -1.1238e-02,  5.5969e-02,  1.8954e-04,  2.8419e-03,
        -4.7760e-02, -4.8401e-02, -7.2632e-03, -3.3386e-02, -1.8196e-03,
        -5.5580e-03,  3.8788e-02, -7.5264e-03,  1.0208e-02, -4.5288e-02,
         8.0139e-02, -1.2993e-02,  8.0444e-02, -1.0073e-04,  6.8604e-02,
         3.9917e-02, -7.9956e-02,  1.7099e-03, -2.9999e-02, -2.4918e-02,
         3.4821e-02, -1.0689e-02,  6.4468e-04,  4.4403e-03, -9.8633e-02,
         4.2542e-02,  2.6047e-02, -2.9572e-02,  1.9836e-02,  7.1533e-02,
        -4.2267e-02, -1.7014e-02, -3.7170e-02, -2.8809e-02, -5.7739e-02,
         2.5543e-02,  1.0567e-03,  4.3213e-02, -5.2490e-02,  4.1321e-02,
        -6.3248e-03, -3.4698e-02,  6.9763e-02, -5.1941e-02,  6.7688e-02,
        -2.7756e-02, -2.3560e-02,  6.1951e-02,  6.7688e-02,  4.2542e-02,
         9.5596e-03,  4.8523e-03,  4.2419e-02,  4.3060e-02, -2.3697e-02,
         3.4729e-02, -2.3285e-02, -5.5351e-03,  3.0045e-02, -2.3590e-02,
         1.2169e-02, -7.1838e-02, -3.9246e-02, -5.7602e-03,  3.7823e-03,
        -5.3925e-02, -2.9984e-02,  7.9041e-02, -1.9714e-02,  9.2468e-03,
         2.5848e-02, -6.2988e-02, -2.6611e-02, -5.9265e-02,  4.2534e-03,
         7.2571e-02,  5.4779e-02,  3.8395e-03,  7.9956e-03,  1.0902e-02,
         2.0706e-02, -1.1299e-02, -4.0192e-02,  5.9937e-02, -6.5491e-02,
        -7.1167e-02, -3.1525e-02, -1.5572e-02,  1.4458e-02, -1.3107e-02,
         1.8875e-02,  1.0681e-01, -1.2566e-02,  3.1342e-02, -5.7678e-03,
        -5.3741e-02,  2.8412e-02,  2.7466e-02,  6.4331e-02, -5.7281e-02,
         6.4697e-02, -8.0795e-03,  1.0544e-02,  2.1500e-02, -3.7842e-02,
         9.1095e-03, -1.9608e-02, -1.5480e-02,  1.3847e-02, -7.2956e-04,
         1.7502e-02,  2.7466e-02, -6.9923e-03, -5.8632e-03, -1.7563e-02,
        -4.4708e-02,  1.1223e-02, -1.5976e-02, -2.3361e-02, -2.3514e-02,
         5.2887e-02,  2.1732e-04,  3.6657e-05,  1.8402e-02,  8.3313e-02,
        -3.5828e-02,  2.6474e-02,  1.6647e-02, -2.3758e-02, -3.0537e-03,
         3.8574e-02, -3.5858e-02,  3.6240e-03,  4.6112e-02, -2.5543e-02,
        -1.3794e-02, -5.5969e-02,  1.0788e-02,  2.5654e-03, -2.4780e-02,
        -3.1921e-02, -4.8485e-03,  1.4442e-02,  3.9558e-03, -2.7725e-02,
        -4.8767e-02, -7.6752e-03, -2.2980e-02, -1.8768e-02, -1.1261e-02,
        -1.0300e-02,  4.2297e-02, -4.0314e-02, -2.9160e-02, -2.1248e-03,
         8.9355e-02,  5.9357e-02, -9.9335e-03,  2.6306e-02,  6.6414e-03,
         3.6869e-03,  6.3232e-02, -3.5828e-02, -1.4122e-02,  7.0251e-02,
        -4.5074e-02, -3.3844e-02,  2.0599e-02,  2.2415e-02, -2.3773e-02,
        -4.9622e-02, -8.5449e-04, -2.4368e-02,  7.1678e-03, -1.4542e-02,
        -2.8534e-03,  2.6230e-02, -1.8463e-02,  1.9318e-02,  9.3307e-03,
        -1.0730e-01, -1.5192e-03, -5.6122e-02,  3.1860e-02, -7.0740e-02,
         7.0457e-03,  2.8793e-02, -1.9913e-02,  2.5650e-02,  6.7062e-03,
        -8.3771e-03, -1.7502e-02,  3.1464e-02, -1.0704e-02, -2.0355e-02,
         1.9135e-02,  6.9519e-02,  2.9327e-02,  1.1322e-02, -4.0985e-02,
        -2.8259e-02, -2.9785e-02,  8.3771e-03,  4.7455e-02, -1.8768e-02,
        -8.8654e-03,  3.7041e-03,  2.7939e-02,  1.9730e-02, -4.1504e-02,
         1.8234e-02, -1.3710e-02, -2.0584e-02, -2.6379e-03, -2.7580e-03,
        -1.4717e-02, -5.6793e-02, -1.6266e-02,  1.3451e-02, -7.9880e-03,
        -4.9927e-02,  1.1406e-02, -7.5264e-03,  2.4445e-02, -6.0059e-02,
        -2.1133e-02, -7.5188e-03, -2.8744e-03,  4.7035e-03,  1.1024e-03,
         3.7994e-02,  4.7302e-02,  4.5280e-03,  3.0640e-02,  2.6398e-02,
        -1.9653e-02,  2.1362e-02,  1.1032e-02,  1.4610e-03,  1.9806e-02,
        -4.7638e-02, -3.0762e-02,  3.5522e-02,  1.8265e-02, -4.2053e-02,
         1.1971e-02,  3.3844e-02, -3.2196e-02,  1.7670e-02,  4.1718e-02,
         8.7662e-03, -1.8372e-02,  1.8951e-02,  9.3750e-02, -2.6276e-02,
         5.3650e-02, -1.3237e-02,  6.5491e-02, -6.3133e-03, -1.0048e-02,
         5.6488e-02,  3.1586e-02, -4.8065e-03, -6.1150e-03, -1.3237e-02,
         3.9482e-03,  5.3741e-02,  6.6284e-02,  1.5545e-03, -3.3321e-03,
         2.4551e-02,  3.5095e-02,  4.1809e-02, -5.0568e-02,  4.5776e-02,
        -4.1321e-02, -3.4393e-02,  5.2063e-02, -1.7624e-03,  1.2405e-02,
        -1.9287e-02,  6.5247e-02, -4.9988e-02, -1.8539e-02, -4.4556e-03,
        -2.0050e-02,  3.6896e-02,  4.4922e-02,  2.1606e-02,  1.3077e-02,
         6.4514e-02, -2.1133e-02,  6.9336e-02,  4.5586e-03,  9.8343e-03,
        -3.6835e-02,  3.1647e-02,  3.0212e-02,  5.0583e-03,  1.8829e-02,
        -3.0548e-02,  2.2079e-02,  3.3752e-02, -7.1602e-03,  3.6011e-03,
         2.8214e-02, -3.6530e-02,  4.6600e-02, -2.2110e-02, -4.6661e-02,
         2.0035e-02, -4.4708e-02,  2.7313e-02, -5.9814e-02,  2.0828e-02,
        -5.3375e-02, -2.4567e-02, -5.6091e-02, -1.3557e-02, -3.0380e-02,
         4.0649e-02, -4.0649e-02, -2.7939e-02,  2.6245e-02, -2.0218e-02,
        -4.1473e-02, -4.9072e-02, -1.9318e-02, -2.2507e-02,  1.9547e-02,
         4.9957e-02,  6.9160e-03, -5.4352e-02, -1.0056e-02,  4.4769e-02,
        -1.6052e-02,  1.2733e-02,  2.8793e-02,  4.1779e-02,  2.9343e-02,
        -2.2018e-02,  5.5786e-02, -1.6495e-02,  2.6627e-02,  1.1017e-02,
        -3.3203e-02,  8.9600e-02,  6.1554e-02,  1.2230e-02, -3.8376e-03,
        -8.3466e-03, -1.9562e-02,  2.0096e-02,  4.2084e-02, -4.9866e-02,
         2.1667e-02,  1.1742e-02, -2.9816e-02,  4.2328e-02,  6.5247e-02,
        -8.1848e-02, -6.6986e-03,  9.5654e-04,  2.1591e-02, -3.1067e-02,
        -2.4490e-02, -5.0293e-02,  7.4692e-03,  2.2202e-02, -2.4170e-02,
        -2.2125e-02, -3.6682e-02,  1.6022e-02,  4.3304e-02, -8.8577e-03,
         2.1706e-03, -2.2034e-02, -4.4006e-02, -3.1952e-02, -9.9487e-02,
        -5.5328e-02, -3.6316e-02,  6.2866e-02, -4.8462e-02, -1.2688e-02,
        -2.9850e-03, -4.4678e-02,  2.0599e-02,  4.6959e-03,  4.5288e-02,
        -1.6113e-02, -1.8478e-02, -5.3497e-02, -2.9892e-02, -4.0054e-03,
         2.6913e-03, -5.1147e-02, -6.7505e-02,  2.7237e-02, -4.5471e-02,
        -5.0323e-02, -2.6566e-02,  1.4175e-02,  6.6185e-03, -1.7273e-02,
         5.0537e-02, -3.6896e-02,  1.0078e-02, -3.7292e-02, -4.9835e-02,
         1.8738e-02, -1.0468e-02, -2.8934e-03,  4.2023e-02,  4.1687e-02,
        -1.5106e-02,  5.9843e-04,  1.7118e-03,  3.9673e-02,  2.5391e-02,
        -1.5282e-02, -2.2949e-02, -3.1174e-02, -4.8401e-02, -2.0844e-02,
        -4.9377e-02, -3.1769e-02, -4.6417e-02,  5.0842e-02,  1.8433e-02,
         1.1772e-02,  1.1894e-02, -2.2491e-02, -5.0354e-03, -2.3605e-02,
        -4.1351e-03, -1.1513e-02, -3.2379e-02,  4.9133e-03,  3.0716e-02,
         3.5004e-02, -9.5749e-03,  4.1168e-02, -8.3466e-03,  1.8997e-02,
        -3.2368e-03, -1.4526e-02, -1.5778e-02, -3.9703e-02, -3.8605e-02,
         4.5509e-03, -8.7051e-03,  4.6143e-02,  2.7161e-03, -2.4002e-02,
        -1.4969e-02,  1.7044e-02,  1.4130e-02,  5.8289e-02,  2.7573e-02,
        -9.0088e-02, -2.6871e-02, -2.3941e-02, -3.4210e-02, -1.4557e-02,
        -9.3384e-02,  1.9188e-03,  4.2908e-02,  3.7384e-02,  2.1957e-02,
        -1.4214e-02,  9.0408e-03,  3.6865e-02, -1.8723e-02, -1.6342e-02,
        -1.1978e-02, -1.7929e-02, -3.4256e-03, -3.0701e-02, -2.8534e-03,
        -2.5330e-02, -5.4321e-02,  1.9073e-02, -1.3771e-02,  7.3547e-03,
         2.1057e-02,  9.7656e-03, -4.1901e-02, -1.1665e-02,  2.8946e-02,
         1.6284e-04,  1.0513e-02,  1.5244e-02,  6.9523e-04, -7.9041e-02,
         7.5134e-02, -4.3243e-02, -3.0899e-02,  2.2964e-02, -4.5776e-02,
         1.0040e-02,  2.3198e-04, -2.0996e-02, -5.3497e-02,  7.5874e-03,
         5.3802e-02,  3.9185e-02,  6.9092e-02, -2.1576e-02, -4.1046e-02,
         1.1543e-02, -3.5034e-02, -1.3027e-03, -1.3008e-02, -8.9951e-03,
        -1.1421e-02, -4.5563e-02,  1.3954e-02, -2.5955e-02, -6.6589e-02,
         2.0737e-02,  8.4595e-02, -1.1131e-02, -1.4435e-02, -6.0059e-02,
         7.3242e-03, -6.3038e-04,  4.9255e-02,  4.1656e-02, -2.4017e-02,
        -2.5146e-02, -4.4785e-03,  2.6566e-02, -1.9531e-03,  1.0597e-02,
         2.6596e-02, -6.0364e-02, -2.1896e-02, -1.6830e-02, -6.9397e-02,
         5.3070e-02, -2.1698e-02, -7.4883e-03, -4.9019e-03, -4.5288e-02,
         3.3203e-02, -3.0991e-02,  3.3722e-02,  2.4338e-02, -3.7415e-02,
        -5.0049e-02, -3.1414e-03,  1.3512e-02, -8.1177e-02, -1.6342e-02,
        -6.2286e-02, -5.1422e-03, -2.0103e-03,  5.3192e-02,  1.6449e-02,
        -2.9648e-02, -1.5068e-02,  1.9638e-02, -7.6447e-03,  2.1172e-03,
         1.2535e-02, -5.8250e-03,  2.6794e-02,  3.5767e-02,  7.0923e-02,
         5.5328e-02, -1.8372e-02,  3.2135e-02, -1.2711e-02,  7.8979e-02,
        -2.8458e-02,  6.4926e-03,  2.6566e-02,  1.0704e-02,  4.3304e-02,
        -2.9278e-03,  4.0588e-02, -5.6366e-02]], dtype=float16)

pkg_url


def pkg_url(
    pkg:str
)->str | None:

Return best web URL for pkg from importlib.metadata: Source Code > Repository > Home-page > first Project-URL.


pkg_doc


def pkg_doc(
    pkg
)->dict:

Build pkg_store content dict: content=summary+readme, metadata=json.

pkg_doc('httpx')
{'content': 'The next generation HTTP client.\n<p align="center">\n  <a href="https://www.python-httpx.org/"><img width="350" height="208" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/butterfly.png" alt=\'HTTPX\'></a>\n</p>\n\n<p align="center"><strong>HTTPX</strong> <em>- A next-generation HTTP client for Python.</em></p>\n\n<p align="center">\n<a href="https://github.com/encode/httpx/actions">\n    <img src="https://github.com/encode/httpx/workflows/Test%20Suite/badge.svg" alt="Test Suite">\n</a>\n<a href="https://pypi.org/project/httpx/">\n    <img src="https://badge.fury.io/py/httpx.svg" alt="Package version">\n</a>\n</p>\n\nHTTPX is a fully featured HTTP client library for Python 3. It includes **an integrated command line client**, has support for both **HTTP/1.1 and HTTP/2**, and provides both **sync and async APIs**.\n\n---\n\nInstall HTTPX using pip:\n\n```shell\n$ pip install httpx\n```\n\nNow, let\'s get started:\n\n```pycon\n>>> import httpx\n>>> r = httpx.get(\'https://www.example.org/\')\n>>> r\n<Response [200 OK]>\n>>> r.status_code\n200\n>>> r.headers[\'content-type\']\n\'text/html; charset=UTF-8\'\n>>> r.text\n\'<!doctype html>\\n<html>\\n<head>\\n<title>Example Domain</title>...\'\n```\n\nOr, using the command-line client.\n\n```shell\n$ pip install \'httpx[cli]\'  # The command line client is an optional dependency.\n```\n\nWhich now allows us to use HTTPX directly from the command-line...\n\n<p align="center">\n  <img width="700" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/httpx-help.png" alt=\'httpx --help\'>\n</p>\n\nSending a request...\n\n<p align="center">\n  <img width="700" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/httpx-request.png" alt=\'httpx http://httpbin.org/json\'>\n</p>\n\n## Features\n\nHTTPX builds on the well-established usability of `requests`, and gives you:\n\n* A broadly [requests-compatible API](https://www.python-httpx.org/compatibility/).\n* An integrated command-line client.\n* HTTP/1.1 [and HTTP/2 support](https://www.python-httpx.org/http2/).\n* Standard synchronous interface,',
 'metadata': {'name': 'httpx',
  'version': '0.28.1',
  'keywords': '',
  'requires': 'brotlicffi h2 click brotli pygments idna certifi rich socksio anyio httpcore zstandard',
  'summary': 'The next generation HTTP client.',
  'url': 'https://github.com/encode/httpx'}}
u = pkg_url('httpx')
assert u and u.startswith('http'), f'expected a URL, got {u!r}'
print('pkg_url httpx:', u)
# packages without Project-URL fall back to Home-page
assert pkg_url('fastcore') is not None, 'fastcore should have a URL'
print('pkg_url fastcore:', pkg_url('fastcore'))
pkg_url httpx: https://github.com/encode/httpx
pkg_url fastcore: https://github.com/AnswerDotAI/fastcore/

imp_root


def imp_root(
    p:Path
)->Path:

Import root of p: the nearest ancestor directory without init.py.


has_init


def has_init(
    d:Path
)->bool:

True if dir is a Python package root: has init.py or a C-extension init.so.*


enrich_chunks


def enrich_chunks(
    content:L
)->L:

Set public_api+docstring flags on non-assign chunks and explode ClassDefs into method sub-chunks.


count_imp


def count_imp(
    files, own:str=''
)->Counter:

*External top-level imports from a source-string iterable. Reuses cached _parse.*


Kosha.process_env


def process_env(
    content:NoneType=None, reembed:bool=False, embed:bool=True, emb_fn:function=<lambda>
):

Embed all documents in the env store, or only those without embeddings if reembed=False.


process_content


def process_content(
    store, content:L, embed:bool=True, emb_fn:function=<lambda>
):

Embed chunks and upsert into store; no-op if content is empty.


embed_chunk


def embed_chunk(
    chunk:list | fastcore.foundation.L, emb_fn:function=<lambda>, kwargs:VAR_KEYWORD
):

Embed a list of code chunks using emb_fn, batched to bound peak memory.


Kosha.nuke


def nuke(
    
):

Reset the databases by dropping all tables.


Kosha.update_pkgs


def update_pkgs(
    pkgs:str | list=None, # packages to sync; None syncs all installed env packages
    embed:bool=True, # embed chunks after indexing
    exts:str='.py,.js,.ts,.jsx,.tsx,.java,.go,.cs,.ruby,.php,.swift,.kt,.kts,.rs,.scala,.lua', # file extensions to include
    verbose:bool=True, # print progress
    force:bool=False, # reindex even if package version already loaded
    kwargs:VAR_KEYWORD
):

Sync installed packages into the env store; if pkgs is None, syncs all env packages.


Kosha.rm_pkg


def rm_pkg(
    pkg:str, ver:str=None
):

Remove a package and its code snippets from the database.


Kosha.update_pkg


def update_pkg(
    pkg:str, embed:bool=True,
    exts:str='.py,.js,.ts,.jsx,.tsx,.java,.go,.cs,.ruby,.php,.swift,.kt,.kts,.rs,.scala,.lua', verbose:bool=True,
    force:bool=False, imports:bool=False
):

Update package metadata in the packages table.


Kosha.update_repo


def update_repo(
    dir:Path=None, # directory to index; defaults to repo root
    embed:bool=True, # embed chunks after parsing
    exts:str='.py,.js,.ts,.jsx,.tsx,.java,.go,.cs,.ruby,.php,.swift,.kt,.kts,.rs,.scala,.lua',
    verbose:bool=True, # verbose
    force:bool=False, # reindex all files regardless of mtime
    skip_file_re:str='^[.]|^(?:setup\\.py|conftest\\.py)$',
    skip_folder_re:str='^[.]|^(?:tests?|examples?|docs?|build|dist)$', func:type=Path, path:pathlib.Path | str='.',
    recursive:bool=True, maxdepth:int=None, symlinks:bool=True, file_glob:str=None, file_re:str=None,
    folder_re:str=None, skip_file_glob:str=None, ret_folders:bool=False, sort:bool=True, types:str | list=None
):

Index or update repo code chunks. Pass files= for incremental update (e.g. from watcher).


Kosha.process_repo


def process_repo(
    content:NoneType=None, reembed:bool=False, embed:bool=True, emb_fn:function=<lambda>
):

Embed all documents in the code store, or only those without embeddings if reembed=False.


Kosha.pkgs_in_env


def pkgs_in_env(
    pyproject:bool=False, depth:int=1
)->list:

Intersection of the packages table with packages installed in the environment.


Kosha.prune_old_pkgs


def prune_old_pkgs(
    
):

Keep only the latest version of each package in the database.


Kosha.prune_old_versions


def prune_old_versions(
    pkg:str
):

Keep only the latest version of a package in the database.

import kosha.core as _kc, inspect
_f = Path(inspect.getfile(_kc))
_anchor = _f.parent
while has_init(_anchor): _anchor = _anchor.parent
_mod = '.'.join(_f.relative_to(_anchor).with_suffix('').parts)
assert _mod == 'kosha.core', f'expected kosha.core, got {_mod}'
print('mod_name anchor fix: ok —', _mod)
mod_name anchor fix: ok — kosha.core
dir2files(repo_root(), strict_skip_file_re, strict_skip_folder_re, exts=code_exts)
[Path('/Users/71293/code/personal/orgs/kosha/kosha/cli.py'), Path('/Users/71293/code/personal/orgs/kosha/kosha/core.py'), Path('/Users/71293/code/personal/orgs/kosha/kosha/graph.py'), Path('/Users/71293/code/personal/orgs/kosha/kosha/skill.py')]
k = Kosha()
pkg='fastcore'
k._is_pkg_ingested(pkg)
{'name': 'fastcore', 'version': '1.12.45'}
k.env_st(select='content, embedding, json_extract(metadata, "$.mod_name","$.docstring", "$.public_api") as pa',
         where='package="httpx" and json_extract(metadata, "$.public_api")=1', limit=1)
[{'content': 'def request(\n    method: str,\n    url: URL | str,\n    *,\n    params: QueryParamTypes | None = None,\n    content: RequestContent | None = None,\n    data: RequestData | None = None,\n    files: RequestFiles | None = None,\n    json: typing.Any | None = None,\n    headers: HeaderTypes | None = None,\n    cookies: CookieTypes | None = None,\n    auth: AuthTypes | None = None,\n    proxy: ProxyTypes | None = None,\n    timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,\n    follow_redirects: bool = False,\n    verify: ssl.SSLContext | str | bool = True,\n    trust_env: bool = True,\n) -> Response:\n    """\n    Sends an HTTP request.\n\n    **Parameters:**\n\n    * **method** - HTTP method for the new `Request` object: `GET`, `OPTIONS`,\n    `HEAD`, `POST`, `PUT`, `PATCH`, or `DELETE`.\n    * **url** - URL for the new `Request` object.\n    * **params** - *(optional)* Query parameters to include in the URL, as a\n    string, dictionary, or sequence of two-tuples.\n    * **content** - *(optional)* Binary content to include in the body of the\n    request, as bytes or a byte iterator.\n    * **data** - *(optional)* Form data to include in the body of the request,\n    as a dictionary.\n    * **files** - *(optional)* A dictionary of upload files to include in the\n    body of the request.\n    * **json** - *(optional)* A JSON serializable object to include in the body\n    of the request.\n    * **headers** - *(optional)* Dictionary of HTTP headers to include in the\n    request.\n    * **cookies** - *(optional)* Dictionary of Cookie items to include in the\n    request.\n    * **auth** - *(optional)* An authentication class to use when sending the\n    request.\n    * **proxy** - *(optional)* A proxy URL where all the traffic should be routed.\n    * **timeout** - *(optional)* The timeout configuration to use when sending\n    the request.\n    * **follow_redirects** - *(optional)* Enables or disables HTTP redirects.\n    * **verify** - *(optional)* Either `True` to use an SSL context with the\n    default CA bundle, `False` to disable verification, or an instance of\n    `ssl.SSLContext` to use a custom context.\n    * **trust_env** - *(optional)* Enables or disables usage of environment\n    variables for configuration.\n\n    **Returns:** `Response`\n\n    Usage:\n\n    ```\n    >>> import httpx\n    >>> response = httpx.request(\'GET\', \'https://httpbin.org/get\')\n    >>> response\n    <Response [200 OK]>\n    ```\n    """\n    with Client(\n        cookies=cookies,\n        proxy=proxy,\n        verify=verify,\n        timeout=timeout,\n        trust_env=trust_env,\n    ) as client:\n        return client.request(\n            method=method,\n            url=url,\n            content=content,\n            data=data,\n            files=files,\n            json=json,\n            params=params,\n            headers=headers,\n            auth=auth,\n            follow_redirects=follow_redirects,\n        )',
  'embedding': b'K\xa5\xf8$P*d \xe4\x99\xbd\xacY\xa4\x12\xa8q\x1c\xc5\'\xc9\x11\x1b*\t\xa2\x9f\xa2~\xa3\x11\xa9\x18\xa4X!\x87\xa0\xfe+\xae*\x8b\x9c\xbe&\x12\x17"\x9d\xeb\x1d*\xa3\xd1\xaa;\x9b\x9f\xa00\xa8G\xa6\x9c,c#C\xa8,\'\x7f\xaa8\xab\xc3\xaa\xdb%\x1b\xa6\x7f\xa3\x07\xa8\xfc\xa8=\x97E$\xa2*\x8e$J\xa4\xe9\x94\xec\xa5z\xa1\x9a\xa4?\x1ae\x96\xa5\xa20\r\x8b"\xb1\xa8"\x1f\xd6\xa0\xba-r\x1d\t\xa7N\x9ck\xa1\xf6\xab=\xa7\x06##\x1e`\x98G\xa1F\xaa\xf8\x9a\x00\x9e\xae\x1d\x1d\xa4\xec\xa3W*\xd0\xa0^\xa5\xdc"\x08\x1e\xd7(\xc9\x95\xae#\x95\xa4f\xa3\x18*T)\x98\xa5\x8e\xa6E*\xb2\xaak\xad\xa3\xae\xf8\xa4\x0f\x1b\x06(\x97\xa4 \xa6V+\x8e\xa6T\xa9\xca\xa7\x8f\x12\xde\x1f\xad\x1d\x88*M\xa1\x9d\xa8:\'@\x92\r\xa1\xcc\x95\x84\xabR&\xa9)\x0f%k.\xd4\xa52 p\x16{#/\xacX(\xa7\'\xce\xa2T\xa7Z\x93o\'\x1d&9\'\xf1\xaa\xbc\x11\xe0\x1f\x1b\xa3|\xa49"?\xa1\xec$U(&\xa4m!X\x9bo&" \xae\'\xb5\'\xc2\xa5T(\xb9&\x08(\xaf\xa8m\xa9\x11\xa6\x99\x9d\xe2&,\xa95*\x08\xa4\xba(\x8a(W\xa6\x93\xac:\xa2\x0e\xa8J$\xee\x9e\x94\x9ci\xaa@,\x8f*_07& \xaa\xf2.+*\xda\x98S\xa5:\xac\x92\x8f\xac\xa2\x02\xa4W\x13F\xac\\$\x95\xa4\xbf\xa9\x83\xa4\xff)\x86\x9d\r&\xda\xacS\x99P\x8f(\x1f\x8b&\x19\xa0\xfd\x92\x8c&\xa9\xa5\xb4,\x02\xac\xb9\xa1~,\x19)"\x19V+\xef\x13\xb5&d\xa4\x06(g\x94p\xa0\x02 \xe3\xa57,d\xac~$h,\x14\x1a*\xa8\xb0\xab\x1e\xa3\xc7!\xb7\xa9t&=)\x03\x9cE%\xee\xa1\x98#\xfd\x9f\xc0\x1c\xfb)e)~\xa4\xd8\xa43\xaaL\xa1l$%\x9d\x9e \x8c\x9c[\xa5\xd3\xa9\xbd"\xba)!\xa5<\xa8\xa1\xacx,5*y\xa1\x9b\'\xff(\xd9 :\xae\'\xa8\xd5\n6\xa8(\x19\xf3\xa7\x92"\x91\xa7u"\xa1&6\x96\xbd(\xc7\xa1\x87\xa4\xe5\xa6U(\xe1\xa9R\xa5\x1e$$\xa8\xa4(u\xa2,\x1c\xa7&\xe0&S,5)U\x12\x04\xa2\xf4+\xc7\xa6.%c%4\x1f\xcf\x98\'\xa9\xfa\xa9\xc9\xa7\xab\x19\xc8\xaa(!x\xae\xba\xa7T(\x86+L\x93e\x18\x18.0\xa1\xfa\xa5^\xa8\xb4\']\x19~ 6\xac\x1c)V%\x92\xa5W\x9e9(\x88\xae\xd6\x9a\xf6\x96\t*\xd4)\x08$3\x1f"*\x98\xa1\'\xa06\x1cf\xa4`\xa5)\xaaz\xa4\xcd#\xaf\xae\xef\xa4g*x\x1e\\)$\xa9\xa3.\x97$\x96\x16}(\xb0\xa5I\xa3\xef*\xf0\xa7\xe4"\xb3\x11\x12,;\xa6q\x1d^\x96Z$1%A\xab$\x14c\'\xb6\'\xf6\xa6\xc2)\xe9\xa8n(\x05%\xae\xb1\xed\x18v\xa4`\xa4\xff\x18\xb9)V\x15\xd3%\xb1%\xb2&\x80!1%\x9f 6\xad\xf0\xa4\x1e(\xae*\x12\xa5"$X\'\xa6\xa6f\xa7m,J"\x04&N\x1f\xa6\xa1\xcb!\xb1\xa6w\x158\xa6Q\xa6%\xa8P\xa9R\xa4W&\xa9&\x1d\x9d6+\xf1(\xb8\xa8\x03)\x91\xa0\x03\xa1C\xab\x17\xa0V\xa9U\xaa\xa4\x9c\xc4,)\xa8t\xa4\xa3\xa8\xc2*\xac\x9e\xdf\xaa\x06\xa9 \xa8_\xad/\x18\xff\xa3\xd1\xaa\xa2 \xc8*\x1a\xa9\x04\'0(\x1d"\x1b\xa6\x1b%\xcd$\x02#\xd2\xa4\xc2 \x9e\xac\xb1)\xe0*\x80#\x01%\xb6\xa2@\xa9\x96"\x82)\xdd,\xdc\xa3u+\xbd\x1fj\xaaw\xa7P\xacq\'{ \x8a\xa8\'\xa0\xcb/\xb0\x9dl\x88\x8f\'.\x1b\xae Y\x1c\xaa%\xfa\x1e\x8a\xa9}\'\xcc\xa9\xf0\xa6B(/,\xc8\xa5&$\x1c\x1d\xbf\xa9*\xa8\x08 \x9d\x1f\x9a$\x82\x1a\x14\xa1\xd1\xa7\x88\xa03\xa5\xc6\xa0J\xa4y\'\xe4\xab~(9\xab:\xa9\xa0 \xd4\xa73!\x17(\xd1\xa7`!x\xa0W$\x16\xa9\xf4\xa8\xf2\xa4\xb8)\xea\xa7\x00(\x13\xa0\xdb\xa0\x04\xa7H\x9f\x80\xacG\xa8a\xa6\x1b\x1a\xc4\xa9\x93\xac\xfe+\x82,+\xa6\xd8!\xa1\xa7V*\x10\x8c\xb8#E\xab \'\x17\xa6\x01\xaaZ$\x1d\xa9\x1f$\xc0*\x05\xad\x1f\x1cD\xab*\xa7m*\xa3!\x84\xa0}%\xba%`(>+\x1a\xa6\n#\xcc)g\x1f\x05\xa3\x9b\xa4\xa4\xa0\xb9 \x8e,\xda(\n#\xbb\xa5\x12\xa3A&\xd5\xa8\x19)9\xa5\xc5\xa98\xa6\x86\x9aB\xa5\xa9\xad\x97\xa4\x01\xa4\xd3#\x11"\xa0\xab\xf8#\xde\xa5G\x1d>\xa3t(\x1a\xa9\x7f\xa6\xd1\xa9\xae%\xb9"\x91\x90\x0f\xa8V&7(\x18)-\xa6\x01(\xbf\x9f/&2\xa6\xb0\xa6\x94\xadK\xa6#)\x9e\xa5z\'\x17.\x80-6)^&\xb0\xa8b\x1d\xf0%[\x16\x07-\xb0$\xd6*k%\x16\xa3\xaa"\xfc\xa7\xbe\x1c\xb2$\x91%+\xa4\xd1\xa5\xd1\xa6\x9e\xa2\xb1\xa9\x99\xa5\xbe)\xe9\xa3@\xa4l\xa4\xb4\xa5+\xa7\xf3%D$9\x13\xdc\x9e\xb2&l\xa7\x81\xa8\x18\x1f\xd8\xa1!*\x95\x1c\xe6\x9e\'*\x90\xa9,\'\x19\x98\xad\x9d#\xae\x8c\xa1&\xac\xdb\xa8\xf1\xa8\xc6\xa9b%\x04#\t\x1f+\xa4\xa3)\xfb\xa7\x98*~$N\xab\x18\x9d\xef!Y\x1d\xd4\xa1X\x99<+\xc3(~\xa1\x05\xa0\xee\xa0\x02\'\xb4+\xc7%P\x1d\xa5\xa9\xb4\x96\xf4!]%\xce*N\xa7\x07\xab\x12(\xab-*\x07t\xa7\xe2$\xb2\xa2.*\'\xab:\x9a/\x19\xa3+\xfc$w\x95I\x9d\x86\xa7\n\xa9\xad\xa7k\x9f\xf4!h\xa9\x06\xa9Q\xa7\xde!\x00*\xe6\xa6!+\x15\xa4\x82\xa8\x00\xaa\x13* +\x99\x1b\xca\xa3\xda\xa9\x82&y+)\x9eC*\xd6\xaa\x18,\x9f\'\xb7+\x94\xa2\xde\xaa\xb0%\xb0\xaa\xa2\x9f\x84\x9cz\xa2\xdb*\xd7\xa6\xfc%\xe7+3(\xd8\x1c\xea\xa4\xd2)\xf7%\xdd\r\xe8\xa2="\x00\xac\xea\x13\x03"q)! \x1e\'\x00).%\xd7(\x19%L(\xb3\xac\xaf,\xaf\'\xa3\x9f;(V)D&\xc3\xa9f\xaa\xd6\x99\xce\xa6\x15\x8d\xe1\xa5\xcf$\x1d\xa1',
  'pa': '["httpx._api.request","Sends an HTTP request.\\n\\n**Parameters:**\\n\\n* **method** - HTTP method for the new `Request` object: `GET`, `OPTIONS`,\\n`HEAD`, `POST`, `PUT`, `PATCH`, or `DELETE`.\\n* **url** - URL for the new `Request` object.\\n* **params** - *(optional)* Query parameters to include in the URL, as a\\nstring, dictionary, or sequence of two-tuples.\\n* **content** - *(optional)* Binary content to include in the body of the\\nrequest, as bytes or a byte iterator.\\n* **data** - *(optional)* Form data to include in the body of the request,\\nas a dictionary.\\n* **files** - *(optional)* A dictionary of upload files to include in the\\nbody of the request.\\n* **json** - *(optional)* A JSON serializable object to include in the body\\nof the request.\\n* **headers** - *(optional)* Dictionary of HTTP headers to include in the\\nrequest.\\n* **cookies** - *(optional)* Dictionary of Cookie items to include in the\\nrequest.\\n* **auth** - *(optional)* An authentication class to use when sending the\\nrequest.\\n* **proxy** - *(optional)* A proxy URL where all the traffic should be routed.\\n* **timeout** - *(optional)* The timeout configuration to use when sending\\nthe request.\\n* **follow_redirects** - *(optional)* Enables or disables HTTP redirects.\\n* **verify** - *(optional)* Either `True` to use an SSL context with the\\ndefault CA bundle, `False` to disable verification, or an instance of\\n`ssl.SSLContext` to use a custom context.\\n* **trust_env** - *(optional)* Enables or disables usage of environment\\nvariables for configuration.\\n\\n**Returns:** `Response`\\n\\nUsage:\\n\\n```\\n>>> import httpx\\n>>> response = httpx.request(\'GET\', \'https://httpbin.org/get\')\\n>>> response\\n<Response [200 OK]>\\n```",true]'}]
k.pkgs(order_by='name', limit=1)
[{'name': 'APScheduler',
  'version': '3.11.2',
  'summary': 'In-process task scheduler with Cron-like capabilities',
  'uploaded_at': '2026-05-05 11:30:49'}]
k.update_pkg('protobuf')
updating pkg: protobuf ...
package {'name': 'protobuf', 'version': '7.34.1'} already loaded.
k.update_pkg('fastlite', force=True)
updating pkg: fastlite ...
package {'name': 'fastlite', 'version': '0.2.4'} already loaded.
forcing an update to pkg {'name': 'fastlite', 'version': '0.2.4'}
parse files from fastlite: 100%|██████████| 4/4 [00:00<00:00, 249.89it/s]
{'changed': 64, 'same': 0, 'removed': 0}
{}
k.update_repo(skip_file_glob='*.ipynb', force=True)
syncing files [Path('/Users/71293/code/personal/orgs/kosha/kosha/cli.py'), Path('/Users/71293/code/personal/orgs/kosha/kosha/core.py'), Path('/Users/71293/code/personal/orgs/kosha/kosha/graph.py'), Path('/Users/71293/code/personal/orgs/kosha/kosha/skill.py')] .....
parse files from /Users/71293/code/personal/orgs/kosha: 100%|██████████| 4/4 [00:00<00:00, 56.11it/s]
adding 119 new/updated chunks to code store...
{'changed': 119, 'same': 0, 'removed': 0}
synced repo
k.code_st(select='json_extract(metadata, "$.mod_name","$.docstring", "$.public_api") as pa',
          where='json_extract(metadata, "$.public_api")=1')
[{'pa': '["kosha.core.repo_root","Find the root of the current git repository, or None if not in a repo.",true]'},
 {'pa': '["kosha.core.static_embedder","Load or return cached static (potion-retrieval) embedder (24h TTL).",true]'},
 {'pa': '["kosha.core.emb_doc","Curry an embedder factory into a document-embedding function `t -> embedding`.",true]'},
 {'pa': '["kosha.core.emb_query","Curry an embedder factory into a query-embedding function `t -> embedding`.",true]'},
 {'pa': '["kosha.core.pkg_url","Return best web URL for pkg from importlib.metadata: Source Code > Repository > Home-page > first Project-URL.",true]'},
 {'pa': '["kosha.core.pkg_doc","Build pkg_store content dict: content=summary+readme, metadata=json.",true]'},
 {'pa': '["kosha.core.has_init","True if dir is a Python package root: has __init__.py or a C-extension __init__*.so.",true]'},
 {'pa': '["kosha.core.count_imp","External top-level imports from a source-string iterable. Reuses cached _parse.",true]'},
 {'pa': '["kosha.core.parseq","Parse key:value filter tokens from a query. Returns (bare_query, filters_dict).",true]'},
 {'pa': '["kosha.core.filt2wh","Convert a filter dict (from parse_query) to a SQL WHERE clause for the given store (code or env).",true]'},
 {'pa': '["kosha.core.arun","Run an async coroutine from sync code, even if already inside an event loop",true]'},
 {'pa': '["kosha.graph.dyn_edges","All dynamic dispatch edges: decorator, connect_body, registration, co_dispatch.",true]'},
 {'pa': '["kosha.graph.CodeGraph","Call graph builder and query engine. Uses pyan3 for static analysis and custom AST parsing for dynamic edges.\\nStores everything in a SQLite database.",true]'},
 {'pa': '["kosha.graph.CodeGraph.__init__",null,true]'},
 {'pa': '["kosha.graph.CodeGraph.nuke",null,true]'},
 {'pa': '["kosha.graph.is_sys_pkg","Return True if pkg is a system-wide package (e.g. in site-packages), False if likely user code.",true]'},
 {'pa': '["kosha.cli.public_api","List public API entries for a package (respects __all__ + @patch methods).",true]'},
 {'pa': '["kosha.cli.dep_stack","BFS dependency layers from seed packages, ordered by coupling strength.",true]'},
 {'pa': '["kosha.cli.top_nodes","Top-k public API nodes for a package ranked by PageRank in the call graph.",true]'},
 {'pa': '["kosha.cli.main","Entry point for the `kosha` CLI command.",true]'},
 {'pa': '["kosha.cli.watch","Live incremental re-index on file changes. Blocking — Ctrl-C to stop.",true]'},
 {'pa': '["kosha.cli.sync","Sync repo + env packages + call graph into .kosha/ databases.",true]'},
 {'pa': '["kosha.cli.context","Fan-out semantic search over repo and env, optionally graph-enriched.",true]'},
 {'pa': '["kosha.cli.repo_context","Semantic + keyword search over indexed repo code only.",true]'},
 {'pa': '["kosha.cli.env_context","Semantic search over indexed env packages only.",true]'},
 {'pa': '["kosha.cli.ni","Node info: callers, callees, co_dispatched, pagerank for a single graph node.",true]'},
 {'pa': '["kosha.cli.daemon","Persistent kosha kernel. Reads newline-delimited JSON from stdin, writes results to stdout.",true]'},
 {'pa': '["kosha.cli.api_paths","Shortest call-graph paths from from_pkg public API to to_pkg public API.",true]'},
 {'pa': '["kosha.cli.where_to_add","Find likely insertion points for new code matching description.",true]'},
 {'pa': '["kosha.cli.install","Install kosha SKILL.md to .agents/skills/kosha/ and .claude/skills/kosha/.",true]'},
 {'pa': '["kosha.cli.status","Show index freshness: file/pkg/node counts, stale files, and stale packages.",true]'},
 {'pa': '["kosha.core.process_content","Embed chunks and upsert into store; no-op if content is empty.",true]'},
 {'pa': '["kosha.core.Kosha","Kosha allows you to build a context for code generation based on your repo and environment.",true]'},
 {'pa': '["kosha.core.Kosha.__init__",null,true]'},
 {'pa': '["kosha.graph.static_edges","Static call edges via pyan3. Provide either filenames+root or sources dict.",true]'},
 {'pa': '["kosha.core.parse","Parse source, tag parents, return (tree, imp, top_fns, all_fns, imp2mod). Cached — called freely.",true]'},
 {'pa': '["kosha.core.mv_skill_md","Copy bundled SKILL.md to skill directories.",true]'},
 {'pa': '["kosha.core.pkg_trans_deps","BFS over importlib.metadata requires: return seeds + all transitive deps up to depth levels (installed only, no optional extras).",true]'},
 {'pa': '["kosha.core.env_pkg_versions","Get a dict of installed package versions using importlib.metadata.\\npassing depth traverse multiple layers of dependencies",true]'},
 {'pa': '["kosha.core.embedder","Load or return cached CodeRankEmbed ONNX document embedder (24h TTL). Hardware-aware: tunes parallel/batch_size to host (override via KOSHA_EMBED_PARALLEL / KOSHA_EMBED_BATCH).",true]'},
 {'pa': '["kosha.core.enrich_chunks","Set public_api+docstring flags on non-assign chunks and explode ClassDefs into method sub-chunks.",true]'},
 {'pa': '["kosha.core.embed_chunk","Embed a list of code chunks using emb_fn, batched to bound peak memory.",true]'}]
k.code_st(select='content',where='json_extract(metadata, "$.mod_name")="kosha.core.Kosha.__init__"')
[{'content': "def __init__(self, dir: Path = None, install_skill: bool = False, xdg_dir: Path = None, efn=embedder):\n\t\tself.root, self.xdg = Path(dir or repo_root() or '.'), xdg_dir or xdg_data_home()\n\t\tself.efn = bind(efn, md=self.xdg/'model')\n\t\tself.emb_doc, self.emb_query = emb_doc(self.efn), emb_query(self.efn)\n\t\tif install_skill: mv_skill_md(dir=self.root, dry_run=False)\n\t\tself.cp, self.ce = self.root.joinpath('.kosha','code.db'), self.xdg.joinpath('kosha','env.db')\n\t\tfor p in (self.cp, self.ce): p.parent.mkdir(parents=True, exist_ok=True)\n\t\tself.codedb, self.envdb = database(self.cp), database(self.ce)\n\t\tself.code_st,self.env_st = self.codedb.get_store(path=str,hash=True),self.envdb.get_store(package=str,hash=True)\n\t\tself.pkg_st, self.pkgs = self.envdb.get_store('pkg_store', hash=True), self.envdb.t.packages\n\t\tself.env_pd, self.code_rd = self.envdb.t.pkg_deps, self.codedb.t.repo_deps\n\t\tself.pkgs.create(name=str, version=str, summary=str, uploaded_at=float, pk=['name','version'],\n\t\t\t defaults=dict(uploaded_at='CURRENT_TIMESTAMP'), if_not_exists=True)\n\t\tself.env_pd.create(from_pkg=str, to_pkg=str, n_modules=int, if_not_exists=True, pk=['from_pkg','to_pkg'])\n\t\tself.code_rd.create(from_module=str, to_pkg=str, n_files=int, if_not_exists=True, pk=['from_module','to_pkg'])"}]
k.update_pkgs(set(env_pkg_versions()), embed=False, force=True)
loading pkgs {'usearch', 'chonkie', 'pyan3', 'tokenizers', 'pyskills', 'watchfiles', 'fastlite', 'pandas', 'fastcore', 'model2vec', 'pillow', 'onnxruntime', 'codesigs', 'notebook', 'yake', 'litesearch', 'pdf_oxide', 'anyio', 'Jinja2'} ...
Updating packages:   0%|          | 0/19 [00:00<?, ?pkg/s]
updating pkg: usearch ...
Updating packages:   5%|▌         | 1/19 [00:01<00:19,  1.06s/pkg]
package {'name': 'usearch', 'version': '2.25.2'} already loaded.
forcing an update to pkg {'name': 'usearch', 'version': '2.25.2'}
updated pkg: usearch with 155 new/changed chunks, -155 unchanged, -155 removed
updating pkg: chonkie ...
package {'name': 'chonkie', 'version': '1.6.5'} already loaded.
forcing an update to pkg {'name': 'chonkie', 'version': '1.6.5'}
Updating packages:  11%|█         | 2/19 [00:02<00:18,  1.09s/pkg]
updated pkg: chonkie with 818 new/changed chunks, -818 unchanged, -818 removed
updating pkg: pyan3 ...
package {'name': 'pyan3', 'version': '2.6.0'} already loaded.
forcing an update to pkg {'name': 'pyan3', 'version': '2.6.0'}
Updating packages:  21%|██        | 4/19 [00:02<00:08,  1.74pkg/s]
updated pkg: pyan3 with 240 new/changed chunks, -240 unchanged, -240 removed
updating pkg: tokenizers ...
package {'name': 'tokenizers', 'version': '0.23.1'} already loaded.
forcing an update to pkg {'name': 'tokenizers', 'version': '0.23.1'}
updated pkg: tokenizers with 86 new/changed chunks, -86 unchanged, -86 removed
updating pkg: pyskills ...
<unknown>:1: SyntaxWarning: invalid escape sequence '\s'
<unknown>:1: SyntaxWarning: invalid escape sequence '\s'
Updating packages:  26%|██▋       | 5/19 [00:03<00:06,  2.17pkg/s]
package {'name': 'pyskills', 'version': '0.0.7'} already loaded.
forcing an update to pkg {'name': 'pyskills', 'version': '0.0.7'}
updated pkg: pyskills with 52 new/changed chunks, -52 unchanged, -52 removed
updating pkg: watchfiles ...
Updating packages:  32%|███▏      | 6/19 [00:03<00:04,  2.82pkg/s]
package {'name': 'watchfiles', 'version': '1.1.1'} already loaded.
forcing an update to pkg {'name': 'watchfiles', 'version': '1.1.1'}
updated pkg: watchfiles with 43 new/changed chunks, -43 unchanged, -43 removed
updating pkg: fastlite ...
package {'name': 'fastlite', 'version': '0.2.4'} already loaded.
forcing an update to pkg {'name': 'fastlite', 'version': '0.2.4'}
Updating packages:  37%|███▋      | 7/19 [00:03<00:03,  3.45pkg/s]
updated pkg: fastlite with 64 new/changed chunks, -64 unchanged, -64 removed
updating pkg: pandas ...
package {'name': 'pandas', 'version': '3.0.2'} already loaded.
forcing an update to pkg {'name': 'pandas', 'version': '3.0.2'}
Updating packages:  42%|████▏     | 8/19 [00:25<01:18,  7.13s/pkg]
updated pkg: pandas with 7087 new/changed chunks, -7087 unchanged, -7087 removed
updating pkg: fastcore ...
package {'name': 'fastcore', 'version': '1.12.45'} already loaded.
forcing an update to pkg {'name': 'fastcore', 'version': '1.12.45'}
Updating packages:  47%|████▋     | 9/19 [00:26<00:51,  5.18s/pkg]
updated pkg: fastcore with 890 new/changed chunks, -890 unchanged, -890 removed
updating pkg: model2vec ...
package {'name': 'model2vec', 'version': '0.8.1'} already loaded.
forcing an update to pkg {'name': 'model2vec', 'version': '0.8.1'}
Updating packages:  53%|█████▎    | 10/19 [00:26<00:32,  3.66s/pkg]
updated pkg: model2vec with 112 new/changed chunks, -112 unchanged, -112 removed
updating pkg: pillow ...
package {'name': 'pillow', 'version': '12.2.0'} already loaded.
forcing an update to pkg {'name': 'pillow', 'version': '12.2.0'}
Updating packages:  58%|█████▊    | 11/19 [00:28<00:25,  3.24s/pkg]
updated pkg: pillow with 1382 new/changed chunks, -1382 unchanged, -1382 removed
updating pkg: onnxruntime ...
package {'name': 'onnxruntime', 'version': '1.25.1'} already loaded.
forcing an update to pkg {'name': 'onnxruntime', 'version': '1.25.1'}
Updating packages:  63%|██████▎   | 12/19 [00:34<00:28,  4.12s/pkg]
updated pkg: onnxruntime with 3588 new/changed chunks, -3588 unchanged, -3588 removed
updating pkg: codesigs ...
Updating packages:  68%|██████▊   | 13/19 [00:35<00:17,  2.99s/pkg]
package {'name': 'codesigs', 'version': '0.0.2'} already loaded.
forcing an update to pkg {'name': 'codesigs', 'version': '0.0.2'}
updated pkg: codesigs with 18 new/changed chunks, -18 unchanged, -18 removed
updating pkg: notebook ...
package {'name': 'notebook', 'version': '7.5.6'} already loaded.
forcing an update to pkg {'name': 'notebook', 'version': '7.5.6'}
Updating packages:  74%|███████▎  | 14/19 [00:55<00:41,  8.26s/pkg]
updated pkg: notebook with 24616 new/changed chunks, -24616 unchanged, -24616 removed
updating pkg: yake ...
Updating packages:  79%|███████▉  | 15/19 [00:56<00:23,  5.91s/pkg]
package {'name': 'yake', 'version': '0.7.3'} already loaded.
forcing an update to pkg {'name': 'yake', 'version': '0.7.3'}
updated pkg: yake with 129 new/changed chunks, -129 unchanged, -129 removed
updating pkg: litesearch ...
Updating packages:  84%|████████▍ | 16/19 [00:56<00:12,  4.19s/pkg]
package {'name': 'litesearch', 'version': '0.0.29'} already loaded.
forcing an update to pkg {'name': 'litesearch', 'version': '0.0.29'}
updated pkg: litesearch with 65 new/changed chunks, -65 unchanged, -65 removed
updating pkg: pdf_oxide ...
package {'name': 'pdf_oxide', 'version': '0.3.45'} already loaded.
forcing an update to pkg {'name': 'pdf_oxide', 'version': '0.3.45'}
Updating packages:  89%|████████▉ | 17/19 [00:56<00:05,  2.97s/pkg]
updated pkg: pdf_oxide with 22 new/changed chunks, -22 unchanged, -22 removed
updating pkg: anyio ...
package {'name': 'anyio', 'version': '4.13.0'} already loaded.
forcing an update to pkg {'name': 'anyio', 'version': '4.13.0'}
Updating packages:  95%|█████████▍| 18/19 [00:57<00:02,  2.32s/pkg]
updated pkg: anyio with 1087 new/changed chunks, -1087 unchanged, -1087 removed
updating pkg: Jinja2 ...
package {'name': 'Jinja2', 'version': '3.1.6'} already loaded.
forcing an update to pkg {'name': 'Jinja2', 'version': '3.1.6'}
Updating packages: 100%|██████████| 19/19 [00:59<00:00,  3.14s/pkg]
updated pkg: Jinja2 with 864 new/changed chunks, -864 unchanged, -864 removed
k.env_st(where='embedding is NULL', select='count(*)')
[{'count(*)': 137}]
k.process_env()
<Table store (id, content, embedding, metadata, uploaded_at, package)>
k.update_pkgs(['fastcore','litesearch','fastlite','apsw','ghapi','httpx'], embed=True)
loading pkgs ['fastcore', 'litesearch', 'fastlite', 'apsw', 'ghapi', 'httpx'] ...
Updating packages:   0%|          | 0/6 [00:00<?, ?pkg/s]
updating pkg: litesearch ...
Updating packages:  50%|█████     | 3/6 [00:00<00:00,  7.96pkg/s]
package {'name': 'litesearch', 'version': '0.0.29'} already loaded.
updating pkg: ghapi ...
package {'name': 'ghapi', 'version': '1.0.13'} already loaded.
updating pkg: httpx ...
package {'name': 'httpx', 'version': '0.28.1'} already loaded.
updating pkg: apsw ...
Updating packages: 100%|██████████| 6/6 [00:00<00:00,  8.73pkg/s]
package {'name': 'apsw', 'version': '3.53.1.0'} already loaded.
updating pkg: fastlite ...
package {'name': 'fastlite', 'version': '0.2.4'} already loaded.
updating pkg: fastcore ...
package {'name': 'fastcore', 'version': '1.12.45'} already loaded.