Skip to content

Commit 1cdae04

Browse files
committed
feat : Updated readme.md
1 parent eb85f60 commit 1cdae04

1 file changed

Lines changed: 123 additions & 2 deletions

File tree

README.md

Lines changed: 123 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,123 @@
1-
# python-decorators-generators
2-
A collection of reusable, production-ready Python decorators and generators. Includes examples like logging, retries, caching, and more — all built following Python best practices.
1+
# Python Decorators & Generators
2+
3+
A curated collection of production-ready, reusable Python decorators and generators — crafted using modern Python best practices.
4+
5+
This package includes:
6+
7+
- ✅ Common decorators like logging, retrying, caching, and timing
8+
- ✅ Generators for streaming data, infinite sequences, and efficient file processing
9+
- ✅ Unit tests and GitHub Actions CI
10+
- ✅ Editable install via `pyproject.toml` for clean imports
11+
12+
---
13+
14+
## 📦 Installation (Editable Mode)
15+
16+
Make sure you have Python 3.8+ and `pip`:
17+
18+
```bash
19+
git clone https://github.com/your-username/python-decorators-generators.git
20+
```
21+
22+
```bash
23+
cd python-decorators-generators
24+
```
25+
26+
```bash
27+
pip install -e .
28+
```
29+
30+
✅ Decorators Included
31+
Decorator Description
32+
log_execution Logs function calls, arguments, return values, execution time, and exceptions
33+
retry_on_exception Retries a function on failure, with configurable retry count and delay
34+
cache_result In-memory caching with TTL support
35+
time_execution Logs how long a function takes to run
36+
37+
## 📂 Project Structure
38+
39+
```bash
40+
python-decorators-generators/
41+
├── decorators/
42+
│ ├── logging*decorator.py
43+
│ ├── retry_decorator.py
44+
│ ├── cache_decorator.py
45+
│ └── time_decorator.py
46+
47+
├── generators/
48+
│ ├── fibonacci.py
49+
│ ├── file_chunker.py
50+
│ └── tail_reader.py
51+
52+
├── examples/
53+
│ └── demo*<name>.py
54+
55+
├── tests/
56+
│ └── test\_<name>.py
57+
58+
├── pyproject.toml
59+
├── requirements.txt
60+
└── README.md
61+
```
62+
63+
---
64+
65+
### ✅ Decorators Included
66+
67+
| Decorator | Module | Description |
68+
| -------------------- | ------------------------------ | ------------------------------------------------------------------------- |
69+
| `log_execution` | `decorators.logging_decorator` | Logs function calls, arguments, return values, execution time, and errors |
70+
| `retry_on_exception` | `decorators.retry_decorator` | Retries a function on failure, with customizable retry count and delay |
71+
| `cache_result` | `decorators.cache_decorator` | In-memory caching with configurable TTL |
72+
| `time_execution` | `decorators.time_decorator` | Logs how long a function takes to run |
73+
74+
---
75+
76+
### 🔁 Generators Included
77+
78+
| Generator | Module | Description |
79+
| ---------------- | ------------------------- | ------------------------------------------------------------- |
80+
| `fibonacci()` | `generators.fibonacci` | Infinite lazy sequence of Fibonacci numbers |
81+
| `file_chunker()` | `generators.file_chunker` | Reads large files in fixed-size chunks using lazy loading |
82+
| `tail_reader()` | `generators.tail_reader` | Mimics `tail -f` to stream new lines from a file in real-time |
83+
84+
---
85+
86+
### 🧪 Run Tests
87+
88+
Install dependencies:
89+
90+
```bash
91+
pip install -r requirements.txt
92+
```
93+
94+
Then run:
95+
96+
```bash
97+
pytest tests/
98+
```
99+
100+
---
101+
102+
## 🚀 CI/CD with GitHub Actions
103+
104+
This project includes a CI pipeline that runs on every push and PR to main, defined in .github/workflows/python-tests.yml.
105+
🧠 Why This Repo?
106+
107+
This repository is ideal for:
108+
109+
- Engineers who want reusable decorator utilities
110+
111+
- Data engineers working with large files or streams
112+
113+
- Anyone who wants to understand Python’s advanced features through real code
114+
115+
---
116+
117+
## 📬 Contributions
118+
119+
Feel free to fork this project, add more utilities (e.g., memoization, rate-limiting), or improve tests and documentation.
120+
121+
---
122+
123+
Let me know if you'd like a corresponding `pyproject.toml` now, or a downloadable `.zip` with the full folder setup.

0 commit comments

Comments
 (0)