diff --git a/README.md b/README.md index 782758a..feb1c8e 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,20 @@ To get started with `gpt-repository-loader`, follow these steps: 5. The tool will generate an output.txt file containing the text representation of the repository. You can now use this file as input for AI language models or other text-based processing tasks. +### Optional: Install via pipx + +You can also install and run the tool via pipx: + +```bash +pipx install git+https://github.com/mpoon/gpt-repository-loader.git +``` + +Once installed, run it with: + +```bash +gpt-repository-loader /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt] +``` + ## Running Tests To run the tests for `gpt-repository-loader`, follow these steps: diff --git a/gpt_repository_loader/__init__.py b/gpt_repository_loader/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gpt_repository_loader.py b/gpt_repository_loader/gpt_repository_loader.py similarity index 94% rename from gpt_repository_loader.py rename to gpt_repository_loader/gpt_repository_loader.py index 57279f5..0d71871 100755 --- a/gpt_repository_loader.py +++ b/gpt_repository_loader/gpt_repository_loader.py @@ -32,9 +32,9 @@ def process_repository(repo_path, ignore_list, output_file): output_file.write(f"{relative_file_path}\n") output_file.write(f"{contents}\n") -if __name__ == "__main__": +def main(): if len(sys.argv) < 2: - print("Usage: python git_to_text.py /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt]") + print("Usage: python gpt_repository_loader.py /path/to/git/repository [-p /path/to/preamble.txt] [-o /path/to/output_file.txt]") sys.exit(1) repo_path = sys.argv[1] @@ -71,4 +71,6 @@ def process_repository(repo_path, ignore_list, output_file): with open(output_file_path, 'a') as output_file: output_file.write("--END--") print(f"Repository contents written to {output_file_path}.") - \ No newline at end of file + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..17c3b0d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[project] +name = "gpt-repository-loader" +version = "0.1.0" +description = "Tool to convert a Git repository into a plain-text format readable by AI models" +dependencies = [] +requires-python = ">=3.7" + +[project.scripts] +gpt-repository-loader = "gpt_repository_loader.gpt_repository_loader:main" + +[tool.setuptools] +packages = ["gpt_repository_loader"] + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" diff --git a/test_gpt_repository_loader.py b/test_gpt_repository_loader.py index 5c7ce0c..b085268 100644 --- a/test_gpt_repository_loader.py +++ b/test_gpt_repository_loader.py @@ -2,7 +2,7 @@ import os import tempfile import shutil -from gpt_repository_loader import process_repository, get_ignore_list +from gpt_repository_loader.gpt_repository_loader import process_repository, get_ignore_list class TestGPTRepositoryLoader(unittest.TestCase):