From 0f579c973ded1476ce31c377046561b22259286a Mon Sep 17 00:00:00 2001 From: TySP-Dev <68524461+TySP-Dev@users.noreply.github.com> Date: Thu, 13 Nov 2025 21:01:16 -1000 Subject: [PATCH] Optimized layout and code for building --- .flet | 59 +++++++++++++++++++++ .gitignore | 33 ++++++++++-- BUILD.md | 7 ++- README.md | 31 +++++++++-- SETUP.md | 28 ++++++++-- pyproject.toml | 72 ++++++++++++++++++++++++++ src/app_components/__init__.py | 26 ++++++++-- src/main.py | 43 ++++++++++++--- src/requirements.txt | 13 ----- src/requirements/requirements-ai.txt | 11 ++++ src/requirements/requirements-base.txt | 14 +++++ src/requirements/requirements-dev.txt | 12 +++++ src/requirements/requirements.txt | 23 ++++++++ 13 files changed, 337 insertions(+), 35 deletions(-) create mode 100644 .flet create mode 100644 pyproject.toml delete mode 100644 src/requirements.txt create mode 100644 src/requirements/requirements-ai.txt create mode 100644 src/requirements/requirements-base.txt create mode 100644 src/requirements/requirements-dev.txt create mode 100644 src/requirements/requirements.txt diff --git a/.flet b/.flet new file mode 100644 index 0000000..1db6b41 --- /dev/null +++ b/.flet @@ -0,0 +1,59 @@ +# Flet Build Configuration +# This file provides additional build settings for the Flet application + +# App metadata +[app] +name = "GitHub Pulse" +description = "GitHub automation workflows with AI assistance" +author = "TySP-Dev" + +# Build settings +[build] +# Include these files/directories in the build +include_packages = [ + "app_components", + "assets" +] + +# Exclude unnecessary files from build +exclude = [ + "*.pyc", + "__pycache__", + "*.pyo", + "*.pyd", + ".git", + ".gitignore", + "venv", + ".env", + "*.md", + "BUILD.md", + "SETUP.md", + "*.example" +] + +# Asset optimization +[assets] +# Optimize images during build +optimize_images = true +# Include app_components/assets directory +directories = [ + "assets", + "app_components/assets" +] + +# Platform-specific settings +[android] +adaptive_icon_background = "#1976D2" +adaptive_icon_foreground = "assets/icon.png" + +[ios] +info_plist_version = "1.0" + +[macos] +info_plist_version = "1.0" + +[windows] +console = false # Hide console window in production + +[linux] +categories = ["Development", "Utility"] diff --git a/.gitignore b/.gitignore index a3e65dd..1797916 100644 --- a/.gitignore +++ b/.gitignore @@ -161,10 +161,35 @@ cython_debug/ # Flet storage/ +.flet/ -# Build +# Build artifacts build/ -pyproject.toml +dist/ +src/build/ +src/dist/ +*.apk +*.ipa +*.app +*.exe +*.dmg +*.deb +*.rpm +*.tar.gz -# Config -config.json \ No newline at end of file +# Flutter/Flet build artifacts +.flutter-plugins +.flutter-plugins-dependencies +.dart_tool/ +android/ +ios/ +linux/ +macos/ +windows/ +web/ + +# Configuration (generated during build, not in git) +# Note: pyproject.toml is now tracked for proper builds +# config.json should be user-specific +config.json +src/config.json \ No newline at end of file diff --git a/BUILD.md b/BUILD.md index 0183ced..c115aca 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,5 +1,9 @@ # Build Instructions +> [!NOTE] +> Building has only been tested for **linux**. +> Please report bugs with building on any other platform. + ## Prerequisites - [Node.js](https://nodejs.org/) (v18+) @@ -39,7 +43,8 @@ source venv/bin/activate ## Install Dependencies ```bash -pip install -r requirements.txt +# For dev dependencies +pip install -r requirements/requirements-dev.txt ``` ```bash diff --git a/README.md b/README.md index c83f877..07246f6 100644 --- a/README.md +++ b/README.md @@ -17,11 +17,16 @@ A Python-based GUI application for GitHub automation workflows and AI assisted w ```text github_pulse/ ├── src/ # Main application directory -│ ├── app.py # Application entry point +│ ├── main.py # Application entry point │ ├── requirements.txt # Python dependencies -│ ├── assets # Images for build +│ ├── assets/ # Images for build │ │ ├── icon.png # Application icon │ │ └── splash_android.png # Splash screen image +│ ├── requirements/ +│ │ ├── requirements-dev.txt # Development dependencies +│ │ ├── requirements-ai.txt # AI dependencies +│ │ ├── requirements.txt # Production dependencies +│ │ └── requirements-base.txt # Base dependencies │ └── app_components/ # Application modules │ ├── assets/ # Images and assets │ │ ├── flow-diagram.png # Workflow diagram @@ -56,12 +61,14 @@ github_pulse/ ## Quick Start 1. **Clone the repository** + ```bash git clone https://github.com/TySP-Dev/github_pulse.git cd github_pulse/src ``` 2. **Create and activate virtual environment** + ```bash # Create virtual environment python -m venv venv @@ -74,11 +81,29 @@ github_pulse/ ``` 3. **Install dependencies** + ```bash - pip install -r requirements.txt + # For all production dependencies + pip install -r requirements/requirements.txt + ``` + + ```bash + # For dev dependencies + pip install -r requirements/requirements-dev.txt + ``` + + ```bash + # For ai dependencies + pip install -r requirements/requirements-ai.txt + ``` + + ```bash + # For base dependencies + pip install -r requirements/requirements-base.txt ``` 4. **Run the application** + ```bash python app.py ``` diff --git a/SETUP.md b/SETUP.md index c00f338..fe0087b 100644 --- a/SETUP.md +++ b/SETUP.md @@ -11,6 +11,7 @@ A Python-based GUI application for GitHub automation workflows. - **Python 3.8+** installed on your system - **Git** installed and configured - **GitHub** account with repository access +- **libmpv** installed on your system (Linux) ### Installation @@ -38,7 +39,23 @@ A Python-based GUI application for GitHub automation workflows. 3. **Install Dependencies** ```bash - pip install -r requirements.txt + # For all production dependencies + pip install -r requirements/requirements.txt + ``` + + ```bash + # For dev dependencies + pip install -r requirements/requirements-dev.txt + ``` + + ```bash + # For ai dependencies + pip install -r requirements/requirements-ai.txt + ``` + + ```bash + # For base dependencies + pip install -r requirements/requirements-base.txt ``` 4. **Run the Application** @@ -80,11 +97,16 @@ The project is organized as follows: ```text github_pulse/ ├── src/ # Main application directory -│ ├── app.py # Application entry point +│ ├── main.py # Application entry point │ ├── requirements.txt # Python dependencies -│ ├── assets # Images for build +│ ├── assets/ # Images for build │ │ ├── icon.png # Application icon │ │ └── splash_android.png # Splash screen image +│ ├── requirements/ +│ │ ├── requirements-dev.txt # Development dependencies +│ │ ├── requirements-ai.txt # AI dependencies +│ │ ├── requirements.txt # Production dependencies +│ │ └── requirements-base.txt # Base dependencies │ └── app_components/ # Application modules │ ├── assets/ # Images and assets │ │ ├── flow-diagram.png # Workflow diagram diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cb77632 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,72 @@ +[project] +name = "GitHub Pulse" +version = "0.0.1" +description = "A Python-based GUI application for GitHub automation workflows and AI assisted workflows." +readme = "README.md" +requires-python = ">=3.9" +authors = [ + { name = "TySP-Dev", email = "68524461+TySP-Dev@users.noreply.github.com" } +] +dependencies = [ + "flet==0.28.3", + "requests>=2.32.5", + "keyring>=25.6.0", + "GitPython>=3.1.45", + "openai>=2.8.0", + "anthropic>=0.72.1" +] + +[tool.flet] +# org name in reverse domain name notation, e.g. "com.mycompany". +# Combined with project.name to build bundle ID for iOS and Android apps +org = "com.unnaturalll-dev" + +# project display name that is used as an app title on Android and iOS home screens, +# shown in window titles and about app dialogs on desktop. +product = "GitHub Pulse" + +# company name to display in about app dialogs +company = "UnNaturalll Dev" + +# copyright text to display in about app dialogs +copyright = "Copyright (C) 2025 by UnNaturalll Dev" + +[tool.flet.app] +path = "src" + +# Icon and splash screen configuration for builds +icon = "src/assets/icon.png" +splash = "src/assets/splash_android.png" + +# Build optimizations +[tool.flet.android] +# Android-specific settings for better performance +permissions = [ + "android.permission.INTERNET", + "android.permission.ACCESS_NETWORK_STATE" +] + +[tool.flet.ios] +# iOS-specific settings +bundle_id = "com.unnaturalll-dev.githubpulse" + +[tool.flet.macos] +# macOS-specific settings +bundle_id = "com.unnaturalll-dev.githubpulse" + +[tool.flet.linux] +# Linux-specific settings + +[tool.flet.windows] +# Windows-specific settings + +[tool.uv] +dev-dependencies = [ + "flet[all]==0.28.3", +] + +[tool.poetry] +package-mode = false + +[tool.poetry.group.dev.dependencies] +flet = {extras = ["all"], version = "0.28.3"} \ No newline at end of file diff --git a/src/app_components/__init__.py b/src/app_components/__init__.py index 55b71cb..1abd10a 100644 --- a/src/app_components/__init__.py +++ b/src/app_components/__init__.py @@ -3,9 +3,24 @@ GitHub Pulse - Application Components Modular components for the application """ +import sys +import os + # Version info -__version__ = "1.0.0" -__author__ = "GitHub Pulse" +__version__ = "0.0.1" +__author__ = "TySP-Dev" +__app_name__ = "GitHub Pulse" + +# Determine if running in production build +IS_PRODUCTION = getattr(sys, 'frozen', False) + +# Get the application directory +if IS_PRODUCTION: + # In production build, get the executable directory + APP_DIR = os.path.dirname(sys.executable) +else: + # In development, get the source directory + APP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Export main classes for easier imports from .config_manager import ConfigManager @@ -27,5 +42,10 @@ __all__ = [ 'ContentBuilders', 'WorkflowManager', 'WorkflowItem', - 'GitHubRepoFetcher' + 'GitHubRepoFetcher', + '__version__', + '__author__', + '__app_name__', + 'IS_PRODUCTION', + 'APP_DIR' ] diff --git a/src/main.py b/src/main.py index 5469187..2ac4627 100644 --- a/src/main.py +++ b/src/main.py @@ -6,7 +6,9 @@ This application provides GitHub automation workflows with AI assistance. """ import sys +import os import flet as ft + # Compatibility fix for Flet 0.28+ (Icons vs icons, Colors vs colors) ft.icons = ft.Icons ft.colors = ft.Colors @@ -20,6 +22,11 @@ try: except ImportError as e: print(f"Error importing application components: {e}") print("Make sure all files are present in the app_components folder") + # In production builds, show a user-friendly error + if getattr(sys, 'frozen', False): + import traceback + error_details = traceback.format_exc() + print(error_details) sys.exit(1) @@ -35,13 +42,18 @@ class GitHubAutomationApp: self.page.theme_mode = ft.ThemeMode.DARK self.page.padding = 0 - # Set window size - self.page.window_width = 1400 - self.page.window_height = 1000 - self.page.window_min_width = 1200 - self.page.window_min_height = 800 + # Set window size with platform detection + # Mobile devices will use full screen + is_mobile = page.web or (hasattr(page, 'platform') and + page.platform in ['android', 'ios']) - # Material Design 3 theme + if not is_mobile: + self.page.window_width = 1400 + self.page.window_height = 1000 + self.page.window_min_width = 1200 + self.page.window_min_height = 800 + + # Material Design 3 theme with optimized settings self.page.theme = ft.Theme( color_scheme_seed="blue", use_material3=True, @@ -183,5 +195,20 @@ async def main(page: ft.Page): if __name__ == "__main__": - # Run the Flet app - ft.app(target=main) + # Run the Flet app with optimized settings + # For production builds, use appropriate view settings + is_production = getattr(sys, 'frozen', False) + + if is_production: + # Production build settings + ft.app( + target=main, + view=ft.AppView.FLET_APP, # Native app view for builds + assets_dir="assets" # Ensure assets are loaded correctly + ) + else: + # Development settings + ft.app( + target=main, + assets_dir="assets" + ) diff --git a/src/requirements.txt b/src/requirements.txt deleted file mode 100644 index 13e9031..0000000 --- a/src/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Core dependencies -requests>=2.32.5 -keyring>=25.6.0 # Secure credential storage - -# UI Framework -flet>=0.28.3 - -# Git operations (required for AI functionality) -GitPython>=3.1.45 - -# AI Providers -openai>=2.8.0 -anthropic>=0.72.1 \ No newline at end of file diff --git a/src/requirements/requirements-ai.txt b/src/requirements/requirements-ai.txt new file mode 100644 index 0000000..c04851a --- /dev/null +++ b/src/requirements/requirements-ai.txt @@ -0,0 +1,11 @@ +# AI Provider dependencies +# These are optional and only needed if using AI features + +# Include base requirements +-r requirements-base.txt + +# AI Providers (optional - install only what you need) +openai>=2.8.0 # For ChatGPT integration +anthropic>=0.72.1 # For Claude integration + +# Note: Ollama and GitHub Copilot use REST APIs and don't require additional packages diff --git a/src/requirements/requirements-base.txt b/src/requirements/requirements-base.txt new file mode 100644 index 0000000..2b0d341 --- /dev/null +++ b/src/requirements/requirements-base.txt @@ -0,0 +1,14 @@ +# Base requirements for all platforms +# Core dependencies required for the application to run + +# UI Framework (Flet - Python wrapper for Flutter) +flet==0.28.3 + +# HTTP requests for API calls +requests>=2.32.5 + +# Secure credential storage (cross-platform) +keyring>=25.6.0 + +# Git operations for repository management +GitPython>=3.1.45 diff --git a/src/requirements/requirements-dev.txt b/src/requirements/requirements-dev.txt new file mode 100644 index 0000000..d9cde79 --- /dev/null +++ b/src/requirements/requirements-dev.txt @@ -0,0 +1,12 @@ +# Development requirements +# Includes all dependencies for development, testing, and building + +# Include AI requirements (which includes base) +-r requirements-ai.txt + +# Development tools +flet[all]==0.28.3 # Flet with all development extras + +# Build tools (optional) +# pyinstaller>=6.0.0 # Alternative bundler if needed +# cx-Freeze>=6.15.0 # Alternative bundler if needed diff --git a/src/requirements/requirements.txt b/src/requirements/requirements.txt new file mode 100644 index 0000000..5100b0d --- /dev/null +++ b/src/requirements/requirements.txt @@ -0,0 +1,23 @@ +# GitHub Pulse - Main Requirements File +# This file includes all dependencies needed for production use + +# Core dependencies +requests>=2.32.5 # HTTP client for GitHub API and AI providers +keyring>=25.6.0 # Secure credential storage (cross-platform) +GitPython>=3.1.45 # Git operations for repository management + +# UI Framework - Flet (Python wrapper for Flutter) +flet==0.28.3 # Pin to specific version for build compatibility + +# AI Providers (optional but included for full functionality) +openai>=2.8.0 # ChatGPT/OpenAI API integration +anthropic>=0.72.1 # Claude/Anthropic API integration + +# Platform-specific notes: +# - Linux: Requires libgtk-3-dev, clang, cmake, ninja-build +# - Windows: Requires Visual Studio 2016+ +# - Android: Requires Android Studio and SDK +# - iOS/macOS: Requires Xcode + +# For minimal installation (no AI), use: pip install -r requirements-base.txt +# For development: pip install -r requirements-dev.txt \ No newline at end of file