toolslm 0.3.25__tar.gz → 0.3.27__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.
@@ -1,40 +1,27 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolslm
3
- Version: 0.3.25
3
+ Version: 0.3.27
4
4
  Summary: Tools to make language models a bit easier to use
5
- Home-page: https://github.com/AnswerDotAI/toolslm
6
- Author: Jeremy Howard
7
- Author-email: j@fast.ai
8
- License: Apache Software License 2.0
9
- Keywords: nbdev jupyter notebook python
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
5
+ Author-email: Jeremy Howard <j@fast.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/AnswerDotAI/toolslm
8
+ Project-URL: Documentation, https://AnswerDotAI.github.io/toolslm
9
+ Keywords: nbdev,jupyter,notebook,python
12
10
  Classifier: Natural Language :: English
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
16
15
  Requires-Python: >=3.9
17
16
  Description-Content-Type: text/markdown
18
17
  License-File: LICENSE
19
- Requires-Dist: fastcore>=1.9.7
18
+ Requires-Dist: fastcore>=1.12.4
20
19
  Requires-Dist: httpx
21
20
  Requires-Dist: ghapi
22
21
  Requires-Dist: codesigs
23
22
  Provides-Extra: dev
24
23
  Requires-Dist: ipython; extra == "dev"
25
- Dynamic: author
26
- Dynamic: author-email
27
- Dynamic: classifier
28
- Dynamic: description
29
- Dynamic: description-content-type
30
- Dynamic: home-page
31
- Dynamic: keywords
32
- Dynamic: license
33
24
  Dynamic: license-file
34
- Dynamic: provides-extra
35
- Dynamic: requires-dist
36
- Dynamic: requires-python
37
- Dynamic: summary
38
25
 
39
26
  # toolslm
40
27
 
@@ -0,0 +1,41 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "toolslm"
7
+ dynamic = ["version"]
8
+ description = "Tools to make language models a bit easier to use"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {text = "Apache-2.0"}
12
+ authors = [{name = "Jeremy Howard", email = "j@fast.ai"}]
13
+ keywords = ['nbdev', 'jupyter', 'notebook', 'python']
14
+ classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 3 - Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
15
+ dependencies = ['fastcore>=1.12.4', 'httpx', 'ghapi', 'codesigs']
16
+
17
+ [project.urls]
18
+ Repository = "https://github.com/AnswerDotAI/toolslm"
19
+ Documentation = "https://AnswerDotAI.github.io/toolslm"
20
+
21
+ [project.entry-points.nbdev]
22
+ toolslm = "toolslm._modidx:d"
23
+
24
+ [project.optional-dependencies]
25
+ dev = ['ipython']
26
+
27
+
28
+ [project.scripts]
29
+ folder2ctx = "toolslm.xml:folder2ctx_cli"
30
+ repo2ctx = "toolslm.xml:repo2ctx_cli"
31
+
32
+ [tool.setuptools.dynamic]
33
+ version = {attr = "toolslm.__version__"}
34
+
35
+ [tool.setuptools.packages.find]
36
+ include = ["toolslm"]
37
+
38
+ [tool.nbdev]
39
+ nbs_path = '.'
40
+ jupyter_hooks = true
41
+ custom_sidebar = false
@@ -0,0 +1 @@
1
+ __version__ = "0.3.27"
@@ -28,10 +28,12 @@ d = { 'settings': { 'branch': 'main',
28
28
  'toolslm.funccall.call_func': ('funccall.html#call_func', 'toolslm/funccall.py'),
29
29
  'toolslm.funccall.call_func_async': ('funccall.html#call_func_async', 'toolslm/funccall.py'),
30
30
  'toolslm.funccall.get_schema': ('funccall.html#get_schema', 'toolslm/funccall.py'),
31
+ 'toolslm.funccall.get_schema_nm': ('funccall.html#get_schema_nm', 'toolslm/funccall.py'),
31
32
  'toolslm.funccall.mk_ns': ('funccall.html#mk_ns', 'toolslm/funccall.py'),
32
33
  'toolslm.funccall.mk_param': ('funccall.html#mk_param', 'toolslm/funccall.py'),
33
34
  'toolslm.funccall.mk_tool': ('funccall.html#mk_tool', 'toolslm/funccall.py'),
34
35
  'toolslm.funccall.python': ('funccall.html#python', 'toolslm/funccall.py'),
36
+ 'toolslm.funccall.resolve_nm': ('funccall.html#resolve_nm', 'toolslm/funccall.py'),
35
37
  'toolslm.funccall.schema2sig': ('funccall.html#schema2sig', 'toolslm/funccall.py')},
36
38
  'toolslm.inspecttools': { 'toolslm.inspecttools.SymbolNotFound': ( 'inspecttools.html#symbolnotfound',
37
39
  'toolslm/inspecttools.py'),
@@ -1,8 +1,8 @@
1
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../01_funccall.ipynb.
2
2
 
3
3
  # %% auto #0
4
- __all__ = ['empty', 'custom_types', 'get_schema', 'python', 'mk_ns', 'call_func', 'call_func_async', 'mk_param', 'schema2sig',
5
- 'mk_tool']
4
+ __all__ = ['empty', 'custom_types', 'get_schema', 'python', 'mk_ns', 'resolve_nm', 'get_schema_nm', 'call_func',
5
+ 'call_func_async', 'mk_param', 'schema2sig', 'mk_tool']
6
6
 
7
7
  # %% ../01_funccall.ipynb #e5ad6b86
8
8
  import inspect, json, ast
@@ -15,6 +15,7 @@ from typing import get_type_hints
15
15
  from inspect import Parameter, Signature
16
16
  from decimal import Decimal
17
17
  from uuid import UUID
18
+ from functools import reduce
18
19
 
19
20
  # %% ../01_funccall.ipynb #a9f43047
20
21
  empty = inspect.Parameter.empty
@@ -25,7 +26,7 @@ def _types(t:type)->tuple[str,Optional[str]]:
25
26
  if t is empty: raise TypeError('Missing type')
26
27
  tmap = {int:"integer", float:"number", str:"string", bool:"boolean", list:"array", dict:"object"}
27
28
  tmap.update({k.__name__: v for k, v in tmap.items()})
28
- if getattr(t, '__origin__', None) in (list,tuple):
29
+ if getattr(t, '__origin__', None) in (list,tuple,set):
29
30
  args = getattr(t, '__args__', None)
30
31
  item_type = "object" if not args else tmap.get(t.__args__[0].__name__, "object")
31
32
  return "array", item_type
@@ -58,9 +59,11 @@ custom_types = {Path, bytes, Decimal, UUID}
58
59
 
59
60
  def _handle_type(t, defs):
60
61
  "Handle a single type, creating nested schemas if necessary"
62
+ ot = ifnone(get_origin(t), t)
61
63
  if t is NoneType: return {'type': 'null'}
62
64
  if t in custom_types: return {'type':'string', 'format':t.__name__}
63
- if t in (dict, list, tuple, set): return {'type': _types(t)[0]}
65
+ if ot is dict: return {'type': _types(t)[0]}
66
+ if ot in (list, tuple, set): return {'type': _types(t)[0], 'items':{}}
64
67
  if isinstance(t, type) and not issubclass(t, (int, float, str, bool)) or inspect.isfunction(t):
65
68
  defs[t.__name__] = _get_nested_schema(t)
66
69
  return {'$ref': f'#/$defs/{t.__name__}'}
@@ -132,10 +135,13 @@ def get_schema(
132
135
  f:Union[callable,dict], # Function to get schema for
133
136
  pname='input_schema', # Key name for parameters
134
137
  evalable=False, # stringify defaults that can't be literal_eval'd?
135
- skip_hidden=False # skip parameters starting with '_'?
138
+ skip_hidden=False, # skip parameters starting with '_'?
139
+ name=None # Override function name (useful for dotted paths like 'obj.method')
136
140
  )->dict: # {'name':..., 'description':..., pname:...}
137
141
  "Generate JSON schema for a class, function, or method"
138
142
  if isinstance(f, dict): return f
143
+ if hasattr(f, '__call__') and not isinstance(f, type) and not inspect.isfunction(f) and not inspect.ismethod(f):
144
+ f = f.__call__
139
145
  schema = _get_nested_schema(f, evalable=evalable, skip_hidden=skip_hidden)
140
146
  desc = f.__doc__
141
147
  assert desc, "Docstring missing!"
@@ -147,7 +153,7 @@ def get_schema(
147
153
  type_str = f'type: {_types(ret.anno)[0]}' if has_type else None
148
154
  ret_str = f'{ret.docment} ({type_str})' if has_type and has_doc else (type_str if has_type else ret.docment)
149
155
  desc += f'\n\nReturns:\n- {ret_str}'
150
- return {"name": f.__name__, "description": desc, pname: schema}
156
+ return {"name": name or f.__name__, "description": desc, pname: schema}
151
157
 
152
158
  # %% ../01_funccall.ipynb #873000d7
153
159
  import ast, time, signal, traceback
@@ -223,11 +229,22 @@ def _coerce_inputs(func, inputs):
223
229
  else: res[k] = v
224
230
  return res
225
231
 
226
- # %% ../01_funccall.ipynb #d817ab01
232
+ # %% ../01_funccall.ipynb #925f462b
233
+ def resolve_nm(nm, ns):
234
+ st,*rest = nm.split('.')
235
+ return reduce(getattr, rest, ns[st])
236
+
237
+ # %% ../01_funccall.ipynb #6f6b5bfa
238
+ def get_schema_nm(nm:str, ns, dot2dash=False, **kwargs):
239
+ "Get schema for symbol `nm` in namespace `ns`, preserving the full dotted name"
240
+ name = nm.replace('.', '-') if dot2dash else nm
241
+ return get_schema(resolve_nm(nm, ns), name=name, **kwargs)
242
+
243
+ # %% ../01_funccall.ipynb #47b49644
227
244
  def call_func(fc_name, fc_inputs, ns, raise_on_err=True):
228
245
  "Call the function `fc_name` with the given `fc_inputs` using namespace `ns`."
229
246
  if not isinstance(ns, abc.Mapping): ns = mk_ns(ns)
230
- func = ns[fc_name]
247
+ func = resolve_nm(fc_name, ns)
231
248
  inps = {re.sub(r'\W', '', k):v for k,v in fc_inputs.items()}
232
249
  inps = _coerce_inputs(func, inps)
233
250
  try: return func(**inps)
@@ -235,7 +252,7 @@ def call_func(fc_name, fc_inputs, ns, raise_on_err=True):
235
252
  if raise_on_err: raise e from None
236
253
  else: return traceback.format_exc()
237
254
 
238
- # %% ../01_funccall.ipynb #7ac04e80-7bb9-4b52-8285-454684605d47
255
+ # %% ../01_funccall.ipynb #73bca085
239
256
  async def call_func_async(fc_name, fc_inputs, ns, raise_on_err=True):
240
257
  "Awaits the function `fc_name` with the given `fc_inputs` using namespace `ns`."
241
258
  res = call_func(fc_name, fc_inputs, ns, raise_on_err=raise_on_err)
@@ -11,6 +11,7 @@ from fastcore.utils import *
11
11
  from fastcore.meta import delegates
12
12
  import inspect, re, sys, ast, builtins, os, linecache
13
13
  from importlib import import_module
14
+
14
15
  from .xml import *
15
16
 
16
17
  # %% ../05_inspecttools.ipynb #9778fca8
@@ -23,6 +24,7 @@ def _find_frame_dict(var:str):
23
24
  raise ValueError(f"Could not find {var} in any scope")
24
25
 
25
26
  # %% ../05_inspecttools.ipynb #7fd415fa
27
+ @llmtool
26
28
  def importmodule(
27
29
  mod: str, # The module to import (e.g. 'torch.nn.functional')
28
30
  caller_symbol:str = '__msg_id' # The name of the special variable to find the correct caller namespace
@@ -79,6 +81,7 @@ def _src_from_lines(lines, start):
79
81
  return ''.join(lines[start:start + tree.body[0].end_lineno])
80
82
 
81
83
  # %% ../05_inspecttools.ipynb #41ecbd5c
84
+ @llmtool
82
85
  def symsrc(
83
86
  sym: str # Dotted symbol path (e.g `Interval` or `sympy.sets.sets.Interval`) or "_last" for previous result
84
87
  ):
@@ -109,6 +112,7 @@ def symsrc(
109
112
  raise OSError(f"Source for {name} not found")
110
113
 
111
114
  # %% ../05_inspecttools.ipynb #bbf67405
115
+ @llmtool
112
116
  def symtype(
113
117
  syms: str # Comma separated str list of dotted symbol paths (e.g `'Interval,a'` or `'sympy.sets.sets.Interval'`); "_last" for prev result
114
118
  ):
@@ -125,6 +129,7 @@ def symtype(
125
129
  return [f(o) for o in re.split(r'\,\s*', syms)]
126
130
 
127
131
  # %% ../05_inspecttools.ipynb #dd4279b8
132
+ @llmtool
128
133
  def symval(
129
134
  syms: str # Comma separated str list of dotted symbol paths (e.g `Interval` or `sympy.sets.sets.Interval`); "_last" for prev result
130
135
  ):
@@ -156,6 +161,7 @@ def symtype_val(
156
161
  return [f(o) for o in re.split(r'\,\s*', syms)]
157
162
 
158
163
  # %% ../05_inspecttools.ipynb #1cd34596
164
+ @llmtool
159
165
  def symdir(
160
166
  sym: str, # Dotted symbol path (e.g `Interval` or `sympy.sets.sets.Interval`) or "_last" for previous result
161
167
  exclude_private: bool=False # Filter out attrs starting with "_"
@@ -166,6 +172,7 @@ def symdir(
166
172
  return [o for o in res if o[0]!='_']
167
173
 
168
174
  # %% ../05_inspecttools.ipynb #9542de0b
175
+ @llmtool
169
176
  def symnth(
170
177
  sym: str, # Dotted symbol path to a dict or object with .values()
171
178
  n: int # Index into the values (0-based)
@@ -181,6 +188,7 @@ def symnth(
181
188
  return _last
182
189
 
183
190
  # %% ../05_inspecttools.ipynb #4ac6ca2d
191
+ @llmtool
184
192
  def symlen(
185
193
  sym: str # Dotted symbol path or "_last" for previous result
186
194
  ):
@@ -188,6 +196,7 @@ def symlen(
188
196
  return len(resolve(sym))
189
197
 
190
198
  # %% ../05_inspecttools.ipynb #a5dfbe8f
199
+ @llmtool
191
200
  def symslice(
192
201
  sym: str, # Dotted symbol path or "_last" for previous result
193
202
  start: int, # Starting index for slice
@@ -198,6 +207,7 @@ def symslice(
198
207
  except Exception as e: return f'Error: {e}'
199
208
 
200
209
  # %% ../05_inspecttools.ipynb #5fca4d70
210
+ @llmtool
201
211
  def symsearch(
202
212
  sym:str, # Dotted symbol path or "_last" for previous result
203
213
  term:str, # Search term (exact string or regex pattern)
@@ -210,6 +220,7 @@ def symsearch(
210
220
  else: return str([(x, i) for i, x in enumerate(resolve(sym)) if x == term])
211
221
 
212
222
  # %% ../05_inspecttools.ipynb #02c09e1a
223
+ @llmtool
213
224
  def symset(
214
225
  val: str # Value to assign to _ai_sym
215
226
  ):
@@ -217,6 +228,7 @@ def symset(
217
228
  _find_frame_dict('__msg_id')['_ai_sym'] = val
218
229
 
219
230
  # %% ../05_inspecttools.ipynb #72e5f0a8
231
+ @llmtool
220
232
  @delegates(sym2folderctx)
221
233
  def symfiles_folder(
222
234
  sym:str, # Dotted symbol path or "_last" for previous result
@@ -228,6 +240,7 @@ def symfiles_folder(
228
240
  return sym2folderctx(s, **kwargs)
229
241
 
230
242
  # %% ../05_inspecttools.ipynb #fdd0990e
243
+ @llmtool
231
244
  @delegates(sym2pkgctx)
232
245
  def symfiles_package(
233
246
  sym:str, # Dotted symbol path or "_last" for previous result
@@ -193,9 +193,10 @@ def sym2file(sym):
193
193
  @delegates(folder2ctx)
194
194
  def sym2folderctx(
195
195
  sym,
196
- types:str|list='py', # list or comma-separated str of ext types from: py, js, java, c, cpp, rb, r, ex, sh, web, doc, cfg
197
- skip_file_re=r'^_mod',
198
- **kwargs):
196
+ types:str|list='py', # List or comma-separated str of ext types from: py, js, java, c, cpp, rb, r, ex, sh, web, doc, cfg
197
+ skip_file_re:str=r'^_mod', # Skip files matching regex
198
+ **kwargs
199
+ ):
199
200
  "Return folder context for a symbol's source file location"
200
201
  return folder2ctx(Path(inspect.getfile(sym)).parent, types=types, skip_file_re=skip_file_re, **kwargs)
201
202
 
@@ -208,7 +209,13 @@ def sym2pkgpath(sym):
208
209
 
209
210
  # %% ../00_xml.ipynb #798ca61f
210
211
  @delegates(folder2ctx)
211
- def sym2pkgctx(sym, types:str|list='py', skip_file_re=r'^_mod', skip_folder_re=r'^(\.|__)', **kwargs):
212
+ def sym2pkgctx(
213
+ sym,
214
+ types:str|list='py', # List or comma-separated str of ext types from: py, js, java, c, cpp, rb, r, ex, sh, web, doc, cfg
215
+ skip_file_re:str=r'^_mod', # Skip files matching regex
216
+ skip_folder_re:str=r'^(\.|__)', # Skip folders matching regex
217
+ **kwargs
218
+ ):
212
219
  "Return contents of files in a symbol's root package"
213
220
  return folder2ctx(sym2pkgpath(sym), types=types, skip_file_re=skip_file_re, skip_folder_re=skip_folder_re, **kwargs)
214
221
 
@@ -1,40 +1,27 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toolslm
3
- Version: 0.3.25
3
+ Version: 0.3.27
4
4
  Summary: Tools to make language models a bit easier to use
5
- Home-page: https://github.com/AnswerDotAI/toolslm
6
- Author: Jeremy Howard
7
- Author-email: j@fast.ai
8
- License: Apache Software License 2.0
9
- Keywords: nbdev jupyter notebook python
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
5
+ Author-email: Jeremy Howard <j@fast.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/AnswerDotAI/toolslm
8
+ Project-URL: Documentation, https://AnswerDotAI.github.io/toolslm
9
+ Keywords: nbdev,jupyter,notebook,python
12
10
  Classifier: Natural Language :: English
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
16
15
  Requires-Python: >=3.9
17
16
  Description-Content-Type: text/markdown
18
17
  License-File: LICENSE
19
- Requires-Dist: fastcore>=1.9.7
18
+ Requires-Dist: fastcore>=1.12.4
20
19
  Requires-Dist: httpx
21
20
  Requires-Dist: ghapi
22
21
  Requires-Dist: codesigs
23
22
  Provides-Extra: dev
24
23
  Requires-Dist: ipython; extra == "dev"
25
- Dynamic: author
26
- Dynamic: author-email
27
- Dynamic: classifier
28
- Dynamic: description
29
- Dynamic: description-content-type
30
- Dynamic: home-page
31
- Dynamic: keywords
32
- Dynamic: license
33
24
  Dynamic: license-file
34
- Dynamic: provides-extra
35
- Dynamic: requires-dist
36
- Dynamic: requires-python
37
- Dynamic: summary
38
25
 
39
26
  # toolslm
40
27
 
@@ -2,8 +2,6 @@ LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
4
  pyproject.toml
5
- settings.ini
6
- setup.py
7
5
  toolslm/__init__.py
8
6
  toolslm/_modidx.py
9
7
  toolslm/download.py
@@ -16,6 +14,5 @@ toolslm.egg-info/PKG-INFO
16
14
  toolslm.egg-info/SOURCES.txt
17
15
  toolslm.egg-info/dependency_links.txt
18
16
  toolslm.egg-info/entry_points.txt
19
- toolslm.egg-info/not-zip-safe
20
17
  toolslm.egg-info/requires.txt
21
18
  toolslm.egg-info/top_level.txt
@@ -1,4 +1,4 @@
1
- fastcore>=1.9.7
1
+ fastcore>=1.12.4
2
2
  httpx
3
3
  ghapi
4
4
  codesigs
@@ -1,11 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=64.0"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name="toolslm"
7
- requires-python=">=3.9"
8
- dynamic = [ "keywords", "description", "version", "dependencies", "optional-dependencies", "readme", "license", "authors", "classifiers", "entry-points", "scripts", "urls"]
9
-
10
- [tool.uv]
11
- cache-keys = [{ file = "pyproject.toml" }, { file = "settings.ini" }, { file = "setup.py" }]
@@ -1,42 +0,0 @@
1
- [DEFAULT]
2
- repo = toolslm
3
- lib_name = toolslm
4
- version = 0.3.25
5
- min_python = 3.9
6
- license = apache2
7
- black_formatting = False
8
- requirements = fastcore>=1.9.7 httpx ghapi codesigs
9
- dev_requirements = ipython
10
- doc_path = _docs
11
- lib_path = toolslm
12
- nbs_path = .
13
- recursive = True
14
- tst_flags = notest
15
- put_version_in_init = True
16
- branch = main
17
- custom_sidebar = False
18
- doc_host = https://AnswerDotAI.github.io
19
- doc_baseurl = /toolslm
20
- git_url = https://github.com/AnswerDotAI/toolslm
21
- title = toolslm
22
- audience = Developers
23
- author = Jeremy Howard
24
- author_email = j@fast.ai
25
- copyright = 2024 onwards, Jeremy Howard
26
- description = Tools to make language models a bit easier to use
27
- keywords = nbdev jupyter notebook python
28
- language = English
29
- status = 3
30
- user = AnswerDotAI
31
- readme_nb = index.ipynb
32
- allowed_metadata_keys =
33
- allowed_cell_metadata_keys =
34
- jupyter_hooks = True
35
- clear_all = False
36
- conda_user = fastai
37
- console_scripts = folder2ctx=toolslm.xml:folder2ctx_cli
38
- repo2ctx=toolslm.xml:repo2ctx_cli
39
- cell_number = False
40
- skip_procs =
41
- update_pyproject = True
42
-
toolslm-0.3.25/setup.py DELETED
@@ -1,57 +0,0 @@
1
- from pkg_resources import parse_version
2
- from configparser import ConfigParser
3
- import setuptools, shlex
4
- assert parse_version(setuptools.__version__)>=parse_version('36.2')
5
-
6
- # note: all settings are in settings.ini; edit there, not here
7
- config = ConfigParser(delimiters=['='])
8
- config.read('settings.ini', encoding='utf-8')
9
- cfg = config['DEFAULT']
10
-
11
- cfg_keys = 'version description keywords author author_email'.split()
12
- expected = cfg_keys + "lib_name user branch license status min_python audience language".split()
13
- for o in expected: assert o in cfg, "missing expected setting: {}".format(o)
14
- setup_cfg = {o:cfg[o] for o in cfg_keys}
15
-
16
- licenses = {
17
- 'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'),
18
- 'mit': ('MIT License', 'OSI Approved :: MIT License'),
19
- 'gpl2': ('GNU General Public License v2', 'OSI Approved :: GNU General Public License v2 (GPLv2)'),
20
- 'gpl3': ('GNU General Public License v3', 'OSI Approved :: GNU General Public License v3 (GPLv3)'),
21
- 'bsd3': ('BSD License', 'OSI Approved :: BSD License'),
22
- }
23
- statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha',
24
- '4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ]
25
- py_versions = '3.6 3.7 3.8 3.9 3.10'.split()
26
-
27
- requirements = shlex.split(cfg.get('requirements', ''))
28
- if cfg.get('pip_requirements'): requirements += shlex.split(cfg.get('pip_requirements', ''))
29
- min_python = cfg['min_python']
30
- lic = licenses.get(cfg['license'].lower(), (cfg['license'], None))
31
- dev_requirements = (cfg.get('dev_requirements') or '').split()
32
-
33
- setuptools.setup(
34
- name = cfg['lib_name'],
35
- license = lic[0],
36
- classifiers = [
37
- 'Development Status :: ' + statuses[int(cfg['status'])],
38
- 'Intended Audience :: ' + cfg['audience'].title(),
39
- 'Natural Language :: ' + cfg['language'].title(),
40
- ] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []),
41
- url = cfg['git_url'],
42
- packages = setuptools.find_packages(),
43
- include_package_data = True,
44
- install_requires = requirements,
45
- extras_require={ 'dev': dev_requirements },
46
- dependency_links = cfg.get('dep_links','').split(),
47
- python_requires = '>=' + cfg['min_python'],
48
- long_description = open('README.md', encoding='utf-8').read(),
49
- long_description_content_type = 'text/markdown',
50
- zip_safe = False,
51
- entry_points = {
52
- 'console_scripts': cfg.get('console_scripts','').split(),
53
- 'nbdev': [f'{cfg.get("lib_path")}={cfg.get("lib_path")}._modidx:d']
54
- },
55
- **setup_cfg)
56
-
57
-
@@ -1 +0,0 @@
1
- __version__ = "0.3.25"
@@ -1 +0,0 @@
1
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes