Repomix

raw JSON →
0.5.0 verified Mon Apr 27 auth: no python

A tool for analyzing and summarizing code repositories into a single text file for LLM context. Supports multiple output formats and file exclusion rules. Current version: 0.5.0, released on PyPI with monthly releases.

pip install repomix
error AttributeError: module 'repomix' has no attribute 'Repomix'
cause Outdated import pattern; used to be `import repomix` then `repomix.Repomix` but now the class is not directly accessible from module.
fix
Use from repomix import Repomix instead.
error TypeError: Repomix.__init__() got an unexpected keyword argument 'path'
cause The constructor parameter was renamed from `path` to `repo_path` in version 0.4.0.
fix
Use repo_path instead of path.
breaking Version 0.5.0 renamed the method `analyze()` to `run()`. Old code using `repomix.analyze()` will break.
fix Use `run()` instead of `analyze()`.
breaking The `output_format` parameter was removed in 0.5.0; use format-specific methods or the `format` argument in `run()`.
fix Pass `format='json'` to `run()` instead of setting `output_format`.
gotcha Repomix requires Python >=3.10. Installing on older Python versions will fail with a syntax error.
fix Use Python 3.10 or higher.
gotcha When specifying `exclude_patterns`, use Unix glob patterns, not regex. Common mistake is using regex-like patterns.
fix Use `['*.pyc', 'node_modules/*']` instead of `['.*\.pyc', 'node_modules/.*']`.

Basic usage to analyze a local repository and save the summary.

from repomix import Repomix

# Initialize with a repository path
repomix = Repomix(path='/path/to/repo')

# Run analysis (default format is text)
result = repomix.run()

# Access summary
print(result.summary)

# Output to file
result.to_file('output.txt')