Skip to main content

A library for LLM-based agents to navigate large codebases efficiently.

Project description

Locify 🔎

PyPI - Python Versions PyPI - Package Version GitHub - License Docs - GitHub.io

Locify is a library designed to help LLM-based agents navigate and analyze large codebases efficiently. It leverages parsing techniques to provide insights into code structure and relationships.

Features

On a Git-based repository, Locify offers:

  • Codebase Skeleton Mapping:

    • FullMapStrategy: Generates a skeleton map of the entire codebase or a directory only.
    • RepoMapStrategy: Focuses on the reference relationships, using graph theory to rank and analyze code elements.
  • Tree-sitter Integration: Utilizes Tree-sitter for precise parsing of source code, supporting multiple programming languages.

  • Command-Line Interface: Provides a user-friendly CLI for executing different mapping strategies.

Installation

Locify can be installed via pip:

pip install locify

Usage

Command-Line Interface

Locify offers a CLI to execute mapping strategies:

python -m locify.cli <strategy> get_map_with_token_count [options]
  • <strategy>: Choose between fullmap and repomap.
  • [options]: Additional options for customizing the mapping process, e.g. file's depth, or specific directories only.

Example

  • To generate a full map of a codebase:

    python -m locify.cli fullmap get_map_with_token_count --root /path/to/gitrepo
    
  • To generate a full map of the locify directory only, with maximum depth of 3:

    python -m locify.cli fullmap get_map_with_token_count 3 locify
    

Development

Directory Structure

  • locify/: Main source code directory.
    • cli.py: Command-line interface implementation.
    • indexing/: Contains strategies for code mapping.
      • full_map/: Implementation of FullMapStrategy.
      • repo_map/: Implementation of RepoMapStrategy.
    • tree_sitter/: Tree-sitter integration for parsing.
      • parser.py: Tree-sitter parser implementation.
      • queries/: Schema query files for different languages.
    • utils/: Utility functions and classes.

Testing

Tests are located in the tests directory. Run tests using:

poetry run pytest

Acknowledgements

This project was inspired by the aider's RepoMap implementation.

License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.

Project details


Download files

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

Source Distribution

locify-0.0.6.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

locify-0.0.6-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file locify-0.0.6.tar.gz.

File metadata

  • Download URL: locify-0.0.6.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.4 Linux/6.5.0-1025-azure

File hashes

Hashes for locify-0.0.6.tar.gz
Algorithm Hash digest
SHA256 0b794f8799252bc65e4f781adc0cf19d5cfa337a7348c9e3f834b360507bc097
MD5 a87e21dd0dfe2b7d47546d09b86a7818
BLAKE2b-256 8e22d0ce376504885b6ef77512f31f13b5cbfe3dc1bf62f0adf1b809b70e154b

See more details on using hashes here.

File details

Details for the file locify-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: locify-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.4 Linux/6.5.0-1025-azure

File hashes

Hashes for locify-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3d49cc8dbdb187c3f8006b0f6ab0ff9b83d990c0515e35dc463bbc41900e03a4
MD5 6aad5e2c2af5788614f9f4f06952ab1a
BLAKE2b-256 ecd08171cce1b2bd49bc159f9e8f33ebef895bfcf9df9db0bccee159c940e331

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page