codesigs 0.0.1__tar.gz → 0.0.2__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,39 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codesigs
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Extract function and method signatures from source code across multiple languages.
5
- Home-page: https://github.com/AnswerDotAI/codesigs
6
- Author: Jeremy Howard
7
- Author-email: github@jhoward.fastmail.fm
5
+ Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
8
6
  License: Apache-2.0
9
- Keywords: nbdev jupyter notebook python
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
7
+ Project-URL: Repository, https://github.com/AnswerDotAI/codesigs
8
+ Project-URL: Documentation, https://AnswerDotAI.github.io/codesigs
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: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
18
15
  Requires-Python: >=3.9
19
16
  Description-Content-Type: text/markdown
20
17
  License-File: LICENSE
21
18
  Requires-Dist: fastcore
22
19
  Requires-Dist: ast-grep-py
23
- Provides-Extra: dev
24
- Dynamic: author
25
- Dynamic: author-email
26
- Dynamic: classifier
27
- Dynamic: description
28
- Dynamic: description-content-type
29
- Dynamic: home-page
30
- Dynamic: keywords
31
- Dynamic: license
32
20
  Dynamic: license-file
33
- Dynamic: provides-extra
34
- Dynamic: requires-dist
35
- Dynamic: requires-python
36
- Dynamic: summary
37
21
 
38
22
  # codesigs
39
23
 
@@ -0,0 +1,2 @@
1
+ __version__ = "0.0.2"
2
+ from .core import *
@@ -13,6 +13,7 @@ d = { 'settings': { 'branch': 'main',
13
13
  'codesigs.core.file_sigs': ('core.html#file_sigs', 'codesigs/core.py'),
14
14
  'codesigs.core.get_docstring': ('core.html#get_docstring', 'codesigs/core.py'),
15
15
  'codesigs.core.go_sigs': ('core.html#go_sigs', 'codesigs/core.py'),
16
+ 'codesigs.core.ipy_parse': ('core.html#ipy_parse', 'codesigs/core.py'),
16
17
  'codesigs.core.java_sigs': ('core.html#java_sigs', 'codesigs/core.py'),
17
18
  'codesigs.core.js_sigs': ('core.html#js_sigs', 'codesigs/core.py'),
18
19
  'codesigs.core.kotlin_sigs': ('core.html#kotlin_sigs', 'codesigs/core.py'),
@@ -1,8 +1,8 @@
1
1
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
2
2
 
3
3
  # %% auto #0
4
- __all__ = ['get_docstring', 'py_sigs', 'js_sigs', 'java_sigs', 'rust_sigs', 'csharp_sigs', 'css_selectors', 'go_sigs',
5
- 'kotlin_sigs', 'swift_sigs', 'lua_sigs', 'php_sigs', 'ruby_sigs', 'ext_sigs', 'file_sigs']
4
+ __all__ = ['ipy_parse', 'get_docstring', 'py_sigs', 'js_sigs', 'java_sigs', 'rust_sigs', 'csharp_sigs', 'css_selectors',
5
+ 'go_sigs', 'kotlin_sigs', 'swift_sigs', 'lua_sigs', 'php_sigs', 'ruby_sigs', 'ext_sigs', 'file_sigs']
6
6
 
7
7
  # %% ../nbs/00_core.ipynb #033c76fd
8
8
  from fastcore.utils import *
@@ -11,6 +11,18 @@ from ast_grep_py import SgRoot
11
11
 
12
12
  import ast
13
13
 
14
+ # %% ../nbs/00_core.ipynb #21cda966
15
+ def ipy_parse(src):
16
+ "Parse Python source, ignoring IPython syntax like magics and `?`"
17
+ lines = src.splitlines()
18
+ while True:
19
+ try: return ast.parse('\n'.join(lines))
20
+ except SyntaxError as e:
21
+ if not e.lineno: raise
22
+ ln = lines[e.lineno-1].strip()
23
+ if ln.endswith('?') or ln.startswith(('%', '!', '?')): lines[e.lineno-1] = ''
24
+ else: raise
25
+
14
26
  # %% ../nbs/00_core.ipynb #8b98c134
15
27
  def get_docstring(node, lines):
16
28
  "Get docstring from source lines if present"
@@ -24,9 +36,10 @@ def _node_sig(node, lines):
24
36
  doc = get_docstring(node, lines)
25
37
  return (f"{sig}\n{doc}" if doc else sig).strip('\r\n') + ' ...'
26
38
 
39
+ # %% ../nbs/00_core.ipynb #49ac869b
27
40
  def py_sigs(src):
28
41
  "Extract class/function/method signatures from Python source"
29
- tree,lines = ast.parse(src),src.splitlines()
42
+ tree,lines = ipy_parse(src),src.splitlines()
30
43
  def _collect(nodes):
31
44
  sigs = []
32
45
  for n in nodes:
@@ -36,7 +49,7 @@ def py_sigs(src):
36
49
  return sigs
37
50
  return _collect(tree.body)
38
51
 
39
- # %% ../nbs/00_core.ipynb #5c60cc8c
52
+ # %% ../nbs/00_core.ipynb #2d5570ba
40
53
  def _get_sigs(src, lang, kinds, name_kind, params_kind, fmt):
41
54
  root = SgRoot(src, lang).root()
42
55
  sigs = []
@@ -144,4 +157,6 @@ def ext_sigs(src, ext):
144
157
  def file_sigs(fname):
145
158
  "Read file content and retrieve signatures"
146
159
  fname = Path(fname).expanduser()
147
- return ext_sigs(fname.read_text(), fname.suffix)
160
+ try: s = fname.read_text()
161
+ except UnicodeDecodeError: return []
162
+ return ext_sigs(s, fname.suffix)
@@ -1,39 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codesigs
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Extract function and method signatures from source code across multiple languages.
5
- Home-page: https://github.com/AnswerDotAI/codesigs
6
- Author: Jeremy Howard
7
- Author-email: github@jhoward.fastmail.fm
5
+ Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
8
6
  License: Apache-2.0
9
- Keywords: nbdev jupyter notebook python
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
7
+ Project-URL: Repository, https://github.com/AnswerDotAI/codesigs
8
+ Project-URL: Documentation, https://AnswerDotAI.github.io/codesigs
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: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
18
15
  Requires-Python: >=3.9
19
16
  Description-Content-Type: text/markdown
20
17
  License-File: LICENSE
21
18
  Requires-Dist: fastcore
22
19
  Requires-Dist: ast-grep-py
23
- Provides-Extra: dev
24
- Dynamic: author
25
- Dynamic: author-email
26
- Dynamic: classifier
27
- Dynamic: description
28
- Dynamic: description-content-type
29
- Dynamic: home-page
30
- Dynamic: keywords
31
- Dynamic: license
32
20
  Dynamic: license-file
33
- Dynamic: provides-extra
34
- Dynamic: requires-dist
35
- Dynamic: requires-python
36
- Dynamic: summary
37
21
 
38
22
  # codesigs
39
23
 
@@ -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
  codesigs/__init__.py
8
6
  codesigs/_modidx.py
9
7
  codesigs/core.py
@@ -11,6 +9,5 @@ codesigs.egg-info/PKG-INFO
11
9
  codesigs.egg-info/SOURCES.txt
12
10
  codesigs.egg-info/dependency_links.txt
13
11
  codesigs.egg-info/entry_points.txt
14
- codesigs.egg-info/not-zip-safe
15
12
  codesigs.egg-info/requires.txt
16
13
  codesigs.egg-info/top_level.txt
@@ -1,4 +1,2 @@
1
1
  fastcore
2
2
  ast-grep-py
3
-
4
- [dev]
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "codesigs"
7
+ dynamic = ["version"]
8
+ description = "Extract function and method signatures from source code across multiple languages."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = {text = "Apache-2.0"}
12
+ authors = [{name = "Jeremy Howard", email = "github@jhoward.fastmail.fm"}]
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', 'ast-grep-py']
16
+
17
+ [project.urls]
18
+ Repository = "https://github.com/AnswerDotAI/codesigs"
19
+ Documentation = "https://AnswerDotAI.github.io/codesigs"
20
+
21
+ [project.entry-points.nbdev]
22
+ codesigs = "codesigs._modidx:d"
23
+
24
+ [tool.setuptools.dynamic]
25
+ version = {attr = "codesigs.__version__"}
26
+
27
+ [tool.setuptools.packages.find]
28
+ include = ["codesigs"]
29
+
30
+ [tool.nbdev]
31
+ custom_sidebar = false
@@ -1,2 +0,0 @@
1
- __version__ = "0.0.1"
2
- from .core import *
@@ -1 +0,0 @@
1
-
@@ -1,11 +0,0 @@
1
- [build-system]
2
- requires = ["setuptools>=64.0"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name="codesigs"
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,46 +0,0 @@
1
- [DEFAULT]
2
- # All sections below are required unless otherwise specified.
3
- # See https://github.com/AnswerDotAI/nbdev/blob/main/settings.ini for examples.
4
-
5
- ### Python library ###
6
- repo = codesigs
7
- lib_name = %(repo)s
8
- version = 0.0.1
9
- min_python = 3.9
10
- license = apache2
11
- black_formatting = False
12
- requirements = fastcore ast-grep-py
13
-
14
- ### nbdev ###
15
- doc_path = _docs
16
- lib_path = codesigs
17
- nbs_path = nbs
18
- recursive = True
19
- tst_flags = notest
20
- put_version_in_init = True
21
- update_pyproject = True
22
-
23
- ### Docs ###
24
- branch = main
25
- custom_sidebar = False
26
- doc_host = https://%(user)s.github.io
27
- doc_baseurl = /%(repo)s
28
- git_url = https://github.com/%(user)s/%(repo)s
29
- title = %(lib_name)s
30
-
31
- ### PyPI ###
32
- audience = Developers
33
- author = Jeremy Howard
34
- author_email = github@jhoward.fastmail.fm
35
- copyright = 2026 onwards, %(author)s
36
- description = Extract function and method signatures from source code across multiple languages.
37
- keywords = nbdev jupyter notebook python
38
- language = English
39
- status = 3
40
- user = AnswerDotAI
41
-
42
- ### Optional ###
43
- # dev_requirements =
44
- # console_scripts =
45
- # conda_user =
46
- # package_data =
codesigs-0.0.1/setup.py DELETED
@@ -1,63 +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-2.0',
18
- 'mit': 'MIT',
19
- 'gpl2': 'GPL-2.0-only',
20
- 'gpl3': 'GPL-3.0-or-later',
21
- 'bsd3': 'BSD-3-Clause',
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 3.11 3.12 3.13'.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
- dev_requirements = (cfg.get('dev_requirements') or '').split()
31
-
32
- package_data = dict()
33
- pkg_data = cfg.get('package_data', None)
34
- if pkg_data:
35
- package_data[cfg['lib_name']] = pkg_data.split() # split as multiple files might be listed
36
- # Add package data to setup_cfg for setuptools.setup(..., **setup_cfg)
37
- setup_cfg['package_data'] = package_data
38
-
39
- setuptools.setup(
40
- name = cfg['lib_name'],
41
- license = licenses.get(cfg['license'].lower(), cfg['license']),
42
- classifiers = [
43
- 'Development Status :: ' + statuses[int(cfg['status'])],
44
- 'Intended Audience :: ' + cfg['audience'].title(),
45
- 'Natural Language :: ' + cfg['language'].title(),
46
- ] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]],
47
- url = cfg['git_url'],
48
- packages = setuptools.find_packages(),
49
- include_package_data = True,
50
- install_requires = requirements,
51
- extras_require={ 'dev': dev_requirements },
52
- dependency_links = cfg.get('dep_links','').split(),
53
- python_requires = '>=' + cfg['min_python'],
54
- long_description = open('README.md', encoding='utf-8').read(),
55
- long_description_content_type = 'text/markdown',
56
- zip_safe = False,
57
- entry_points = {
58
- 'console_scripts': cfg.get('console_scripts','').split(),
59
- 'nbdev': [f'{cfg.get("lib_path")}={cfg.get("lib_path")}._modidx:d']
60
- },
61
- **setup_cfg)
62
-
63
-
File without changes
File without changes
File without changes
File without changes