python-quantumflow 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_quantumflow-2.0.0/PKG-INFO +399 -0
- python_quantumflow-2.0.0/README.md +375 -0
- python_quantumflow-2.0.0/pyproject.toml +15 -0
- python_quantumflow-2.0.0/setup.cfg +4 -0
- python_quantumflow-2.0.0/setup.py +62 -0
- python_quantumflow-2.0.0/src/python_quantumflow.egg-info/PKG-INFO +399 -0
- python_quantumflow-2.0.0/src/python_quantumflow.egg-info/SOURCES.txt +14 -0
- python_quantumflow-2.0.0/src/python_quantumflow.egg-info/dependency_links.txt +1 -0
- python_quantumflow-2.0.0/src/python_quantumflow.egg-info/top_level.txt +1 -0
- python_quantumflow-2.0.0/src/quantumflow/__init__.py +47 -0
- python_quantumflow-2.0.0/src/quantumflow/cli.py +401 -0
- python_quantumflow-2.0.0/src/quantumflow/config.py +189 -0
- python_quantumflow-2.0.0/src/quantumflow/core.py +368 -0
- python_quantumflow-2.0.0/src/quantumflow/execution.py +116 -0
- python_quantumflow-2.0.0/src/quantumflow/metrics.py +168 -0
- python_quantumflow-2.0.0/src/quantumflow/validation.py +77 -0
@@ -0,0 +1,399 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: python-quantumflow
|
3
|
+
Version: 2.0.0
|
4
|
+
Summary: Python QuantumFlow: Advanced type conversion for Python
|
5
|
+
Home-page: https://github.com/magi8101/python-quantumflow
|
6
|
+
Author: Magi Sharma
|
7
|
+
Author-email: magi@example.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
14
|
+
Requires-Python: >=3.7
|
15
|
+
Description-Content-Type: text/markdown
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: requires-python
|
23
|
+
Dynamic: summary
|
24
|
+
|
25
|
+
# ⚛️ Python QuantumFlow 🔄
|
26
|
+
|
27
|
+

|
28
|
+

|
29
|
+

|
30
|
+

|
31
|
+

|
32
|
+
|
33
|
+
✨ A next-generation type-and-data-flow framework for Python with a lightweight footprint. 🚀
|
34
|
+
|
35
|
+
## 🌟 Overview
|
36
|
+
|
37
|
+
🔮 Python QuantumFlow is a powerful yet lightweight framework that enhances Python's data flow capabilities with:
|
38
|
+
|
39
|
+
- 🔄 Automatic type conversion with `flow()` and `TypeFlowContext`
|
40
|
+
- 🧩 Function decorators for creating intelligent flows with `@qflow`
|
41
|
+
- ⚡ Asynchronous operations with `@async_flow`
|
42
|
+
- 🛡️ Robust error handling with retry logic
|
43
|
+
- 🎨 Beautiful terminal output with color and styling
|
44
|
+
- 📊 Visualization of data flows
|
45
|
+
- 🔁 ETL pipeline creation and orchestration
|
46
|
+
- 🧪 Advanced testing support for flow validation
|
47
|
+
- 📈 Performance monitoring and optimization tools
|
48
|
+
- 🔍 Debugging and introspection capabilities
|
49
|
+
- 🌐 Distributed computing integration
|
50
|
+
|
51
|
+
## 🚀 What's New in Version 2.0
|
52
|
+
|
53
|
+
Python QuantumFlow 2.0 represents a major evolution from the original python-typeflow, with significant improvements:
|
54
|
+
|
55
|
+
### Key Enhancements
|
56
|
+
|
57
|
+
- ⚡ **Performance Boost**: Up to 3x faster type conversions and flow execution
|
58
|
+
- 🧠 **Smarter Type Inference**: Improved algorithm for detecting and converting complex nested types
|
59
|
+
- 🔄 **Flow Composition**: Chain and combine flows with intuitive operators
|
60
|
+
- 🌐 **Extended Ecosystem**: New integrations with popular data science and ML frameworks
|
61
|
+
- 🧪 **Enhanced Testing Tools**: Built-in utilities for testing flows and mocking data sources
|
62
|
+
|
63
|
+
### Version Comparison
|
64
|
+
|
65
|
+
| Feature | Version 1.x | Version 2.x |
|
66
|
+
| ---------------- | ----------------- | ---------------------------------- | --- |
|
67
|
+
| Type Conversion | Basic types only | Complex nested structures |
|
68
|
+
| Error Handling | Manual try/except | Automatic with @retry |
|
69
|
+
| Async Support | Limited | Full async/await with backpressure |
|
70
|
+
| Flow Composition | Manual chaining | Operator-based (`>>`, `+`, ` | `) |
|
71
|
+
| Memory Usage | Moderate | Optimized with streaming support |
|
72
|
+
| Visualization | None | Interactive flow diagrams |
|
73
|
+
| CLI Tools | None | Complete development toolkit |
|
74
|
+
|
75
|
+
### Migration from v1.x
|
76
|
+
|
77
|
+
Upgrading from python-typeflow 1.x to Python QuantumFlow 2.x is straightforward:
|
78
|
+
|
79
|
+
```python
|
80
|
+
# Old way (python-typeflow 1.x)
|
81
|
+
from python_typeflow import convert_type, apply_flow
|
82
|
+
|
83
|
+
result = apply_flow(data, convert_type(str))
|
84
|
+
|
85
|
+
# New way (Python QuantumFlow 2.x)
|
86
|
+
from python_quantumflow.core import flow
|
87
|
+
|
88
|
+
result = flow(lambda x: str(x))(data)
|
89
|
+
# or even simpler
|
90
|
+
result = flow(str)(data)
|
91
|
+
```
|
92
|
+
|
93
|
+
<details>
|
94
|
+
<summary>📚 Complete migration guide</summary>
|
95
|
+
|
96
|
+
For a complete guide to migrating your code from python-typeflow 1.x to Python QuantumFlow 2.x,
|
97
|
+
see our [Migration Guide](https://docs.quantumflow.dev/migration).
|
98
|
+
|
99
|
+
Key differences:
|
100
|
+
|
101
|
+
- Decorator syntax changes
|
102
|
+
- New context manager approach
|
103
|
+
- Enhanced error handling
|
104
|
+
- Parallel and distributed execution options
|
105
|
+
|
106
|
+
</details>
|
107
|
+
|
108
|
+
## 📦 Installation
|
109
|
+
|
110
|
+
```bash
|
111
|
+
# Install core package
|
112
|
+
pip install python-quantumflow
|
113
|
+
|
114
|
+
# Install with additional features
|
115
|
+
pip install python-quantumflow[viz] # Visualization features
|
116
|
+
pip install python-quantumflow[async] # Enhanced async capabilities
|
117
|
+
pip install python-quantumflow[ml] # Machine learning integrations
|
118
|
+
pip install python-quantumflow[full] # All features
|
119
|
+
```
|
120
|
+
|
121
|
+
## 🚀 Quick Start
|
122
|
+
|
123
|
+
### Basic Type Flow
|
124
|
+
|
125
|
+
```python
|
126
|
+
from python_quantumflow.core import flow, with_typeflow as TypeFlowContext
|
127
|
+
|
128
|
+
# Create a list of numbers
|
129
|
+
numbers = [1, 2, 3, 4, 5]
|
130
|
+
|
131
|
+
# Convert types using flow
|
132
|
+
numbers_str = flow(lambda x: str(x))(numbers)
|
133
|
+
sum_str = flow(lambda x: str(x))(sum(numbers))
|
134
|
+
|
135
|
+
# Combine the results
|
136
|
+
result = f"{numbers_str} items with sum: {sum_str}"
|
137
|
+
print(result)
|
138
|
+
```
|
139
|
+
|
140
|
+
<details>
|
141
|
+
<summary>👉 Click to see output</summary>
|
142
|
+
|
143
|
+
```
|
144
|
+
[1, 2, 3, 4, 5] items with sum: 15
|
145
|
+
```
|
146
|
+
|
147
|
+
</details>
|
148
|
+
|
149
|
+
### Function Flows with @qflow
|
150
|
+
|
151
|
+
```python
|
152
|
+
from python_quantumflow.core import qflow
|
153
|
+
|
154
|
+
@qflow
|
155
|
+
def process_data(items):
|
156
|
+
"""Process a list of items by doubling each value."""
|
157
|
+
return [item * 2 for item in items]
|
158
|
+
|
159
|
+
data = [5, 10, 15, 20, 25]
|
160
|
+
result = process_data(data)
|
161
|
+
print(f"Processed data: {result}")
|
162
|
+
```
|
163
|
+
|
164
|
+
<details>
|
165
|
+
<summary>👉 Click to see output</summary>
|
166
|
+
|
167
|
+
```
|
168
|
+
Processed data: [10, 20, 30, 40, 50]
|
169
|
+
```
|
170
|
+
|
171
|
+
</details>
|
172
|
+
|
173
|
+
### Async Flow with Retry
|
174
|
+
|
175
|
+
```python
|
176
|
+
import asyncio
|
177
|
+
from python_quantumflow.core import async_flow, retry, fancy_print
|
178
|
+
|
179
|
+
@async_flow
|
180
|
+
@retry(max_attempts=3, backoff_factor=0.5)
|
181
|
+
async def fetch_remote_data(url):
|
182
|
+
"""Fetch data from a URL with automatic retry on failure."""
|
183
|
+
await asyncio.sleep(0.2) # Simulate network delay
|
184
|
+
|
185
|
+
# Your network request logic here
|
186
|
+
return f"Data from {url}"
|
187
|
+
|
188
|
+
async def main():
|
189
|
+
urls = ["https://api.example.com/data/1", "https://api.example.com/data/2"]
|
190
|
+
tasks = [fetch_remote_data(url) for url in urls]
|
191
|
+
results = await asyncio.gather(*tasks, return_exceptions=True)
|
192
|
+
|
193
|
+
# Process results
|
194
|
+
for url, result in zip(urls, results):
|
195
|
+
if isinstance(result, Exception):
|
196
|
+
fancy_print(f"Failed to fetch {url}: {result}", style="red")
|
197
|
+
else:
|
198
|
+
fancy_print(f"Success: {result}", style="green")
|
199
|
+
|
200
|
+
if __name__ == "__main__":
|
201
|
+
asyncio.run(main())
|
202
|
+
```
|
203
|
+
|
204
|
+
<details>
|
205
|
+
<summary>👉 Click to see output</summary>
|
206
|
+
|
207
|
+
```
|
208
|
+
Success: Data from https://api.example.com/data/1
|
209
|
+
Success: Data from https://api.example.com/data/2
|
210
|
+
```
|
211
|
+
|
212
|
+
With failures (when network errors occur):
|
213
|
+
|
214
|
+
```
|
215
|
+
Request to https://api.example.com/data/1 failed, retrying...
|
216
|
+
Failed to fetch https://api.example.com/data/1: Failed to connect
|
217
|
+
Success: Data from https://api.example.com/data/2
|
218
|
+
```
|
219
|
+
|
220
|
+
</details>
|
221
|
+
|
222
|
+
### Color and Styling
|
223
|
+
|
224
|
+
```python
|
225
|
+
from python_quantumflow.core import fancy_print
|
226
|
+
|
227
|
+
# Styled output with explicit styling
|
228
|
+
fancy_print("Error: Connection failed", style="bold red")
|
229
|
+
fancy_print("Success: Operation completed", style="bold green")
|
230
|
+
fancy_print("Info: Processing data", style="cyan")
|
231
|
+
|
232
|
+
# Auto-styled output based on content
|
233
|
+
fancy_print("Error: This will be red automatically")
|
234
|
+
fancy_print("Success! This will be green automatically")
|
235
|
+
fancy_print("Warning: This will be yellow automatically")
|
236
|
+
```
|
237
|
+
|
238
|
+
<details>
|
239
|
+
<summary>👉 Click to see output</summary>
|
240
|
+
|
241
|
+

|
242
|
+
|
243
|
+
_Note: Colors shown will vary based on your terminal_
|
244
|
+
|
245
|
+
</details>
|
246
|
+
|
247
|
+
### ETL Pipeline Example
|
248
|
+
|
249
|
+
```python
|
250
|
+
from python_quantumflow.core import qflow, fancy_print
|
251
|
+
|
252
|
+
@qflow
|
253
|
+
def extract(source):
|
254
|
+
"""Extract data from a source."""
|
255
|
+
fancy_print(f"Extracting from {source}...", style="dim")
|
256
|
+
return [1, 2, 3, 4, 5]
|
257
|
+
|
258
|
+
@qflow
|
259
|
+
def transform(data):
|
260
|
+
"""Transform the raw data."""
|
261
|
+
fancy_print(f"Transforming {data}...", style="dim")
|
262
|
+
return [item * 2 for item in data]
|
263
|
+
|
264
|
+
@qflow
|
265
|
+
def load(transformed_data):
|
266
|
+
"""Load the transformed data."""
|
267
|
+
fancy_print(f"Loading {transformed_data}...", style="dim")
|
268
|
+
return f"Loaded {len(transformed_data)} items"
|
269
|
+
|
270
|
+
@qflow
|
271
|
+
def etl_pipeline(source):
|
272
|
+
"""Complete ETL pipeline."""
|
273
|
+
raw_data = extract(source)
|
274
|
+
transformed_data = transform(raw_data)
|
275
|
+
result = load(transformed_data)
|
276
|
+
return result
|
277
|
+
|
278
|
+
result = etl_pipeline("database://example/table1")
|
279
|
+
fancy_print(f"Pipeline result: {result}", style="bold green")
|
280
|
+
```
|
281
|
+
|
282
|
+
<details>
|
283
|
+
<summary>👉 Click to see output</summary>
|
284
|
+
|
285
|
+
```
|
286
|
+
Extracting from database://example/table1...
|
287
|
+
Transforming [1, 2, 3, 4, 5]...
|
288
|
+
Loading [2, 4, 6, 8, 10]...
|
289
|
+
Pipeline result: Loaded 5 items
|
290
|
+
```
|
291
|
+
|
292
|
+
</details>
|
293
|
+
|
294
|
+
## 🧰 Key Components
|
295
|
+
|
296
|
+
- **Core Flow Functions**:
|
297
|
+
|
298
|
+
- `flow()`: Wraps objects for type conversion
|
299
|
+
- `TypeFlowContext`: Context for automatic type conversion
|
300
|
+
- `qflow`: Decorator for creating flow functions
|
301
|
+
- `async_flow`: Decorator for asynchronous flows
|
302
|
+
|
303
|
+
- **Error Handling**:
|
304
|
+
|
305
|
+
- `retry`: Decorator for automatic retry on failure
|
306
|
+
- Exception handling within flows
|
307
|
+
|
308
|
+
- **Terminal Enhancements**:
|
309
|
+
- `fancy_print`: Rich terminal output with colors and styles
|
310
|
+
- Auto-styling based on message content
|
311
|
+
- Progress indicators and animations
|
312
|
+
|
313
|
+
## 🖥️ Command Line Interface
|
314
|
+
|
315
|
+
Python QuantumFlow includes a CLI for rapid development and learning:
|
316
|
+
|
317
|
+
```bash
|
318
|
+
# Start interactive playground
|
319
|
+
pqflow play
|
320
|
+
|
321
|
+
# Start guided tutorial
|
322
|
+
pqflow tutor
|
323
|
+
|
324
|
+
# Generate documentation for flows
|
325
|
+
pqflow autodoc your_module
|
326
|
+
|
327
|
+
# Run a flow
|
328
|
+
pqflow run your_module.your_flow --input data.json
|
329
|
+
|
330
|
+
# Visualize a flow
|
331
|
+
pqflow visualize your_module.your_flow --output flow.png
|
332
|
+
|
333
|
+
# Create a new Python QuantumFlow project
|
334
|
+
pqflow init my_project
|
335
|
+
|
336
|
+
# View performance metrics for flows
|
337
|
+
pqflow metrics your_module.your_flow
|
338
|
+
|
339
|
+
# Run flow with default colorized output
|
340
|
+
pqflow run --color your_module.your_flow
|
341
|
+
|
342
|
+
# Apply type conversions to a JSON file
|
343
|
+
pqflow convert input.json output.json --schema schema.json
|
344
|
+
|
345
|
+
# Start a web dashboard for monitoring flows
|
346
|
+
pqflow dashboard --port 8080
|
347
|
+
|
348
|
+
# Generate sample code from templates
|
349
|
+
pqflow generate etl --name data_pipeline
|
350
|
+
|
351
|
+
# Benchmark flow performance
|
352
|
+
pqflow benchmark your_module.your_flow --iterations 1000
|
353
|
+
```
|
354
|
+
|
355
|
+
<details>
|
356
|
+
<summary>👉 Click to see CLI in action</summary>
|
357
|
+
|
358
|
+

|
359
|
+
|
360
|
+
_The Python QuantumFlow CLI provides a fun, interactive way to learn and use the framework._
|
361
|
+
|
362
|
+
</details>
|
363
|
+
|
364
|
+
## 🔬 Advanced Features
|
365
|
+
|
366
|
+
- **📊 Metrics and Observability**: Monitor and track flow execution
|
367
|
+
- **✅ Validation**: Validate flow inputs and outputs
|
368
|
+
- **⚙️ Execution Backends**: Run flows in different execution contexts (threads, processes, distributed)
|
369
|
+
|
370
|
+
## 📊 Performance
|
371
|
+
|
372
|
+
Python QuantumFlow is optimized for both performance and flexibility.
|
373
|
+
|
374
|
+
| Feature | Performance | Memory Usage | Quantum Awesomeness |
|
375
|
+
| ---------------- | ----------- | ------------ | ------------------- |
|
376
|
+
| Type Conversion | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ |
|
377
|
+
| Flow Execution | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
|
378
|
+
| Async Operations | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
|
379
|
+
| Fancy Output | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
|
380
|
+
|
381
|
+
## 🧠 Why Python QuantumFlow?
|
382
|
+
|
383
|
+
- **Lightweight**: Minimal dependencies, small footprint
|
384
|
+
- **Intuitive**: Simple API with powerful capabilities
|
385
|
+
- **Flexible**: Works with your existing code
|
386
|
+
- **Pretty**: Makes your terminal output gorgeous
|
387
|
+
- **Fast**: Optimized for performance
|
388
|
+
|
389
|
+
## 🙌 Created By
|
390
|
+
|
391
|
+
<img src="https://github.com/magi8101.png" width="70" style="border-radius: 50%;" align="left" alt="Magi Sharma"/>
|
392
|
+
|
393
|
+
**[Magi Sharma](https://github.com/magi8101/python-quantumflow)**<br>
|
394
|
+
_Quantum-entangled code enthusiast_<br>
|
395
|
+
Version: 0.6.1
|
396
|
+
|
397
|
+
---
|
398
|
+
|
399
|
+
<p align="center">Made with ❤️ and a sprinkle of quantum magic</p>
|