Extract function and method signatures from source code across multiple languages.
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
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:
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.