toolslm 0.3.19__tar.gz → 0.3.22__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {toolslm-0.3.19/toolslm.egg-info → toolslm-0.3.22}/PKG-INFO +1 -1
- {toolslm-0.3.19 → toolslm-0.3.22}/settings.ini +2 -1
- toolslm-0.3.22/toolslm/__init__.py +1 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm/_modidx.py +1 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm/funccall.py +6 -1
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm/xml.py +20 -6
- {toolslm-0.3.19 → toolslm-0.3.22/toolslm.egg-info}/PKG-INFO +1 -1
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm.egg-info/entry_points.txt +1 -0
- toolslm-0.3.19/toolslm/__init__.py +0 -1
- {toolslm-0.3.19 → toolslm-0.3.22}/LICENSE +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/MANIFEST.in +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/README.md +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/pyproject.toml +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/setup.cfg +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/setup.py +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm/download.py +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm/md_hier.py +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm/shell.py +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm.egg-info/SOURCES.txt +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm.egg-info/dependency_links.txt +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm.egg-info/not-zip-safe +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm.egg-info/requires.txt +0 -0
- {toolslm-0.3.19 → toolslm-0.3.22}/toolslm.egg-info/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[DEFAULT]
|
|
2
2
|
repo = toolslm
|
|
3
3
|
lib_name = toolslm
|
|
4
|
-
version = 0.3.
|
|
4
|
+
version = 0.3.22
|
|
5
5
|
min_python = 3.9
|
|
6
6
|
license = apache2
|
|
7
7
|
black_formatting = False
|
|
@@ -35,6 +35,7 @@ clean_ids = True
|
|
|
35
35
|
clear_all = False
|
|
36
36
|
conda_user = fastai
|
|
37
37
|
console_scripts = folder2ctx=toolslm.xml:folder2ctx_cli
|
|
38
|
+
repo2ctx=toolslm.xml:repo2ctx_cli
|
|
38
39
|
cell_number = False
|
|
39
40
|
skip_procs =
|
|
40
41
|
update_pyproject = True
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.22"
|
|
@@ -55,6 +55,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
55
55
|
'toolslm.xml.py2sigs': ('xml.html#py2sigs', 'toolslm/xml.py'),
|
|
56
56
|
'toolslm.xml.read_file': ('xml.html#read_file', 'toolslm/xml.py'),
|
|
57
57
|
'toolslm.xml.repo2ctx': ('xml.html#repo2ctx', 'toolslm/xml.py'),
|
|
58
|
+
'toolslm.xml.repo2ctx_cli': ('xml.html#repo2ctx_cli', 'toolslm/xml.py'),
|
|
58
59
|
'toolslm.xml.sym2file': ('xml.html#sym2file', 'toolslm/xml.py'),
|
|
59
60
|
'toolslm.xml.sym2folderctx': ('xml.html#sym2folderctx', 'toolslm/xml.py'),
|
|
60
61
|
'toolslm.xml.sym2pkgctx': ('xml.html#sym2pkgctx', 'toolslm/xml.py'),
|
|
@@ -141,7 +141,12 @@ def get_schema(
|
|
|
141
141
|
assert desc, "Docstring missing!"
|
|
142
142
|
d = docments(f, full=True)
|
|
143
143
|
ret = d.pop('return')
|
|
144
|
-
|
|
144
|
+
has_type = (ret.anno is not empty) and (ret.anno is not None)
|
|
145
|
+
has_doc = ret.docment
|
|
146
|
+
if has_type or has_doc:
|
|
147
|
+
type_str = f'type: {_types(ret.anno)[0]}'
|
|
148
|
+
ret_str = f'{ret.docment} ({type_str})' if has_type and has_doc else (type_str if has_type else ret.docment)
|
|
149
|
+
desc += f'\n\nReturns:\n- {ret_str}'
|
|
145
150
|
return {"name": f.__name__, "description": desc, pname: schema}
|
|
146
151
|
|
|
147
152
|
# %% ../01_funccall.ipynb
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# %% auto 0
|
|
4
4
|
__all__ = ['doctype', 'json_to_xml', 'get_mime_text', 'cell2out', 'cell2xml', 'cells2xml', 'nb2xml', 'get_docstring', 'py2sigs',
|
|
5
5
|
'mk_doctype', 'mk_doc', 'docs_xml', 'read_file', 'files2ctx', 'folder2ctx', 'sym2file', 'sym2folderctx',
|
|
6
|
-
'sym2pkgpath', 'sym2pkgctx', 'folder2ctx_cli', 'parse_gh_url', 'repo2ctx']
|
|
6
|
+
'sym2pkgpath', 'sym2pkgctx', 'folder2ctx_cli', 'parse_gh_url', 'repo2ctx', 'repo2ctx_cli']
|
|
7
7
|
|
|
8
8
|
# %% ../00_xml.ipynb
|
|
9
9
|
import hashlib, inspect, xml.etree.ElementTree as ET, ast
|
|
@@ -175,9 +175,9 @@ def files2ctx(
|
|
|
175
175
|
return docs_xml(contents, srcs or fnames, **kwargs)
|
|
176
176
|
|
|
177
177
|
# %% ../00_xml.ipynb
|
|
178
|
-
@delegates(globtastic)
|
|
178
|
+
@delegates(globtastic, but='func')
|
|
179
179
|
def folder2ctx(
|
|
180
|
-
|
|
180
|
+
path:Union[str,Path], # Folder to read
|
|
181
181
|
prefix:bool=False, # Include Anthropic's suggested prose intro?
|
|
182
182
|
out:bool=True, # Include notebook cell outputs?
|
|
183
183
|
include_base:bool=True, # Include full path in src?
|
|
@@ -191,7 +191,7 @@ def folder2ctx(
|
|
|
191
191
|
**kwargs
|
|
192
192
|
)->Union[str,dict]:
|
|
193
193
|
"Convert folder contents to XML context, handling notebooks"
|
|
194
|
-
folder = Path(
|
|
194
|
+
folder = Path(path).expanduser()
|
|
195
195
|
fnames = pglob(folder, **kwargs)
|
|
196
196
|
if files_only: return {str(f.relative_to(folder)): f.stat().st_size for f in fnames}
|
|
197
197
|
if readme_first: fnames = sorted(fnames, key=lambda f: (0 if 'readme' in f.name.lower() else 1, f))
|
|
@@ -233,12 +233,12 @@ def sym2pkgctx(sym, types:str|list='py', skip_file_re=r'^_mod', **kwargs):
|
|
|
233
233
|
@call_parse
|
|
234
234
|
@delegates(folder2ctx)
|
|
235
235
|
def folder2ctx_cli(
|
|
236
|
-
|
|
236
|
+
path:str='.', # Folder name containing files to add to context
|
|
237
237
|
out:bool=True, # Include notebook cell outputs?
|
|
238
238
|
**kwargs # Passed to `folder2ctx`
|
|
239
239
|
)->str: # XML for Claude context
|
|
240
240
|
"CLI to convert folder contents to XML context, handling notebooks"
|
|
241
|
-
print(folder2ctx(
|
|
241
|
+
print(folder2ctx(path, out=out, **kwargs))
|
|
242
242
|
|
|
243
243
|
# %% ../00_xml.ipynb
|
|
244
244
|
def parse_gh_url(url):
|
|
@@ -280,3 +280,17 @@ def repo2ctx(
|
|
|
280
280
|
subdir = Path(tmp) / tf.getmembers()[0].name.split('/')[0]
|
|
281
281
|
if folder: subdir = subdir/folder
|
|
282
282
|
return folder2ctx(subdir, include_base=False, title=title, readme_first=True, **kwargs)
|
|
283
|
+
|
|
284
|
+
# %% ../00_xml.ipynb
|
|
285
|
+
@call_parse
|
|
286
|
+
@delegates(repo2ctx, but='include_base,title,readme_first')
|
|
287
|
+
def repo2ctx_cli(
|
|
288
|
+
owner:str, # GitHub repo owner or "owner/repo" or a full github URL
|
|
289
|
+
repo:str=None, # GitHub repo name (leave empty if using "owner/repo" or URL format)
|
|
290
|
+
ref:str=None, # Git ref (branch/tag/sha)
|
|
291
|
+
folder:str=None, # Only include files under this path
|
|
292
|
+
out:bool=True, # Include notebook cell outputs?
|
|
293
|
+
**kwargs # Passed to `repo2ctx`
|
|
294
|
+
)->str: # XML for Claude context
|
|
295
|
+
"CLI to convert GitHub repo contents to XML context"
|
|
296
|
+
print(repo2ctx(owner, repo, ref=ref, folder=folder, out=out, **kwargs))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.19"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|