py-performance-hints


Namepy-performance-hints JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryIntelligent performance bottleneck detection for Python developers
upload_time2025-09-14 14:24:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 py-performance-hints Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords performance profiling optimization development debugging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # py-performance-hints

[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![Development Status](https://img.shields.io/badge/status-alpha-orange.svg)](https://pypi.org/project/py-performance-hints/)

Intelligent performance bottleneck detection for Python developers. Get real-time hints about performance anti-patterns in your code during development.

## ๐Ÿš€ Quick Start

### Installation

```bash
pip install py-performance-hints
```

### Basic Usage

```python
from performance_hints import monitor_performance

@monitor_performance
def slow_function():
    import time
    time.sleep(0.15)  # This will trigger a warning
    return "completed"

slow_function()
```

**Output:**

```
[14:32:15] Performance hints for slow_function()
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
โš ๏ธ Slow execution: 151.2ms
  Function 'slow_function' took 151.2ms to execute (threshold: 100.0ms)
  ๐Ÿ’ก Suggestion: Check for inefficient loops or data structures โ€ข Consider optimizing algorithm complexity

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Total execution time: 151.2ms
```

## ๐ŸŽฏ Features (Phase 1)

- **๐Ÿ” Timing Detection**: Automatically detects functions that exceed time thresholds
- **๐ŸŽจ Beautiful Console Output**: Colored, formatted output with clear suggestions
- **โš™๏ธ Configurable**: Customize thresholds and detection patterns
- **๐Ÿชถ Lightweight**: Minimal overhead (< 5% performance impact)
- **๐Ÿ“Š Smart Suggestions**: Context-aware performance improvement tips

## ๐Ÿ“– Usage Examples

### Custom Threshold

```python
@monitor_performance(threshold_ms=50)
def critical_function():
    # Will warn if execution takes > 50ms
    pass
```

### Global Configuration

```python
from performance_hints import configure

configure(
    threshold_ms=75,
    detect_patterns=['timing'],
    report_format='console'
)
```

### Selective Monitoring

```python
# Only monitor in development
@monitor_performance(enabled=DEBUG)
def production_function():
    pass

# Disable for specific functions
@monitor_performance(enabled=False)
def unmonitored_function():
    pass
```

## โš™๏ธ Configuration

### Environment Variables

```bash
export PERFORMANCE_HINTS_ENABLED=true
export PERFORMANCE_HINTS_THRESHOLD_MS=100
export PERFORMANCE_HINTS_PATTERNS=timing
export PERFORMANCE_HINTS_FORMAT=console
```

### Programmatic Configuration

```python
from performance_hints import configure

configure(
    enabled=True,
    threshold_ms=100,
    detect_patterns=['timing'],
    report_format='console'
)
```

## ๐Ÿ› ๏ธ Development Status

**Current Status: Phase 1 (Alpha)**

### โœ… Implemented

- Basic timing detection
- Console reporter with colors
- Configuration system
- Decorator interface

### ๐Ÿšง Coming in Phase 2

- N+1 query detection
- Nested loop analysis
- Memory usage monitoring
- JSON output format
- CI/CD integration

### ๐Ÿ”ฎ Future Phases

- IDE integration
- Performance dashboard
- Machine learning suggestions

## ๐Ÿงช Testing

Run the examples:

```bash
cd examples
python basic_usage.py
```

## ๐Ÿ“ Requirements

- Python 3.8+
- No external dependencies for core functionality

## ๐Ÿค Contributing

This project is in early development. Contributions welcome!

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request

## ๐Ÿ“„ License

MIT License - see LICENSE file for details.

## ๐Ÿ”„ Changelog

### v0.1.0 (Phase 1 - Alpha)

- Initial release
- Basic timing detection
- Console output
- Configuration system
- Decorator interface

---

**Note**: This library is in alpha stage. APIs may change between versions.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "py-performance-hints",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "performance, profiling, optimization, development, debugging",
    "author": null,
    "author_email": "Rajaul Uddin <uddin.rajaul@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e1/40/b012c435f38caf1a106a409508d1f0c5ba5031170dd624ab6b7f410d2f32/py_performance_hints-0.1.0.tar.gz",
    "platform": null,
    "description": "# py-performance-hints\r\n\r\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\r\n[![Development Status](https://img.shields.io/badge/status-alpha-orange.svg)](https://pypi.org/project/py-performance-hints/)\r\n\r\nIntelligent performance bottleneck detection for Python developers. Get real-time hints about performance anti-patterns in your code during development.\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### Installation\r\n\r\n```bash\r\npip install py-performance-hints\r\n```\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom performance_hints import monitor_performance\r\n\r\n@monitor_performance\r\ndef slow_function():\r\n    import time\r\n    time.sleep(0.15)  # This will trigger a warning\r\n    return \"completed\"\r\n\r\nslow_function()\r\n```\r\n\r\n**Output:**\r\n\r\n```\r\n[14:32:15] Performance hints for slow_function()\r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n\u26a0\ufe0f Slow execution: 151.2ms\r\n  Function 'slow_function' took 151.2ms to execute (threshold: 100.0ms)\r\n  \ud83d\udca1 Suggestion: Check for inefficient loops or data structures \u2022 Consider optimizing algorithm complexity\r\n\r\n\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\nTotal execution time: 151.2ms\r\n```\r\n\r\n## \ud83c\udfaf Features (Phase 1)\r\n\r\n- **\ud83d\udd0d Timing Detection**: Automatically detects functions that exceed time thresholds\r\n- **\ud83c\udfa8 Beautiful Console Output**: Colored, formatted output with clear suggestions\r\n- **\u2699\ufe0f Configurable**: Customize thresholds and detection patterns\r\n- **\ud83e\udeb6 Lightweight**: Minimal overhead (< 5% performance impact)\r\n- **\ud83d\udcca Smart Suggestions**: Context-aware performance improvement tips\r\n\r\n## \ud83d\udcd6 Usage Examples\r\n\r\n### Custom Threshold\r\n\r\n```python\r\n@monitor_performance(threshold_ms=50)\r\ndef critical_function():\r\n    # Will warn if execution takes > 50ms\r\n    pass\r\n```\r\n\r\n### Global Configuration\r\n\r\n```python\r\nfrom performance_hints import configure\r\n\r\nconfigure(\r\n    threshold_ms=75,\r\n    detect_patterns=['timing'],\r\n    report_format='console'\r\n)\r\n```\r\n\r\n### Selective Monitoring\r\n\r\n```python\r\n# Only monitor in development\r\n@monitor_performance(enabled=DEBUG)\r\ndef production_function():\r\n    pass\r\n\r\n# Disable for specific functions\r\n@monitor_performance(enabled=False)\r\ndef unmonitored_function():\r\n    pass\r\n```\r\n\r\n## \u2699\ufe0f Configuration\r\n\r\n### Environment Variables\r\n\r\n```bash\r\nexport PERFORMANCE_HINTS_ENABLED=true\r\nexport PERFORMANCE_HINTS_THRESHOLD_MS=100\r\nexport PERFORMANCE_HINTS_PATTERNS=timing\r\nexport PERFORMANCE_HINTS_FORMAT=console\r\n```\r\n\r\n### Programmatic Configuration\r\n\r\n```python\r\nfrom performance_hints import configure\r\n\r\nconfigure(\r\n    enabled=True,\r\n    threshold_ms=100,\r\n    detect_patterns=['timing'],\r\n    report_format='console'\r\n)\r\n```\r\n\r\n## \ud83d\udee0\ufe0f Development Status\r\n\r\n**Current Status: Phase 1 (Alpha)**\r\n\r\n### \u2705 Implemented\r\n\r\n- Basic timing detection\r\n- Console reporter with colors\r\n- Configuration system\r\n- Decorator interface\r\n\r\n### \ud83d\udea7 Coming in Phase 2\r\n\r\n- N+1 query detection\r\n- Nested loop analysis\r\n- Memory usage monitoring\r\n- JSON output format\r\n- CI/CD integration\r\n\r\n### \ud83d\udd2e Future Phases\r\n\r\n- IDE integration\r\n- Performance dashboard\r\n- Machine learning suggestions\r\n\r\n## \ud83e\uddea Testing\r\n\r\nRun the examples:\r\n\r\n```bash\r\ncd examples\r\npython basic_usage.py\r\n```\r\n\r\n## \ud83d\udcdd Requirements\r\n\r\n- Python 3.8+\r\n- No external dependencies for core functionality\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nThis project is in early development. Contributions welcome!\r\n\r\n1. Fork the repository\r\n2. Create a feature branch\r\n3. Make your changes\r\n4. Add tests\r\n5. Submit a pull request\r\n\r\n## \ud83d\udcc4 License\r\n\r\nMIT License - see LICENSE file for details.\r\n\r\n## \ud83d\udd04 Changelog\r\n\r\n### v0.1.0 (Phase 1 - Alpha)\r\n\r\n- Initial release\r\n- Basic timing detection\r\n- Console output\r\n- Configuration system\r\n- Decorator interface\r\n\r\n---\r\n\r\n**Note**: This library is in alpha stage. APIs may change between versions.\r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2025 py-performance-hints\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.",
    "summary": "Intelligent performance bottleneck detection for Python developers",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/yourusername/py-performance-hints",
        "Repository": "https://github.com/yourusername/py-performance-hints"
    },
    "split_keywords": [
        "performance",
        " profiling",
        " optimization",
        " development",
        " debugging"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cd4c263519ddbbfd455312c4d52cb4c8d79611f7a6a1bccb90a6df562661450f",
                "md5": "87ae2ebced134761ea3f46ce1b58af1a",
                "sha256": "09d10db250a0b0dc679d1a1e7e8d7742e027c3a7f8d5bf471376a6b56f82dd49"
            },
            "downloads": -1,
            "filename": "py_performance_hints-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87ae2ebced134761ea3f46ce1b58af1a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 19560,
            "upload_time": "2025-09-14T14:24:28",
            "upload_time_iso_8601": "2025-09-14T14:24:28.745283Z",
            "url": "https://files.pythonhosted.org/packages/cd/4c/263519ddbbfd455312c4d52cb4c8d79611f7a6a1bccb90a6df562661450f/py_performance_hints-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e140b012c435f38caf1a106a409508d1f0c5ba5031170dd624ab6b7f410d2f32",
                "md5": "e4a2592a2d25d3d8a68c59962b6954db",
                "sha256": "491fd2b5eef096a8a75f9c532f99c831da15d43910bbb2f8eecf0a1b112c1315"
            },
            "downloads": -1,
            "filename": "py_performance_hints-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e4a2592a2d25d3d8a68c59962b6954db",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 18968,
            "upload_time": "2025-09-14T14:24:29",
            "upload_time_iso_8601": "2025-09-14T14:24:29.981004Z",
            "url": "https://files.pythonhosted.org/packages/e1/40/b012c435f38caf1a106a409508d1f0c5ba5031170dd624ab6b7f410d2f32/py_performance_hints-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-14 14:24:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "yourusername",
    "github_project": "py-performance-hints",
    "github_not_found": true,
    "lcname": "py-performance-hints"
}
        
Elapsed time: 0.43031s