py-github-analyzer


Namepy-github-analyzer JSON
Version 1.0.1 PyPI version JSON
download
home_pageNone
SummaryHigh-performance async GitHub repository analyzer with AI-optimized code extraction and smart .env file support
upload_time2025-10-06 08:20:48
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords github analyzer code repository ai async dotenv env
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🚀 py-github-analyzer

High-performance async GitHub repository analyzer with AI-optimized code extraction and smart .env file support

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![PyPI version](https://badge.fury.io/py/py-github-analyzer.svg)](https://badge.fury.io/py/py-github-analyzer)

## ✨ Features

### 🔐 **Advanced Authentication**
- **✅ Fine-grained Token Support**: Latest GitHub token standard with `Bearer` authentication
- **✅ Classic Token Support**: Traditional `ghp_` tokens with `token` authentication  
- **🔄 Auto Token Detection**: Automatically detects token type and uses appropriate authentication
- **📁 Multi-source Token Loading**: Environment variables, .env files, CLI parameters
- **🔒 Private Repository Access**: Full access to private repositories with proper permissions

### ⚡ **High Performance**
- **🎯 ZIP-first Strategy**: Optimal download method with intelligent API fallback
- **📊 Smart Rate Limit Management**: Adaptive strategies for different token types
- **🚀 Pure Async Architecture**: Built with modern async/await patterns for maximum performance
- **🔄 Intelligent Fallback**: Graceful degradation when ZIP access fails

### 📋 **Smart Analysis**
- **🔍 Automatic Language Detection**: Accurate detection and dependency mapping
- **📊 Intelligent File Filtering**: Skip binaries, focus on source code with priority scoring
- **📦 Multiple Output Formats**: JSON metadata and structured code extraction
- **🎯 Framework Detection**: Identifies popular frameworks and patterns

### 🌐 **Cross-Platform**
- **💻 Windows, macOS, and Linux**: Full compatibility across all platforms
- **🛡️ Smart Error Handling**: Comprehensive error messages and recovery strategies
- **📁 Smart .env Support**: Automatically finds and loads tokens from .env files

## 📦 Installation

### From PyPI (Recommended)

```bash
pip install py-github-analyzer
From Source
Bash

git clone [https://github.com/cruxhan/py-github-analyzer.git](https://github.com/cruxhan/py-github-analyzer.git)
cd py-github-analyzer
pip install -e .
🔑 GitHub Token Setup (Recommended)
Supported Token Types
py-github-analyzer supports all GitHub token types with automatic detection:

🔑 Fine-grained Personal Access Tokens (Latest)
Prefix: github_pat_

Authentication: Bearer header

Permissions: Repository-specific granular access

Security: ✅ Enhanced security with minimal required permissions

Performance: ⚠️ API-only access for private repos (ZIP may fail)

Setup: GitHub Settings → Developer settings → Personal access tokens → Fine-grained tokens

🔑 Classic Personal Access Tokens (Traditional)
Prefix: ghp_

Authentication: token header

Permissions: Broad scope-based access

Security: ⚠️ Wide access permissions

Performance: ✅ Full ZIP and API access

Setup: GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)

Creating Tokens
For Fine-grained Tokens (Recommended for Security):
Visit GitHub Settings → Personal Access Tokens → Fine-grained tokens

Select Repository access: Choose specific repositories or all repositories

Set Repository permissions:

Contents: Read (required for file access)

Actions: Read (required for ZIP downloads)

Metadata: Read (required for repository info)

Copy the token (starts with github_pat_)

For Classic Tokens (Faster for Bulk Analysis):
Visit GitHub Settings → Personal Access Tokens → Tokens (classic)

Click Generate new token (classic)

Select repo scope for private repository access

Copy the token (starts with ghp_)

Setting Up Your Token
Option 1: Environment Variable (Recommended)

Bash

# For Linux/macOS
export GITHUB_TOKEN=your_token_here

# For Windows (Command Prompt)
set GITHUB_TOKEN=your_token_here
Option 2: .env file in your project directory

Bash

echo "GITHUB_TOKEN=your_token_here" > .env
Option 3: CLI parameter

Bash

py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --github-token your_token_here
📋 Usage Examples
Basic Usage
Analyze a public repository

Bash

py-github-analyzer [https://github.com/octocat/Hello-World](https://github.com/octocat/Hello-World)
Analyze with verbose output

Bash

py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --verbose
Specify output directory and format

Bash

py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --output-dir ./results --output-format json
Advanced Options
Force specific analysis method

Bash

py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --method api
py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --method zip
Multiple output formats

Bash

py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --output-format both
Dry run (test without processing)

Bash

py-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --dry-run
📖 Output Format
JSON Structure
JSON

{
  "metadata": {
    "repo": "owner/repository-name",
    "desc": "Repository description",
    "lang": ["Primary", "Secondary", "Languages"],
    "size": {
      "repo_size": "288KB",
      "source_size": "294.2KB",
      "display_size": "288KB"
    },
    "files": 117,
    "main": ["main.py", "app.py", "index.js"],
    "deps": ["dependency1", "dependency2"],
    "created": 1634567890,
    "version": "1.0.0"
  },
  "files": [
    {
      "path": "src/main.py",
      "content": "file content here",
      "size": 1234,
      "lines": 45,
      "language": "Python",
      "priority": 950
    }
  ]
}
🤝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup
Bash

git clone [https://github.com/cruxhan/py-github-analyzer.git](https://github.com/cruxhan/py-github-analyzer.git)
cd py-github-analyzer

# Create virtual environment
python -m venv venv
# On Windows: venv\Scripts\activate
# On Linux/macOS: source venv/bin/activate
source venv/bin/activate 

# Install development dependencies
pip install -e .[dev]

# Run tests
poe test
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.

📞 Support
Issues: GitHub Issues

Discussions: GitHub Discussions

Made with ❤️ for developers who need fast, reliable GitHub repository analysis

py-github-analyzer v1.0.0

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "py-github-analyzer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "github, analyzer, code, repository, ai, async, dotenv, env",
    "author": null,
    "author_email": "Han Jun-hee <createbrain2heart@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/56/63/b20c034d2d19d97168abf62dddbc90992399085f19587ee3522e923ad37b/py_github_analyzer-1.0.1.tar.gz",
    "platform": null,
    "description": "# \ud83d\ude80 py-github-analyzer\r\n\r\nHigh-performance async GitHub repository analyzer with AI-optimized code extraction and smart .env file support\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\r\n[![PyPI version](https://badge.fury.io/py/py-github-analyzer.svg)](https://badge.fury.io/py/py-github-analyzer)\r\n\r\n## \u2728 Features\r\n\r\n### \ud83d\udd10 **Advanced Authentication**\r\n- **\u2705 Fine-grained Token Support**: Latest GitHub token standard with `Bearer` authentication\r\n- **\u2705 Classic Token Support**: Traditional `ghp_` tokens with `token` authentication  \r\n- **\ud83d\udd04 Auto Token Detection**: Automatically detects token type and uses appropriate authentication\r\n- **\ud83d\udcc1 Multi-source Token Loading**: Environment variables, .env files, CLI parameters\r\n- **\ud83d\udd12 Private Repository Access**: Full access to private repositories with proper permissions\r\n\r\n### \u26a1 **High Performance**\r\n- **\ud83c\udfaf ZIP-first Strategy**: Optimal download method with intelligent API fallback\r\n- **\ud83d\udcca Smart Rate Limit Management**: Adaptive strategies for different token types\r\n- **\ud83d\ude80 Pure Async Architecture**: Built with modern async/await patterns for maximum performance\r\n- **\ud83d\udd04 Intelligent Fallback**: Graceful degradation when ZIP access fails\r\n\r\n### \ud83d\udccb **Smart Analysis**\r\n- **\ud83d\udd0d Automatic Language Detection**: Accurate detection and dependency mapping\r\n- **\ud83d\udcca Intelligent File Filtering**: Skip binaries, focus on source code with priority scoring\r\n- **\ud83d\udce6 Multiple Output Formats**: JSON metadata and structured code extraction\r\n- **\ud83c\udfaf Framework Detection**: Identifies popular frameworks and patterns\r\n\r\n### \ud83c\udf10 **Cross-Platform**\r\n- **\ud83d\udcbb Windows, macOS, and Linux**: Full compatibility across all platforms\r\n- **\ud83d\udee1\ufe0f Smart Error Handling**: Comprehensive error messages and recovery strategies\r\n- **\ud83d\udcc1 Smart .env Support**: Automatically finds and loads tokens from .env files\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n### From PyPI (Recommended)\r\n\r\n```bash\r\npip install py-github-analyzer\r\nFrom Source\r\nBash\r\n\r\ngit clone [https://github.com/cruxhan/py-github-analyzer.git](https://github.com/cruxhan/py-github-analyzer.git)\r\ncd py-github-analyzer\r\npip install -e .\r\n\ud83d\udd11 GitHub Token Setup (Recommended)\r\nSupported Token Types\r\npy-github-analyzer supports all GitHub token types with automatic detection:\r\n\r\n\ud83d\udd11 Fine-grained Personal Access Tokens (Latest)\r\nPrefix: github_pat_\r\n\r\nAuthentication: Bearer header\r\n\r\nPermissions: Repository-specific granular access\r\n\r\nSecurity: \u2705 Enhanced security with minimal required permissions\r\n\r\nPerformance: \u26a0\ufe0f API-only access for private repos (ZIP may fail)\r\n\r\nSetup: GitHub Settings \u2192 Developer settings \u2192 Personal access tokens \u2192 Fine-grained tokens\r\n\r\n\ud83d\udd11 Classic Personal Access Tokens (Traditional)\r\nPrefix: ghp_\r\n\r\nAuthentication: token header\r\n\r\nPermissions: Broad scope-based access\r\n\r\nSecurity: \u26a0\ufe0f Wide access permissions\r\n\r\nPerformance: \u2705 Full ZIP and API access\r\n\r\nSetup: GitHub Settings \u2192 Developer settings \u2192 Personal access tokens \u2192 Tokens (classic)\r\n\r\nCreating Tokens\r\nFor Fine-grained Tokens (Recommended for Security):\r\nVisit GitHub Settings \u2192 Personal Access Tokens \u2192 Fine-grained tokens\r\n\r\nSelect Repository access: Choose specific repositories or all repositories\r\n\r\nSet Repository permissions:\r\n\r\nContents: Read (required for file access)\r\n\r\nActions: Read (required for ZIP downloads)\r\n\r\nMetadata: Read (required for repository info)\r\n\r\nCopy the token (starts with github_pat_)\r\n\r\nFor Classic Tokens (Faster for Bulk Analysis):\r\nVisit GitHub Settings \u2192 Personal Access Tokens \u2192 Tokens (classic)\r\n\r\nClick Generate new token (classic)\r\n\r\nSelect repo scope for private repository access\r\n\r\nCopy the token (starts with ghp_)\r\n\r\nSetting Up Your Token\r\nOption 1: Environment Variable (Recommended)\r\n\r\nBash\r\n\r\n# For Linux/macOS\r\nexport GITHUB_TOKEN=your_token_here\r\n\r\n# For Windows (Command Prompt)\r\nset GITHUB_TOKEN=your_token_here\r\nOption 2: .env file in your project directory\r\n\r\nBash\r\n\r\necho \"GITHUB_TOKEN=your_token_here\" > .env\r\nOption 3: CLI parameter\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --github-token your_token_here\r\n\ud83d\udccb Usage Examples\r\nBasic Usage\r\nAnalyze a public repository\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/octocat/Hello-World](https://github.com/octocat/Hello-World)\r\nAnalyze with verbose output\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --verbose\r\nSpecify output directory and format\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --output-dir ./results --output-format json\r\nAdvanced Options\r\nForce specific analysis method\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --method api\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --method zip\r\nMultiple output formats\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --output-format both\r\nDry run (test without processing)\r\n\r\nBash\r\n\r\npy-github-analyzer [https://github.com/owner/repo](https://github.com/owner/repo) --dry-run\r\n\ud83d\udcd6 Output Format\r\nJSON Structure\r\nJSON\r\n\r\n{\r\n  \"metadata\": {\r\n    \"repo\": \"owner/repository-name\",\r\n    \"desc\": \"Repository description\",\r\n    \"lang\": [\"Primary\", \"Secondary\", \"Languages\"],\r\n    \"size\": {\r\n      \"repo_size\": \"288KB\",\r\n      \"source_size\": \"294.2KB\",\r\n      \"display_size\": \"288KB\"\r\n    },\r\n    \"files\": 117,\r\n    \"main\": [\"main.py\", \"app.py\", \"index.js\"],\r\n    \"deps\": [\"dependency1\", \"dependency2\"],\r\n    \"created\": 1634567890,\r\n    \"version\": \"1.0.0\"\r\n  },\r\n  \"files\": [\r\n    {\r\n      \"path\": \"src/main.py\",\r\n      \"content\": \"file content here\",\r\n      \"size\": 1234,\r\n      \"lines\": 45,\r\n      \"language\": \"Python\",\r\n      \"priority\": 950\r\n    }\r\n  ]\r\n}\r\n\ud83e\udd1d Contributing\r\nWe welcome contributions! Please see our Contributing Guidelines for details.\r\n\r\nDevelopment Setup\r\nBash\r\n\r\ngit clone [https://github.com/cruxhan/py-github-analyzer.git](https://github.com/cruxhan/py-github-analyzer.git)\r\ncd py-github-analyzer\r\n\r\n# Create virtual environment\r\npython -m venv venv\r\n# On Windows: venv\\Scripts\\activate\r\n# On Linux/macOS: source venv/bin/activate\r\nsource venv/bin/activate \r\n\r\n# Install development dependencies\r\npip install -e .[dev]\r\n\r\n# Run tests\r\npoe test\r\n\ud83d\udcc4 License\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n\ud83d\udcde Support\r\nIssues: GitHub Issues\r\n\r\nDiscussions: GitHub Discussions\r\n\r\nMade with \u2764\ufe0f for developers who need fast, reliable GitHub repository analysis\r\n\r\npy-github-analyzer v1.0.0\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "High-performance async GitHub repository analyzer with AI-optimized code extraction and smart .env file support",
    "version": "1.0.1",
    "project_urls": {
        "Bug Reports": "https://github.com/cruxhan/py-github-analyzer/issues",
        "Changelog": "https://github.com/cruxhan/py-github-analyzer/releases",
        "Documentation": "https://github.com/cruxhan/py-github-analyzer#readme",
        "Homepage": "https://github.com/cruxhan/py-github-analyzer",
        "Repository": "https://github.com/cruxhan/py-github-analyzer"
    },
    "split_keywords": [
        "github",
        " analyzer",
        " code",
        " repository",
        " ai",
        " async",
        " dotenv",
        " env"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "33321bc677d40ff1090dabe90276654cc2573af76618821ff7d6cf63f24330cd",
                "md5": "ff3009129bcbff4d6e79ed96f047d84d",
                "sha256": "f65303a0d7f710d5e56cbc0bb661252c9910a0afae6121205bc35b39227548cf"
            },
            "downloads": -1,
            "filename": "py_github_analyzer-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ff3009129bcbff4d6e79ed96f047d84d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 60325,
            "upload_time": "2025-10-06T08:20:47",
            "upload_time_iso_8601": "2025-10-06T08:20:47.048812Z",
            "url": "https://files.pythonhosted.org/packages/33/32/1bc677d40ff1090dabe90276654cc2573af76618821ff7d6cf63f24330cd/py_github_analyzer-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5663b20c034d2d19d97168abf62dddbc90992399085f19587ee3522e923ad37b",
                "md5": "3fb7ed6bcb5aa6bf9a18b42b4062fe30",
                "sha256": "ae58f9ff7b5b0c68a65c16d257bd274ff4786d4f5875c27af314ac1fc565709c"
            },
            "downloads": -1,
            "filename": "py_github_analyzer-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3fb7ed6bcb5aa6bf9a18b42b4062fe30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 58121,
            "upload_time": "2025-10-06T08:20:48",
            "upload_time_iso_8601": "2025-10-06T08:20:48.347868Z",
            "url": "https://files.pythonhosted.org/packages/56/63/b20c034d2d19d97168abf62dddbc90992399085f19587ee3522e923ad37b/py_github_analyzer-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 08:20:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cruxhan",
    "github_project": "py-github-analyzer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "py-github-analyzer"
}
        
Elapsed time: 1.00309s