diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/gh_explainer.rst b/docs/gh_explainer.rst new file mode 100644 index 0000000..bf174ec --- /dev/null +++ b/docs/gh_explainer.rst @@ -0,0 +1,21 @@ +gh\_explainer package +===================== + +Submodules +---------- + +gh\_explainer.summarize module +------------------------------ + +.. automodule:: gh_explainer.summarize + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: gh_explainer + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 0000000..644c4f0 --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,7 @@ +project_explainer +================= + +.. toctree:: + :maxdepth: 4 + + gh_explainer diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..72700ae --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,31 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import os +import sys +sys.path.insert(0, os.path.abspath('/Users/ethanhunt/Desktop/Project-Explainer')) + +project = 'PROJECT-EXPLAINER' +copyright = '2024, C2SI' +author = 'C2SI' +release = '27 Aug, 2023' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [] + +templates_path = ['_templates'] +exclude_patterns = [] + +language = 'Python, Jupyter Notebook' + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/docs/source/gh_explainer.rst b/docs/source/gh_explainer.rst new file mode 100644 index 0000000..bf174ec --- /dev/null +++ b/docs/source/gh_explainer.rst @@ -0,0 +1,21 @@ +gh\_explainer package +===================== + +Submodules +---------- + +gh\_explainer.summarize module +------------------------------ + +.. automodule:: gh_explainer.summarize + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: gh_explainer + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..4f75d7d --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,20 @@ +.. PROJECT-EXPLAINER documentation master file, created by + sphinx-quickstart on Fri Mar 8 17:31:18 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to PROJECT-EXPLAINER's documentation! +============================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 0000000..644c4f0 --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,7 @@ +project_explainer +================= + +.. toctree:: + :maxdepth: 4 + + gh_explainer diff --git a/make.bat b/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/project_explainer/examples/Project-Explainer b/project_explainer/examples/Project-Explainer new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/project_explainer/examples/Project-Explainer @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/project_explainer/github_parser.py b/project_explainer/github_parser.py new file mode 100644 index 0000000..cfaf9ef --- /dev/null +++ b/project_explainer/github_parser.py @@ -0,0 +1,39 @@ +from github import Github +import os + +# Initialize a Github instance with an access token +g = Github(os.getenv('GITHUB_TOKEN')) + +def get_repo_info(repo_name): + repo = g.get_repo(repo_name) + + # Fetching repository metadata + stars = repo.stargazers_count + forks = repo.forks_count + contributors = repo.get_contributors().totalCount + + print(f"Stars: {stars}, Forks: {forks}, Contributors: {contributors}") + +def parse_issues(repo_name): + repo = g.get_repo(repo_name) + issues = repo.get_issues(state='open') + + print("\nOpen Issues:") + for issue in issues: + print(f"- {issue.title}: {issue.html_url}") + +def parse_pull_requests(repo_name): + repo = g.get_repo(repo_name) + pull_requests = repo.get_pulls(state='open', sort='created') + + print("\nOpen Pull Requests:") + for pr in pull_requests: + print(f"- {pr.title}: {pr.html_url}") + +if __name__ == "__main__": + repo_name = "c2siorg/Project-Explainer" + + print(f"Fetching information for {repo_name}") + get_repo_info(repo_name) + parse_issues(repo_name) + parse_pull_requests(repo_name) diff --git a/project_explainer/requirements.txt b/project_explainer/requirements.txt new file mode 100644 index 0000000..4ff1921 --- /dev/null +++ b/project_explainer/requirements.txt @@ -0,0 +1,3 @@ +gradio +-e git+https://github.com/c2siorg/Project-Explainer.git@main#subdirectory=project_explainer&egg=gh_explainer&egg=gh_explainer +-e git+https://github.com/c2siorg/Project-Explainer.git@main#subdirectory=project_processor&egg=gh_processor \ No newline at end of file diff --git a/project_explainer/src/gh-explainer b/project_explainer/src/gh-explainer new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/project_explainer/src/gh-explainer @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/project_explainer/src/gh-processor b/project_explainer/src/gh-processor new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/project_explainer/src/gh-processor @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/project_explainer_ui/core-js b/project_explainer_ui/core-js new file mode 160000 index 0000000..c3fc79f --- /dev/null +++ b/project_explainer_ui/core-js @@ -0,0 +1 @@ +Subproject commit c3fc79fe3499cdae9282a1e35bc771965bb0d60f diff --git a/project_explainer_ui/readthedocs.yml b/project_explainer_ui/readthedocs.yml new file mode 100644 index 0000000..d834fd5 --- /dev/null +++ b/project_explainer_ui/readthedocs.yml @@ -0,0 +1,7 @@ +version: 2 +sphinx: + configuration: docs/conf.py +python: + version: 3.10 + install: + - requirements: project_explainer_ui/requirements.txt diff --git a/project_explainer_ui/src/gh-explainer b/project_explainer_ui/src/gh-explainer new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/project_explainer_ui/src/gh-explainer @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/project_explainer_ui/src/gh-processor b/project_explainer_ui/src/gh-processor new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/project_explainer_ui/src/gh-processor @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/project_explainer_ui/ui.py b/project_explainer_ui/ui.py index a836666..52be1f9 100644 --- a/project_explainer_ui/ui.py +++ b/project_explainer_ui/ui.py @@ -1,11 +1,18 @@ import gradio as gr from gh_explainer import Explainer + + def summarize(summarization_type, github_project_url, github_project_branch="main", huggingface_model_id="gpt2"): - gptExplainer = Explainer(huggingface_model_id) - if summarization_type == "brief": - return gptExplainer.brief(github_url=github_project_url, branch=github_project_branch)["summary"] - return gptExplainer.outline(github_url=github_project_url, branch=github_project_branch)["summary"] + try: + gptExplainer = Explainer(huggingface_model_id) + if summarization_type == "brief": + return gptExplainer.brief(github_url=github_project_url, branch=github_project_branch)["summary"] + return gptExplainer.outline(github_url=github_project_url, branch=github_project_branch)["summary"] + except Exception as e: + return f"An error occurred: {str(e)}" + + demo = gr.Interface( fn=summarize, diff --git a/readthedocs.yml b/readthedocs.yml new file mode 100644 index 0000000..dd9bdce --- /dev/null +++ b/readthedocs.yml @@ -0,0 +1,9 @@ +version: 2 + +build: + os: "ubuntu-20.04" + tools: + python: "3.12" + +sphinx: + configuration: docs/source/conf.py \ No newline at end of file diff --git a/source/conf.py b/source/conf.py new file mode 100644 index 0000000..170a0cc --- /dev/null +++ b/source/conf.py @@ -0,0 +1,28 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'PROJECT-EXPLAINER' +copyright = '2024, C2SI' +author = 'C2SI' +release = '27 Aug, 2023' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [] + +templates_path = ['_templates'] +exclude_patterns = [] + +language = 'Python, Jupyter Notbook' + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/source/index.rst b/source/index.rst new file mode 100644 index 0000000..5adb54d --- /dev/null +++ b/source/index.rst @@ -0,0 +1,20 @@ +.. PROJECT-EXPLAINER documentation master file, created by + sphinx-quickstart on Fri Mar 8 18:39:47 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to PROJECT-EXPLAINER's documentation! +============================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/src/gh-explainer b/src/gh-explainer new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/src/gh-explainer @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143 diff --git a/src/gh-processor b/src/gh-processor new file mode 160000 index 0000000..3af0213 --- /dev/null +++ b/src/gh-processor @@ -0,0 +1 @@ +Subproject commit 3af0213bf6f52afdb8e99a58fac061e87505c143