Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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

Expand Down
48 changes: 48 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
30 changes: 30 additions & 0 deletions docs/dev-docs.md
Original file line number Diff line number Diff line change
@@ -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 .`
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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)
Empty file added requirements-dev.txt
Empty file.
33 changes: 33 additions & 0 deletions src/github_cli.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions src/github_cli.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/github_cli.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions src/github_cli.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[console_scripts]
github = github_cli.main:main
13 changes: 13 additions & 0 deletions src/github_cli.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -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]
1 change: 1 addition & 0 deletions src/github_cli.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github_cli
2 changes: 2 additions & 0 deletions src/github_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""GitHub CLI package
"""
8 changes: 8 additions & 0 deletions src/github_cli/__main__.py
Original file line number Diff line number Diff line change
@@ -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()
Binary file added src/github_cli/__pycache__/__init__.cpython-313.pyc
Binary file not shown.
Binary file added src/github_cli/__pycache__/__main__.cpython-313.pyc
Binary file not shown.
Binary file not shown.
Binary file added src/github_cli/__pycache__/main.cpython-313.pyc
Binary file not shown.
Binary file added src/github_cli/__pycache__/repos.cpython-313.pyc
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions main.py → src/github_cli/main.py
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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'):
Expand Down
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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__(
Expand Down Expand Up @@ -82,4 +82,4 @@ def __init__(
watchers: int,
default_branch: str,
permissions: GitHubRepoPermissions
)
)
File renamed without changes.
6 changes: 3 additions & 3 deletions github/repos.py → src/github_cli/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down