finnslib


Namefinnslib JSON
Version 0.1.2 PyPI version JSON
download
home_pageNone
Summarysmall tools to print repo trees and make code summaries
upload_time2025-08-20 01:46:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2025 Finn Clancy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords tree gitignore summary llm code
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # finnslib

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)

helper functions for working with codebases. main features: summarize files, functions, and repository trees using the openai api.

## table of contents

- [installation](#installation)
- [api key setup](#api-key-setup)
- [usage](#usage)
  - [summarize a single file](#summarize-a-single-file)
  - [summarize a function](#summarize-a-function)
  - [write a plain repo tree](#write-a-plain-repo-tree)
  - [summarize a repo tree](#summarize-a-repo-tree)
- [cli usage](#cli-usage)
- [parameters](#parameters)
- [development](#development)
- [troubleshooting](#troubleshooting)
- [license](#license)

## installation

```bash
pip install finnslib
```

## api key setup

the summarization functions use openai models. you need an api key.

**option 1: environment variable**
```bash
export OPENAI_API_KEY="sk-..."
```

**option 2: pass explicitly**
all summarise functions accept an `apikey` parameter. if not provided, the library will try `OPENAI_API_KEY` from the environment.

## usage

### summarize a single file

```python
from finnslib.summarise import summarise_file

out = summarise_file(
    path="main.py",
    apikey="your-key-here",   # optional if OPENAI_API_KEY is set
    level="short"             # "short" or "long"
)
print("summary saved at:", out)
```

**output example:**
```
summary saved at: output/main.py.summary.txt
```

### summarize a function

```python
from finnslib.summarise import summarise_function

out = summarise_function(
    file_path="finnslib/repo/tree.py",
    func_name="write_repo_tree",
    apikey="your-key-here"
)
print(open(out).read())
```

**output example:**
```
function saved at: output/finnslib/repo/tree.py.write_repo_tree.summary.txt
```

### write a plain repo tree

```python
from finnslib.repo import write_repo_tree

out = write_repo_tree(".", "repo_tree.txt")
print("tree saved at:", out)
```

**output example:**
```
tree saved at: repo_tree.txt
```

### summarize a repo tree

```python
from finnslib.summarise import summarise_repo_tree

out = summarise_repo_tree(
    root_dir=".",
    output_file="tree_with_summaries.txt",
    apikey="your-key-here",
    level="short",
    folder_depth=2
)
print("repo summary saved at:", out)
```

**output example:**
```
repo summary saved at: tree_with_summaries.txt
```

## cli usage

after install you also get command line tools:

```bash
# write repo tree
finn_tree .

# summarize repo tree
finn_tree_sum .

# summarize file
finn_file_sum main.py

# summarize function
finn_func_sum finnslib/repo/tree.py write_repo_tree
```

## parameters

- **apikey**: optional. if not passed, will use `OPENAI_API_KEY` environment variable
- **level**: summary detail ("short" or "long")
- **folder_depth**: depth of subfolders when summarizing repo trees

## development

to set up the development environment:

```bash
# clone the repo
git clone <your-repo-url>
cd finnslib

# install in development mode
pip install -e .

# run tests
pytest
```

## troubleshooting

**common issues:**

1. **api key not found**: make sure you've set `OPENAI_API_KEY` or passed the `apikey` parameter
2. **file not found**: check that the file path exists and is accessible
3. **function not found**: verify the function name exists in the specified file

**getting help:**
- check the output directory for generated files
- ensure your openai api key has sufficient credits
- verify file permissions if writing to output directories

## license

MIT License © 2025 Finn Clancy

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "finnslib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "tree, gitignore, summary, llm, code",
    "author": null,
    "author_email": "Finn Clancy <finnnclancy2000@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/57/90/a74964d4e1cb1c791f8a1aede47e889e7cc0ede023c010f824b7de12a4de/finnslib-0.1.2.tar.gz",
    "platform": null,
    "description": "# finnslib\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n\nhelper functions for working with codebases. main features: summarize files, functions, and repository trees using the openai api.\n\n## table of contents\n\n- [installation](#installation)\n- [api key setup](#api-key-setup)\n- [usage](#usage)\n  - [summarize a single file](#summarize-a-single-file)\n  - [summarize a function](#summarize-a-function)\n  - [write a plain repo tree](#write-a-plain-repo-tree)\n  - [summarize a repo tree](#summarize-a-repo-tree)\n- [cli usage](#cli-usage)\n- [parameters](#parameters)\n- [development](#development)\n- [troubleshooting](#troubleshooting)\n- [license](#license)\n\n## installation\n\n```bash\npip install finnslib\n```\n\n## api key setup\n\nthe summarization functions use openai models. you need an api key.\n\n**option 1: environment variable**\n```bash\nexport OPENAI_API_KEY=\"sk-...\"\n```\n\n**option 2: pass explicitly**\nall summarise functions accept an `apikey` parameter. if not provided, the library will try `OPENAI_API_KEY` from the environment.\n\n## usage\n\n### summarize a single file\n\n```python\nfrom finnslib.summarise import summarise_file\n\nout = summarise_file(\n    path=\"main.py\",\n    apikey=\"your-key-here\",   # optional if OPENAI_API_KEY is set\n    level=\"short\"             # \"short\" or \"long\"\n)\nprint(\"summary saved at:\", out)\n```\n\n**output example:**\n```\nsummary saved at: output/main.py.summary.txt\n```\n\n### summarize a function\n\n```python\nfrom finnslib.summarise import summarise_function\n\nout = summarise_function(\n    file_path=\"finnslib/repo/tree.py\",\n    func_name=\"write_repo_tree\",\n    apikey=\"your-key-here\"\n)\nprint(open(out).read())\n```\n\n**output example:**\n```\nfunction saved at: output/finnslib/repo/tree.py.write_repo_tree.summary.txt\n```\n\n### write a plain repo tree\n\n```python\nfrom finnslib.repo import write_repo_tree\n\nout = write_repo_tree(\".\", \"repo_tree.txt\")\nprint(\"tree saved at:\", out)\n```\n\n**output example:**\n```\ntree saved at: repo_tree.txt\n```\n\n### summarize a repo tree\n\n```python\nfrom finnslib.summarise import summarise_repo_tree\n\nout = summarise_repo_tree(\n    root_dir=\".\",\n    output_file=\"tree_with_summaries.txt\",\n    apikey=\"your-key-here\",\n    level=\"short\",\n    folder_depth=2\n)\nprint(\"repo summary saved at:\", out)\n```\n\n**output example:**\n```\nrepo summary saved at: tree_with_summaries.txt\n```\n\n## cli usage\n\nafter install you also get command line tools:\n\n```bash\n# write repo tree\nfinn_tree .\n\n# summarize repo tree\nfinn_tree_sum .\n\n# summarize file\nfinn_file_sum main.py\n\n# summarize function\nfinn_func_sum finnslib/repo/tree.py write_repo_tree\n```\n\n## parameters\n\n- **apikey**: optional. if not passed, will use `OPENAI_API_KEY` environment variable\n- **level**: summary detail (\"short\" or \"long\")\n- **folder_depth**: depth of subfolders when summarizing repo trees\n\n## development\n\nto set up the development environment:\n\n```bash\n# clone the repo\ngit clone <your-repo-url>\ncd finnslib\n\n# install in development mode\npip install -e .\n\n# run tests\npytest\n```\n\n## troubleshooting\n\n**common issues:**\n\n1. **api key not found**: make sure you've set `OPENAI_API_KEY` or passed the `apikey` parameter\n2. **file not found**: check that the file path exists and is accessible\n3. **function not found**: verify the function name exists in the specified file\n\n**getting help:**\n- check the output directory for generated files\n- ensure your openai api key has sufficient credits\n- verify file permissions if writing to output directories\n\n## license\n\nMIT License \u00a9 2025 Finn Clancy\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Finn Clancy\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "small tools to print repo trees and make code summaries",
    "version": "0.1.2",
    "project_urls": null,
    "split_keywords": [
        "tree",
        " gitignore",
        " summary",
        " llm",
        " code"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f922d55085eb5306c6349f618d7ee679ffcb65c9771311a1585492ca2314b1a8",
                "md5": "6078f7eceb91fb39662d2bace91fd8e9",
                "sha256": "e032182254357b5fad35179e484fa49fc6b4fe54cc7a425c3498bf1f0c523480"
            },
            "downloads": -1,
            "filename": "finnslib-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6078f7eceb91fb39662d2bace91fd8e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 12305,
            "upload_time": "2025-08-20T01:46:12",
            "upload_time_iso_8601": "2025-08-20T01:46:12.112010Z",
            "url": "https://files.pythonhosted.org/packages/f9/22/d55085eb5306c6349f618d7ee679ffcb65c9771311a1585492ca2314b1a8/finnslib-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5790a74964d4e1cb1c791f8a1aede47e889e7cc0ede023c010f824b7de12a4de",
                "md5": "79b8008dc47f174ace55246414be2cdf",
                "sha256": "0a85dadee9d5af6341f16a3888697be66ac5503a29e033304d229f4fbc8111ac"
            },
            "downloads": -1,
            "filename": "finnslib-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "79b8008dc47f174ace55246414be2cdf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11601,
            "upload_time": "2025-08-20T01:46:13",
            "upload_time_iso_8601": "2025-08-20T01:46:13.355975Z",
            "url": "https://files.pythonhosted.org/packages/57/90/a74964d4e1cb1c791f8a1aede47e889e7cc0ede023c010f824b7de12a4de/finnslib-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-20 01:46:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "finnslib"
}
        
Elapsed time: 1.71365s