Skip to main content

codesigs

About codesigs

codesigs extracts function and method signatures from source code across over a dozen programming languages. It uses ast-grep for most languages and Python’s built-in ast module for Python files, providing accurate syntax-aware parsing rather than brittle regex matching.

This is useful for:

  • Documentation generation - quickly summarize the public API of a codebase
  • Code search and navigation - find functions by signature pattern
  • LLM context preparation - provide compact API summaries to language models without including full implementations
  • Codebase analysis - understand the structure of unfamiliar projects

Installation

Install latest from pypi

$ pip install codesigs

How to use

Pass source code to a language-specific function to get a list of signatures:

sigs = py_sigs("""
def greet(name, age=10):
    "Say hello to someone"
    return f"Hello {name}, you are {age}"

class Calculator:
    def add(self, a, b):
        return a + b
""")
for o in sigs: print(o)
def greet(name, age=10):
    "Say hello to someone" ...
class Calculator: ...
    def add(self, a, b): ...

Use ext_sigs when you have source code and know the file extension:

ext_sigs("function greet(name) { return `Hello ${name}`; }", ".js")
['function greet(name) {...}']

Or use file_sigs to read and extract signatures from a file in one step:

file_sigs('../codesigs/core.py')[:3]
['def get_docstring(node, lines):\n    "Get docstring from source lines if present" ...',
 'def _node_sig(node, lines): ...',
 'def py_sigs(src):\n    "Extract class/function/method signatures from Python source" ...']

The package supports Python, JavaScript/TypeScript, Java, Rust, C#, CSS, Go, Ruby, PHP, Kotlin, Swift, and Lua. Each language has a dedicated function (e.g. js_sigs, rust_sigs), or use ext_sigs/file_sigs which auto-detect from the extension.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codesigs-0.0.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codesigs-0.0.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file codesigs-0.0.3.tar.gz.

File metadata

  • Download URL: codesigs-0.0.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for codesigs-0.0.3.tar.gz
Algorithm Hash digest
SHA256 6786f9652ffdd6ea481697fb7baecd5b44ed6d5bf52fda529b76e5c8ee79d8d4
MD5 bc28361f3c52110f0481553742ba040c
BLAKE2b-256 92de7a3c6b900594944dbc89b7cce1c6d58a5fac56971171405f4749f757025d

See more details on using hashes here.

File details

Details for the file codesigs-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: codesigs-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for codesigs-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83591fc5e317609ed42b776e52fcd8fc3fdf8ffca5e6e92c5225358ac0ee62b8
MD5 fdef6bef3ade4cad686cdf08c1222ad1
BLAKE2b-256 93812d1049c2dea9ba328dac97346e7a32a326fdb2fdf2b5d95db46688d6784a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page