diff --git a/.gitignore b/.gitignore index 34df971..42ffb51 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +# virtual environment +venv/* +venv + # Ignore sqlite database files *.db diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..b4e05c2 --- /dev/null +++ b/build.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Build script for GitHub CLI using PyInstaller +# This script creates a single binary executable + +set -e # Exit on any error + +echo "๐Ÿ”จ Building GitHub Inventory CLI binary..." + +# Clean previous builds +echo "๐Ÿงน Cleaning previous builds..." +rm -rf build/ dist/ + +# Install/update dependencies +echo "๐Ÿ“ฆ Installing dependencies..." +# Use the virtual environment's pip if available, otherwise use system pip +if [ -f "venv/bin/pip" ]; then + ./venv/bin/pip install -r requirements.txt + ./venv/bin/pip install -r requirements-dev.txt + ./venv/bin/pip install pyinstaller +else + pip install -r requirements.txt + pip install -r requirements-dev.txt + pip install pyinstaller +fi + +# Build the binary using PyInstaller +echo "โš™๏ธ Building binary with PyInstaller..." +# Use the virtual environment's Python if available, otherwise use system Python +if [ -f "venv/bin/pyinstaller" ]; then + ./venv/bin/pyinstaller github.spec +else + pyinstaller github.spec +fi + +# Check if build was successful +if [ -f "dist/github" ]; then + echo "โœ… Build successful!" + echo "๐Ÿ“ Binary location: dist/github" + echo "๐Ÿ“Š Binary size: $(du -h dist/github | cut -f1)" + echo "" + echo "๐Ÿš€ You can now:" + echo " - Copy dist/github to your Docker image" + echo " - Run ./dist/github --help to test locally" +else + echo "โŒ Build failed!" + exit 1 +fi diff --git a/NOTES.md b/docs/NOTES.md similarity index 100% rename from NOTES.md rename to docs/NOTES.md diff --git a/docs/dev-docs.md b/docs/dev-docs.md new file mode 100644 index 0000000..6c69fab --- /dev/null +++ b/docs/dev-docs.md @@ -0,0 +1,30 @@ +# Development Docs + +Database: SQLite + +Virtual Environment: venv + +- `python3 -m venv ven` +- `source venv/bin/activate` + +## Project Structure & Build State + +If everything is structured correctly, you should be able to run: + +- `source venv/bin/activate` +- `github-cli list repos` + +### Setup for Modules and Development + +a) Move things under `/src` directory + +b) Make sure module references are updated + +c) Add `__init__.py` and `__main__.py` to the + +Setup these two files: + +- pyproject.toml +- build.sh + +Then run: `pip install -e .` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cd44342 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "github-cli" +version = "0.0.1" +description = "Manage your GitHub inventory" +readme = "README.md" +requires-python = ">=3.11" +# license = "MIT" +authors = [{ name = "Darrien Rushing" }] +# We declare that deps come from elsewhere: +dynamic = ["dependencies", "optional-dependencies"] + +[tool.setuptools.dynamic] +dependencies = { file = ["requirements.txt"] } +optional-dependencies.dev = { file = ["requirements-dev.txt"] } # optional + +[project.urls] +Homepage = "https://github.com/meddlin/github-inventory" + +# creates the `github` shell command +[project.scripts] +github = "github_cli.main:main" + +[tool.pytest.ini_options] +minversion = "8.0" +addopts = "-ra -q" +testpaths = [ + "tests", +] + +[tool.setuptools] +package-dir = {"" = "src"} +include-package-data = false # keep wheels lean unless you add data files explicitly + +[tool.setuptools.packages.find] +where = ["src"] +exclude = ["tests*", "docs*"] # package name patterns (not file globs) \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..e69de29 diff --git a/src/github_cli.egg-info/PKG-INFO b/src/github_cli.egg-info/PKG-INFO new file mode 100644 index 0000000..6eae3e3 --- /dev/null +++ b/src/github_cli.egg-info/PKG-INFO @@ -0,0 +1,33 @@ +Metadata-Version: 2.4 +Name: github-cli +Version: 0.0.1 +Summary: Manage your GitHub inventory +Author: Darrien Rushing +Project-URL: Homepage, https://github.com/meddlin/github-inventory +Requires-Python: >=3.11 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: certifi==2025.7.14 +Requires-Dist: charset-normalizer==3.4.2 +Requires-Dist: idna==3.10 +Requires-Dist: markdown-it-py==3.0.0 +Requires-Dist: mdurl==0.1.2 +Requires-Dist: Pygments==2.19.2 +Requires-Dist: python-dotenv==1.1.1 +Requires-Dist: requests==2.32.4 +Requires-Dist: rich==14.0.0 +Requires-Dist: typing_extensions==4.14.1 +Requires-Dist: urllib3==2.5.0 +Provides-Extra: dev +Dynamic: license-file + +# GitHub Inventory + +A better way to manage your GitHub. + +## Useful Tools for this repo + +- Draw.io Integration (VSCode extension) +- Draw.io Integration: Mermaid plugin (VSCode extension) +- Draw.io Integration: Markdown plug (VSCode extension) +- SQLite client/browser diff --git a/src/github_cli.egg-info/SOURCES.txt b/src/github_cli.egg-info/SOURCES.txt new file mode 100644 index 0000000..a0b758f --- /dev/null +++ b/src/github_cli.egg-info/SOURCES.txt @@ -0,0 +1,22 @@ +LICENSE +README.md +pyproject.toml +requirements-dev.txt +requirements.txt +src/github_cli/__init__.py +src/github_cli/__main__.py +src/github_cli/gh_actions.py +src/github_cli/main.py +src/github_cli/repos.py +src/github_cli.egg-info/PKG-INFO +src/github_cli.egg-info/SOURCES.txt +src/github_cli.egg-info/dependency_links.txt +src/github_cli.egg-info/entry_points.txt +src/github_cli.egg-info/requires.txt +src/github_cli.egg-info/top_level.txt +src/github_cli/database/manager.py +src/github_cli/database/util.py +src/github_cli/models/owner.py +src/github_cli/models/repo_permissions.py +src/github_cli/models/repository.py +src/github_cli/models/workflow.py \ No newline at end of file diff --git a/src/github_cli.egg-info/dependency_links.txt b/src/github_cli.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/github_cli.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/src/github_cli.egg-info/entry_points.txt b/src/github_cli.egg-info/entry_points.txt new file mode 100644 index 0000000..0b789eb --- /dev/null +++ b/src/github_cli.egg-info/entry_points.txt @@ -0,0 +1,2 @@ +[console_scripts] +github = github_cli.main:main diff --git a/src/github_cli.egg-info/requires.txt b/src/github_cli.egg-info/requires.txt new file mode 100644 index 0000000..f2a23e2 --- /dev/null +++ b/src/github_cli.egg-info/requires.txt @@ -0,0 +1,13 @@ +certifi==2025.7.14 +charset-normalizer==3.4.2 +idna==3.10 +markdown-it-py==3.0.0 +mdurl==0.1.2 +Pygments==2.19.2 +python-dotenv==1.1.1 +requests==2.32.4 +rich==14.0.0 +typing_extensions==4.14.1 +urllib3==2.5.0 + +[dev] diff --git a/src/github_cli.egg-info/top_level.txt b/src/github_cli.egg-info/top_level.txt new file mode 100644 index 0000000..65ea9e9 --- /dev/null +++ b/src/github_cli.egg-info/top_level.txt @@ -0,0 +1 @@ +github_cli diff --git a/src/github_cli/__init__.py b/src/github_cli/__init__.py new file mode 100644 index 0000000..d1b18f6 --- /dev/null +++ b/src/github_cli/__init__.py @@ -0,0 +1,2 @@ +"""GitHub CLI package +""" \ No newline at end of file diff --git a/src/github_cli/__main__.py b/src/github_cli/__main__.py new file mode 100644 index 0000000..f0da5e9 --- /dev/null +++ b/src/github_cli/__main__.py @@ -0,0 +1,8 @@ +"""Entry point so `python -m github_cli` works and PyInstaller can target the package.""" + +# from recipes_cli.main import main +from github_cli.main import main + + +if __name__ == "__main__": + main() diff --git a/src/github_cli/__pycache__/__init__.cpython-313.pyc b/src/github_cli/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..dce9c87 Binary files /dev/null and b/src/github_cli/__pycache__/__init__.cpython-313.pyc differ diff --git a/src/github_cli/__pycache__/__main__.cpython-313.pyc b/src/github_cli/__pycache__/__main__.cpython-313.pyc new file mode 100644 index 0000000..596ee0d Binary files /dev/null and b/src/github_cli/__pycache__/__main__.cpython-313.pyc differ diff --git a/src/github_cli/__pycache__/gh_actions.cpython-313.pyc b/src/github_cli/__pycache__/gh_actions.cpython-313.pyc new file mode 100644 index 0000000..aab97d9 Binary files /dev/null and b/src/github_cli/__pycache__/gh_actions.cpython-313.pyc differ diff --git a/src/github_cli/__pycache__/main.cpython-313.pyc b/src/github_cli/__pycache__/main.cpython-313.pyc new file mode 100644 index 0000000..0ae3abc Binary files /dev/null and b/src/github_cli/__pycache__/main.cpython-313.pyc differ diff --git a/src/github_cli/__pycache__/repos.cpython-313.pyc b/src/github_cli/__pycache__/repos.cpython-313.pyc new file mode 100644 index 0000000..9a2b70d Binary files /dev/null and b/src/github_cli/__pycache__/repos.cpython-313.pyc differ diff --git a/src/github_cli/database/__pycache__/manager.cpython-313.pyc b/src/github_cli/database/__pycache__/manager.cpython-313.pyc new file mode 100644 index 0000000..804b16a Binary files /dev/null and b/src/github_cli/database/__pycache__/manager.cpython-313.pyc differ diff --git a/database/manager.py b/src/github_cli/database/manager.py similarity index 100% rename from database/manager.py rename to src/github_cli/database/manager.py diff --git a/database/util.py b/src/github_cli/database/util.py similarity index 100% rename from database/util.py rename to src/github_cli/database/util.py diff --git a/github/gh_actions.py b/src/github_cli/gh_actions.py similarity index 100% rename from github/gh_actions.py rename to src/github_cli/gh_actions.py diff --git a/main.py b/src/github_cli/main.py similarity index 94% rename from main.py rename to src/github_cli/main.py index 8eadff0..d64f13d 100644 --- a/main.py +++ b/src/github_cli/main.py @@ -1,8 +1,10 @@ +"""Main module +""" import argparse import textwrap from dotenv import load_dotenv -import github.repos as gh_repos +from github_cli import repos def start_repl(): print("Welcome to the REPL") @@ -42,7 +44,7 @@ def main(): repo_parser.add_argument('--report', type = str, help = 'Type of report to execute') repo_parser.add_argument('--user', type = str, help = 'GitHub username') repo_parser.add_argument('--csv', action = argparse.BooleanOptionalAction) - repo_parser.set_defaults(func = gh_repos.handle_args) + repo_parser.set_defaults(func = repos.handle_args) args = parser.parse_args() if hasattr(args, 'func'): diff --git a/src/github_cli/models/__pycache__/workflow.cpython-313.pyc b/src/github_cli/models/__pycache__/workflow.cpython-313.pyc new file mode 100644 index 0000000..76bead4 Binary files /dev/null and b/src/github_cli/models/__pycache__/workflow.cpython-313.pyc differ diff --git a/github/models/owner.py b/src/github_cli/models/owner.py similarity index 100% rename from github/models/owner.py rename to src/github_cli/models/owner.py diff --git a/github/models/repo_permissions.py b/src/github_cli/models/repo_permissions.py similarity index 100% rename from github/models/repo_permissions.py rename to src/github_cli/models/repo_permissions.py diff --git a/github/models/repository.py b/src/github_cli/models/repository.py similarity index 97% rename from github/models/repository.py rename to src/github_cli/models/repository.py index 3d12da6..28a5552 100644 --- a/github/models/repository.py +++ b/src/github_cli/models/repository.py @@ -1,5 +1,5 @@ from typing import Any, List -from github.models.owner import GitHubOwner +from github_cli.models.owner import GitHubOwner class GitHubRepository: def __init__( @@ -82,4 +82,4 @@ def __init__( watchers: int, default_branch: str, permissions: GitHubRepoPermissions - ) \ No newline at end of file + ) diff --git a/github/models/workflow.py b/src/github_cli/models/workflow.py similarity index 100% rename from github/models/workflow.py rename to src/github_cli/models/workflow.py diff --git a/github/repos.py b/src/github_cli/repos.py similarity index 94% rename from github/repos.py rename to src/github_cli/repos.py index 59ffeb8..2c8758b 100644 --- a/github/repos.py +++ b/src/github_cli/repos.py @@ -8,9 +8,9 @@ import requests from rich.console import Console from rich.table import Table -from github.gh_actions import __request_repo_workflows -from github.models.workflow import GitHubWorkflow -from database.manager import DatabaseManager +from github_cli.gh_actions import __request_repo_workflows +from github_cli.models.workflow import GitHubWorkflow +from github_cli.database.manager import DatabaseManager def __request_repos_for_user(username: str) -> List[Any]: """Get repos for a GitHub user