Metadata-Version: 2.4
Name: wisetimer
Version: 1.0.0
Summary: Smart timer whith limits, code comparison and analysis
Home-page: https://github.com/AndreyProgramMaker/wisetimer
Author: Andrey Egupov (11-year-old-developer)
License: MIT
Keywords: timer,benchmark,performance
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# ⏱️ WiseTimer - Smart Timer from 11-Year-Old Developer

![Python](https://img.shields.io/badge/python-3.6%2B-blue)
![License](https://img.shields.io/badge/license-MIT-green)
![Status](https://img.shields.io/badge/status-beta-orange)
![GitHub stars](https://img.shields.io/github/stars/AndreyProgramMaker/-wisetimer)

Smart timer with limits, benchmarking, code comparison, and performance analysis.

## ✨ Features
✅All-in-one solution - multiple tools in one package  
✅No dependencies - uses only Python standard libraries  
✅For everyone - suitable for both beginners and advanced developers  
✅Multiple usage methods - methods, context managers, decorators, limits  
✅Beautiful output with emojis 😊  
✅Smart advice through AST analysis  
✅Very simple API - easy to learn and use  
✅Clear error messages - human-readable with solutions  

## 📦 Installation
'''bash
pip install wisetimer'''

## 🚀 Quick Start
'''python
from wisetimer import Timer
from wisetimer import Analyze
from wisetimer import Benchmark  
import time
timer = Timer()
a = Analyze()

# Basic timer

print(timer.done())
print("Hello wisetimer!") 
print(timer.done())

# Context manager for benchmarking

with Timer() as t:
    x = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0 

# Decorator for function timing

@Timer.funcTimer 
def example():
    return "Hello world!"
result = example()
print(result)

# Benchmark comparison

with Benchmark("a"):
    print("Hello wisetimer!")

with Benchmark("b"):
    print("Hello wisetimer!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
Benchmark().compar()
Benchmark().reset()
with Benchmark("c"):
    print("Hello wisetimer")
with Benchmark("d"):
    print("Hello wisetimer!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
Benchmark().compar()

# Time limits

timer2 = Timer()
timer2.limit(0.1)# Set 0.1 second limit
for x in range(5):
    time.sleep(0.001)
    timer2.limitRevise()
    print("✅Limit revise = OK")

# Code analysis

code = code = '''a = "aaaaaaaaa"
b = "bbbbbbbbbb"
x = 1
z = []
for i in range(10):
    y = 0
    z = z.append(i)
    y = 0 + 1
    a += "b"
if x == 3:
    print(x+x+x+x)
    if x == 3:
        print("")
        if x == 2:
            print("1")
elif x == 2:
    print(x+x+x)
def x():
    import time
x()
class X():
    def __init__(self):
        for z in range(1):
            self.y = 0
z = 5
while z > 3:
    z -= 1
if x == 2:
    print(x+x+x)
elif x == 5:
    print("WOW!")
elif x == 5:
    print("WOW!")'''
analyzer = Analyze()
analyzer.code(code)'''  

## 📃 Detailed Documentation

### Timer Class

Timer is the base class containing all timer functions.

#### Import

'''python
from wisetimer imoprt Timer'''

#### Timer Methods

Timer.done() - automatically starts/stops timer

'''python
timer = Timer()
print(timer.done())      # Start
print("Your code")       # Your code here
print(timer.done())      # Stop and get time'''

Timer().start()/Timer().done("start") - starts the timer

Timer().stop()/Timer.finish()/Timer.end()/Timer().done("stop/end/fiish") - stops the timer

Timer().lap()/Timer().done("lap") - creates a checkpoint without stopping

Timer().status()/Timer().done("status") - returns timer status

Timer().reset()/Timer().done("reset") - stops and resets the timer

'''python
timer = Timer()
print(timer.start())    # ✅Timer started!
x = 1234567890
print(timer.lap())      # 🚩Checkpoint at ... sec.
print(x \* 100)
print(timer.done())     # ⏰Timer stopped...
print(timer.reset())    # ✅Timer reset!
print(timer.done())     # Start again
print("Hi!")
print(timer.status())   # ✔️Timer running...
print(timer.end())      # ⏰Timer stopped...'''

Timer().limit(seconds) - sets execution time limit and starts counting

Timer().limitRevise() - checks if limit is exceeded

'''python
timer = Timer()
timer.limit(0.1)
for x in range(5):
    time.sleep(0.001)
    timer.limitRevise()'''

@Timer.funcTimer - decorator for timing functions

'''python
@Timer.funcTimer
def example():
    return "Hello!"
result = example()
print(result)  #🕒Function 'example' executed in ... sec.'''

Context Manager - simple benchmark with with statement

'''python
with Timer() as t:
    x = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 0'''

### Benchmark Class

Benchmark class for creating and comparing named benchmarks.

#### Benchmark Methods

Benchmark("name") - named benchmark (default name is "_")

Benchmark().compar() - compares benchmark execution times

Benchmark().reset() - clears benchmark data

'''python
with Benchmark("a"):
    print("Hello wisetimer!")
with Benchmark("b"):
    print("Hello wisetimer!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
Benchmark().compar() # Shows fastest and slowest
Benchmark().reset() # ✅Benchmarks reset!
with Benchmark("c"):
    print("Hello wisetimer")
with Benchmark("d"):
    print("Hello wisetimer!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
Benchmark().compar() # Shows fastest and slowest'''

### Analyze Class

Analyze class for code performance analysis and optimization advice.

#### Analyze Methods

Analyze().checkpoint() - sets checkpoints for speed analysis (minimum 4 checkpoints required)

Analyze().getAdvice() - provides performance patterns based on checkpoints

'''python
timer = Timer()
timer.start()
for x in range(10):
    print(x)
    Analyze().checkpoint()
Analyze().getAdvice()'''

Analyze().code('''Your code''') - analyzes code for performance issues using AST and gives optimization advice

'''python
code = '''

for i in range(1000):
    result = \[]
    result.append(i \* 2)
'''
analyzer = Analyze()
analyzer.code(code)'''

## 😮Error explanation

All errors are understandable toa personand contain an explanationand solution to it



## 📊Сравнение с аналогами 

| Feature | wisetimer |	time.time() | cProfile | timeit |
|---------|-----------|-------------|----------|--------|
| Ease of use | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐ | ⭐⭐ |
| Precision | nanoseconds | seconds | nanoseconds | nanoseconds |
| AST analysis | ✅ | ❌ | ✅ | ❌ |
| Optimization advice | ✅ | ❌ | ❌ | ❌ |
| Clear error messages | ✅ | ❌ | ❌ | ❌ |
| Time limits | ✅ | ❌ | ❌ | ❌ |


## 👦🏻About the Developer

My name is Andrey Egupov, I'm 11 years old. I've been programming for several years. Started with Scratch, now I write in Python and JavaScript.

The idea for this library didn't come out of nowhere. I wanted to create something truly useful, spent a long time asking AI assistants what libraries Python was missing. But I eventually found a suitable one. The wisetimer library not only measures time like regular timer libraries do, but also gives optimization advice. It's very simple and suitable for everyone - both beginners and advanced developers due to its simple interface and system accuracy.

During development I learned a lot - from what optimization advice to give for code performance improvement, to benchmarking and decorators.

In the future I plan to develop my library: I'll add more unique advice, progress bars, and much more.

## 📄 License

This project is distributed under the MIT license. For more details see the LICENSE file.


\*Created by Andrey Egupov - 11-year-old developer 👦🏻

AI assistant helped with publication and development stages.

If you liked this project, please give it ⭐(a star) on GitHub\*



