Quickstart
git clone https://github.com/cased/kit.gitcd kituv venv .venvsource .venv/bin/activateuv pip install -e .
Now, you can use kit!
kit ships with a demonstration repository at tests/fixtures/
you can use to get started.
Try this simple Python script (e.g., save as test_kit.py
in the kit
directory you cloned):
import kitimport os
# Path to the demo repositoryrepo_path = "tests/fixtures/realistic_repo"
print(f"Loading repository at: {repo_path}")# Ensure you have cloned the 'kit' repository and are in its root directory# for this relative path to work correctly.repo = kit.Repository(repo_path)
# Print the first 5 Python files found in the demo repoprint("\nFound Python files in the demo repo (first 5):")count = 0for file in repo.files('*.py'): print(f"- {file.path}") count += 1 if count >= 5: break
if count == 0: print("No Python files found in the demo repository.")
# Extract symbols from a specific file in the demo repo (e.g., app.py)target_file = 'app.py'print(f"\nExtracting symbols from {target_file} in the demo repo (first 5):")try: symbols = repo.extract_symbols(target_file) if symbols: for i, symbol in enumerate(symbols): print(f"- {symbol.name} ({symbol.kind}) at line {symbol.range.start.line}") if i >= 4: break else: print(f"No symbols found or file not parseable: {target_file}")except FileNotFoundError: print(f"File not found: {target_file}")except Exception as e: print(f"An error occurred extracting symbols: {e}")
Run it with python test_kit.py
.
Next, explore the Usage Guide to understand the core concepts.