Name | mtaio JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | A comprehensive framework for asynchronous I/O operations and utilities. |
upload_time | 2024-11-24 01:55:58 |
maintainer | None |
docs_url | None |
author | t3tra |
requires_python | >=3.11 |
license | MIT License Copyright (c) 2024-present t3tra 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 |
python
framework
utilitiy
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[[Japanese/日本語](README.ja.md)]
# `mtaio` - Multi-threaded Async I/O Framework
#### !! `It works on Python3.11+` !!
`mtaio` is a comprehensive asynchronous I/O framework for Python, providing high-level abstractions for building efficient concurrent applications.
## Features
- **Asynchronous Core**
- Task execution with concurrency control
- Flexible queue implementations (Priority, LIFO)
- Latch synchronization primitive
- **Caching**
- TTL-based caching with multiple eviction policies (LRU, LFU, FIFO)
- Distributed cache with node replication
- Automatic cache cleanup and monitoring
- **Data Processing**
- Observable pattern for reactive data handling
- Pipeline processing with customizable stages
- Stream processing with operators
- **Event Handling**
- Asynchronous event emitter with priority support
- Channel-based communication
- Pub/sub pattern implementation
- **Protocol Support**
- ASGI application framework
- MQTT client implementation
- Async IMAP and SMTP clients
- **Resource Management**
- Rate limiting with token bucket algorithm
- Concurrency limiting
- Timeout management
- Resource monitoring
## Installation
```bash
pip install mtaio
```
## Quick Start
Here's a simple example that demonstrates some core features:
```python
from mtaio import TaskExecutor, RateLimiter, TimeoutManager
async def main():
# Create a rate-limited task executor
executor = TaskExecutor()
limiter = RateLimiter(rate=10.0) # 10 operations per second
@limiter.limit
async def process_item(item):
# Process with timeout
async with TimeoutManager(5.0) as tm:
result = await tm.run(some_operation(item))
return result
# Process multiple items concurrently
items = range(100)
results = await executor.map(process_item, items, limit=5)
if __name__ == "__main__":
asyncio.run(main())
```
## Documentation
### Core Components
#### `TaskExecutor`
The `TaskExecutor` provides methods for executing coroutines with concurrency control:
```python
from mtaio import TaskExecutor
async def example():
executor = TaskExecutor()
# Run multiple coroutines with concurrency limit
results = await executor.gather(
coro1(),
coro2(),
limit=5
)
```
#### Caching
`mtaio` provides flexible caching solutions:
```python
from mtaio.cache import TTLCache, DistributedCache
async def cache_example():
# Simple TTL cache
cache = TTLCache[str](
default_ttl=60.0,
max_size=1000
)
# Distributed cache
dist_cache = DistributedCache[str](
nodes=[
('localhost', 5000),
('localhost', 5001)
]
)
```
#### Event Handling
The event system supports prioritized event handling:
```python
from mtaio.events import EventEmitter
async def event_example():
emitter = EventEmitter()
@emitter.on("user_login")
async def handle_login(event):
user = event.data
print(f"User {user.name} logged in")
await emitter.emit("user_login", user_data)
```
### Advanced Features
#### Resource Management
Control resource usage with rate limiting and timeouts:
```python
from mtaio.resources import ResourceLimiter
async def resource_example():
limiter = ResourceLimiter(
rate=10.0, # 10 requests per second
concurrency=5 # Max 5 concurrent executions
)
@limiter.limit
async def limited_operation():
await process_request()
```
#### Monitoring
Monitor system resources and application performance:
```python
from mtaio.monitoring import ResourceMonitor
async def monitor_example():
monitor = ResourceMonitor()
@monitor.on_threshold_exceeded
async def handle_alert(metric, value, threshold):
print(f"Alert: {metric} exceeded threshold")
await monitor.start()
```
## Contributing
We welcome contributions! Please follow these steps to contribute:
1. Fork the repository: [github.com/t3tra-dev/mtaio](https://github.com/mtaio/pyinit).
2. Create a feature branch: `git checkout -b feat/your-feature`.
3. Commit your changes: `git commit -m 'Add a new feature'`.
4. Push to the branch: `git push origin feat/your-feature`.
5. Open a Pull Request.
For any questions or support, feel free to open an issue in the repository's [Issues section](https://github.com/t3tra-dev/mtaio/issues).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "mtaio",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "python, framework, utilitiy",
"author": "t3tra",
"author_email": "t3tra <admin@t3ra.net>",
"download_url": "https://files.pythonhosted.org/packages/c7/b7/ff4131ce7adfa18f946590693e9f72a589e38b651b709faf90c2bd22ed51/mtaio-0.1.0.tar.gz",
"platform": null,
"description": "[[Japanese/\u65e5\u672c\u8a9e](README.ja.md)]\n\n# `mtaio` - Multi-threaded Async I/O Framework\n\n#### !! `It works on Python3.11+` !!\n\n`mtaio` is a comprehensive asynchronous I/O framework for Python, providing high-level abstractions for building efficient concurrent applications.\n\n## Features\n\n- **Asynchronous Core**\n - Task execution with concurrency control\n - Flexible queue implementations (Priority, LIFO)\n - Latch synchronization primitive\n\n- **Caching**\n - TTL-based caching with multiple eviction policies (LRU, LFU, FIFO)\n - Distributed cache with node replication\n - Automatic cache cleanup and monitoring\n\n- **Data Processing**\n - Observable pattern for reactive data handling\n - Pipeline processing with customizable stages\n - Stream processing with operators\n\n- **Event Handling**\n - Asynchronous event emitter with priority support\n - Channel-based communication\n - Pub/sub pattern implementation\n\n- **Protocol Support**\n - ASGI application framework\n - MQTT client implementation\n - Async IMAP and SMTP clients\n\n- **Resource Management**\n - Rate limiting with token bucket algorithm\n - Concurrency limiting\n - Timeout management\n - Resource monitoring\n\n## Installation\n\n```bash\npip install mtaio\n```\n\n## Quick Start\n\nHere's a simple example that demonstrates some core features:\n\n```python\nfrom mtaio import TaskExecutor, RateLimiter, TimeoutManager\n\nasync def main():\n # Create a rate-limited task executor\n executor = TaskExecutor()\n limiter = RateLimiter(rate=10.0) # 10 operations per second\n\n @limiter.limit\n async def process_item(item):\n # Process with timeout\n async with TimeoutManager(5.0) as tm:\n result = await tm.run(some_operation(item))\n return result\n\n # Process multiple items concurrently\n items = range(100)\n results = await executor.map(process_item, items, limit=5)\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\n## Documentation\n\n### Core Components\n\n#### `TaskExecutor`\n\nThe `TaskExecutor` provides methods for executing coroutines with concurrency control:\n\n```python\nfrom mtaio import TaskExecutor\n\nasync def example():\n executor = TaskExecutor()\n \n # Run multiple coroutines with concurrency limit\n results = await executor.gather(\n coro1(),\n coro2(),\n limit=5\n )\n```\n\n#### Caching\n\n`mtaio` provides flexible caching solutions:\n\n```python\nfrom mtaio.cache import TTLCache, DistributedCache\n\nasync def cache_example():\n # Simple TTL cache\n cache = TTLCache[str](\n default_ttl=60.0,\n max_size=1000\n )\n \n # Distributed cache\n dist_cache = DistributedCache[str](\n nodes=[\n ('localhost', 5000),\n ('localhost', 5001)\n ]\n )\n```\n\n#### Event Handling\n\nThe event system supports prioritized event handling:\n\n```python\nfrom mtaio.events import EventEmitter\n\nasync def event_example():\n emitter = EventEmitter()\n\n @emitter.on(\"user_login\")\n async def handle_login(event):\n user = event.data\n print(f\"User {user.name} logged in\")\n\n await emitter.emit(\"user_login\", user_data)\n```\n\n### Advanced Features\n\n#### Resource Management\n\nControl resource usage with rate limiting and timeouts:\n\n```python\nfrom mtaio.resources import ResourceLimiter\n\nasync def resource_example():\n limiter = ResourceLimiter(\n rate=10.0, # 10 requests per second\n concurrency=5 # Max 5 concurrent executions\n )\n\n @limiter.limit\n async def limited_operation():\n await process_request()\n```\n\n#### Monitoring\n\nMonitor system resources and application performance:\n\n```python\nfrom mtaio.monitoring import ResourceMonitor\n\nasync def monitor_example():\n monitor = ResourceMonitor()\n\n @monitor.on_threshold_exceeded\n async def handle_alert(metric, value, threshold):\n print(f\"Alert: {metric} exceeded threshold\")\n\n await monitor.start()\n```\n\n## Contributing\n\nWe welcome contributions! Please follow these steps to contribute:\n\n1. Fork the repository: [github.com/t3tra-dev/mtaio](https://github.com/mtaio/pyinit).\n2. Create a feature branch: `git checkout -b feat/your-feature`.\n3. Commit your changes: `git commit -m 'Add a new feature'`.\n4. Push to the branch: `git push origin feat/your-feature`.\n5. Open a Pull Request.\n\nFor any questions or support, feel free to open an issue in the repository's [Issues section](https://github.com/t3tra-dev/mtaio/issues).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024-present t3tra 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.",
"summary": "A comprehensive framework for asynchronous I/O operations and utilities.",
"version": "0.1.0",
"project_urls": {
"Issues": "https://github.com/t3tra-dev/mtaio/issues",
"Repository": "https://github.com/t3tra-dev/mtaio.git"
},
"split_keywords": [
"python",
" framework",
" utilitiy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "39dd62a0e312a6246452a65988fcdde786432e7402fe0e02279b10b8da2ee162",
"md5": "ae37e56d4a0717efaddca543041f2175",
"sha256": "cfa814a09429ed93c04a43fd4cae991cb24bcbdddbdedd7a69be9a082b420396"
},
"downloads": -1,
"filename": "mtaio-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ae37e56d4a0717efaddca543041f2175",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 78749,
"upload_time": "2024-11-24T01:55:57",
"upload_time_iso_8601": "2024-11-24T01:55:57.060342Z",
"url": "https://files.pythonhosted.org/packages/39/dd/62a0e312a6246452a65988fcdde786432e7402fe0e02279b10b8da2ee162/mtaio-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c7b7ff4131ce7adfa18f946590693e9f72a589e38b651b709faf90c2bd22ed51",
"md5": "465e5cda7c3b587f76d3647611625b96",
"sha256": "bfdb4c597f00833ed75b56eb29dd369b5bf0866f298f9c3666e99d07dc4a1372"
},
"downloads": -1,
"filename": "mtaio-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "465e5cda7c3b587f76d3647611625b96",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 66952,
"upload_time": "2024-11-24T01:55:58",
"upload_time_iso_8601": "2024-11-24T01:55:58.425989Z",
"url": "https://files.pythonhosted.org/packages/c7/b7/ff4131ce7adfa18f946590693e9f72a589e38b651b709faf90c2bd22ed51/mtaio-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-24 01:55:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "t3tra-dev",
"github_project": "mtaio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "mtaio"
}