codesigs-0.0.2


توضیحات

Extract function and method signatures from source code across multiple languages.
ویژگی مقدار
سیستم عامل -
نام فایل codesigs-0.0.2
نام codesigs
نسخه کتابخانه 0.0.2
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده Jeremy Howard <github@jhoward.fastmail.fm>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/codesigs/
مجوز Apache-2.0
# codesigs <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! --> ## About `codesigs` `codesigs` extracts function and method signatures from source code across over a dozen programming languages. It uses [ast-grep](https://ast-grep.github.io/) 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](https://pypi.org/project/codesigs/) ``` sh $ pip install codesigs ``` ## How to use Pass source code to a language-specific function to get a list of signatures: ``` python 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`](https://AnswerDotAI.github.io/codesigs/core.html#ext_sigs) when you have source code and know the file extension: ``` python ext_sigs("function greet(name) { return `Hello ${name}`; }", ".js") ``` ['function greet(name) {...}'] Or use [`file_sigs`](https://AnswerDotAI.github.io/codesigs/core.html#file_sigs) to read and extract signatures from a file in one step: ``` python 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`](https://AnswerDotAI.github.io/codesigs/core.html#js_sigs), [`rust_sigs`](https://AnswerDotAI.github.io/codesigs/core.html#rust_sigs)), or use [`ext_sigs`](https://AnswerDotAI.github.io/codesigs/core.html#ext_sigs)/[`file_sigs`](https://AnswerDotAI.github.io/codesigs/core.html#file_sigs) which auto-detect from the extension.


نیازمندی

مقدار نام
- fastcore
- ast-grep-py


زبان مورد نیاز

مقدار نام
>=3.9 Python


نحوه نصب


نصب پکیج whl codesigs-0.0.2:

    pip install codesigs-0.0.2.whl


نصب پکیج tar.gz codesigs-0.0.2:

    pip install codesigs-0.0.2.tar.gz