Name | tailli JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | Python client for Tailli API key management and usage tracking |
upload_time | 2024-11-11 10:56:23 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2024 Tailli 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 |
api
async
authentication
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Tailli API Client
A high-performance Python client for Tailli API key management and usage tracking. This client provides easy-to-use async interfaces with built-in caching and background usage recording for optimal performance - track consumption accurately without adding latency to your APIs.
## Features
- 🚀 Asynchronous API with proper connection management
- 💾 Local caching of API key validation
- 🔄 Background usage recording with automatic retries
- ⚡ Low-latency operations prioritizing your application's performance
- 🛡️ Type-safe with full typing support
## Installation
```bash
pip install tailli
```
## Quick Start
```python
from tailli import TailliClient
async def main():
async with TailliClient() as client:
# Validate an API key and use it in a session
api_key = "your-api-key"
try:
async with client.validated_session(api_key):
# Your API calls here
await client.record_usage(api_key, 5)
except InvalidApiKeyError:
print("Invalid API key")
if __name__ == "__main__":
asyncio.run(main())
```
For more examples, check out the [examples directory](examples/basic_usage.py).
## Building and Publishing
1. Install build tools:
```bash
pip install build twine
```
2. Build the package:
```bash
python -m build
```
3. Test the build locally:
```bash
pip install dist/tailli-0.1.0.tar.gz
```
4. Upload to PyPI:
```bash
python -m twine upload dist/*
```
## Project Structure
```
tailli/
├── pyproject.toml # Project configuration and dependencies
├── setup.cfg # Additional build configuration
├── README.md # This file
├── LICENSE # MIT License
├── requirements.txt # Python dependencies
├── src/
│ └── tailli/ # Main package code
│ ├── __init__.py
│ ├── client.py # Core client implementation
│ ├── models.py # Pydantic models
│ └── utils.py # Utility functions
├── tests/ # Test suite
└── examples/ # Example code
```
## Sample Implementation
The reference implementation can be found in the [examples directory](examples/basic_usage.py). This shows the recommended way to use the client, including:
- API key validation
- Usage recording
- Error handling
- Async context management
## License
The Tailli Client (but not the Tailli backend) is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "tailli",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "api, async, authentication",
"author": null,
"author_email": "Latent Search <info@rigr.ai>",
"download_url": "https://files.pythonhosted.org/packages/a5/cb/36bd540ea7ae8751b513bb1f68b721e8b04053e796fbe68bbf0aa8a042c3/tailli-0.2.0.tar.gz",
"platform": null,
"description": "# Tailli API Client\n\nA high-performance Python client for Tailli API key management and usage tracking. This client provides easy-to-use async interfaces with built-in caching and background usage recording for optimal performance - track consumption accurately without adding latency to your APIs.\n\n## Features\n\n- \ud83d\ude80 Asynchronous API with proper connection management\n- \ud83d\udcbe Local caching of API key validation\n- \ud83d\udd04 Background usage recording with automatic retries\n- \u26a1 Low-latency operations prioritizing your application's performance\n- \ud83d\udee1\ufe0f Type-safe with full typing support\n\n## Installation\n\n```bash\npip install tailli\n```\n\n## Quick Start\n\n```python\nfrom tailli import TailliClient\n\nasync def main():\n async with TailliClient() as client:\n # Validate an API key and use it in a session\n api_key = \"your-api-key\"\n try:\n async with client.validated_session(api_key):\n # Your API calls here\n await client.record_usage(api_key, 5)\n except InvalidApiKeyError:\n print(\"Invalid API key\")\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\nFor more examples, check out the [examples directory](examples/basic_usage.py).\n\n\n## Building and Publishing\n\n1. Install build tools:\n ```bash\n pip install build twine\n ```\n\n2. Build the package:\n ```bash\n python -m build\n ```\n\n3. Test the build locally:\n ```bash\n pip install dist/tailli-0.1.0.tar.gz\n ```\n\n4. Upload to PyPI:\n ```bash\n python -m twine upload dist/*\n ```\n\n## Project Structure\n\n```\ntailli/\n\u251c\u2500\u2500 pyproject.toml # Project configuration and dependencies\n\u251c\u2500\u2500 setup.cfg # Additional build configuration\n\u251c\u2500\u2500 README.md # This file\n\u251c\u2500\u2500 LICENSE # MIT License\n\u251c\u2500\u2500 requirements.txt # Python dependencies\n\u251c\u2500\u2500 src/\n\u2502 \u2514\u2500\u2500 tailli/ # Main package code\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 client.py # Core client implementation\n\u2502 \u251c\u2500\u2500 models.py # Pydantic models\n\u2502 \u2514\u2500\u2500 utils.py # Utility functions\n\u251c\u2500\u2500 tests/ # Test suite\n\u2514\u2500\u2500 examples/ # Example code\n```\n\n## Sample Implementation\n\nThe reference implementation can be found in the [examples directory](examples/basic_usage.py). This shows the recommended way to use the client, including:\n\n- API key validation\n- Usage recording\n- Error handling\n- Async context management\n\n\n## License\n\nThe Tailli Client (but not the Tailli backend) is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 Tailli 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": "Python client for Tailli API key management and usage tracking",
"version": "0.2.0",
"project_urls": {
"Documentation": "https://tailli.latentsearch.io/",
"Homepage": "https://tailli.latentsearch.io/"
},
"split_keywords": [
"api",
" async",
" authentication"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d1ece5602bd8265ae4a81626e2c5819694d664ec277338fbcf9ba66b2057c3ec",
"md5": "6a4f135f117627dbd55904729c1db753",
"sha256": "7034ae9a5013154f1fc83340e55b98184dda5ced340bd944b08cb80f9f263c81"
},
"downloads": -1,
"filename": "tailli-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6a4f135f117627dbd55904729c1db753",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7094,
"upload_time": "2024-11-11T10:56:21",
"upload_time_iso_8601": "2024-11-11T10:56:21.438658Z",
"url": "https://files.pythonhosted.org/packages/d1/ec/e5602bd8265ae4a81626e2c5819694d664ec277338fbcf9ba66b2057c3ec/tailli-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a5cb36bd540ea7ae8751b513bb1f68b721e8b04053e796fbe68bbf0aa8a042c3",
"md5": "413fe73915bfb2dfef9f1da31940ef90",
"sha256": "de0a0a964f340de543ce0cf330a7a3a84e39a7a58f01e2653624be97fd567010"
},
"downloads": -1,
"filename": "tailli-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "413fe73915bfb2dfef9f1da31940ef90",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6433,
"upload_time": "2024-11-11T10:56:23",
"upload_time_iso_8601": "2024-11-11T10:56:23.055039Z",
"url": "https://files.pythonhosted.org/packages/a5/cb/36bd540ea7ae8751b513bb1f68b721e8b04053e796fbe68bbf0aa8a042c3/tailli-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-11 10:56:23",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tailli"
}