Metadata-Version: 2.4
Name: pyfilament
Version: 0.0.18
Summary: lightweight task framework
Project-URL: Homepage, https://pyfilament.io/
Project-URL: Repository, https://github.com/pyfilament/pyfilament
Project-URL: Bug Tracker, https://github.com/pyfilament/pyfilament/issues
Project-URL: Discord, https://discord.gg/RgyZceR53B
Author-email: James Wu <james@centauri-ai.tech>
License: MIT License
        
        Copyright (c) 2026 James Wu
        
        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.
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.14
Requires-Dist: aiosqlite>=0.22.1
Requires-Dist: alembic>=1.18.4
Requires-Dist: anyio>=4.13.0
Requires-Dist: asyncpg>=0.31.0
Requires-Dist: beartype>=0.22.9
Requires-Dist: dotenv>=0.9.9
Requires-Dist: fastapi>=0.136.3
Requires-Dist: inflection>=0.5.1
Requires-Dist: pandas>=3.0.3
Requires-Dist: polars>=1.41.2
Requires-Dist: pydantic>=2.13.4
Requires-Dist: redis>=8.0.0
Requires-Dist: sqlalchemy[asyncio]>=2.0.50
Requires-Dist: starlette>=1.2.1
Requires-Dist: strawberry-graphql>=0.316.0
Requires-Dist: uvicorn>=0.49.0
Requires-Dist: werkzeug>=3.1.8
Description-Content-Type: text/markdown

[![pypi package version](https://img.shields.io/pypi/v/pyfilament)](https://pypi.org/project/pyfilament/) [![python version](https://img.shields.io/pypi/pyversions/pyfilament)](https://pypi.org/project/pyfilament/) [![pytest](https://github.com/pyfilament/pyfilament/actions/workflows/pytest.yml/badge.svg)](https://github.com/pyfilament/pyfilament/actions/workflows/pytest.yml) [![codecov](https://codecov.io/github/pyfilament/pyfilament/graph/badge.svg?token=DIUIQG3YMW)](https://codecov.io/github/pyfilament/pyfilament) [![discord](https://img.shields.io/discord/1516547508837285958?logo=discord)](https://discord.gg/RgyZceR53B)

# pyfilament

lightweight task framework

Features
* timeouts / retries / caching
* token-bucket and concurrency limits
* subtasks, queues, and distributed workers
* task cancellation and graceful worker shutdown
* state timeline tracking, logging, args inspection

# Getting Started

```
uv add pyfilament
uv run - << 'EOF'
from filament import task
from asyncio import run

@task
async def foo():
    return 'bar'

run(foo())
EOF
```

# Optional Dependencies

pyfilament makes use of redis for task queueing, and a SQL database for state tracking. Both of these dependencies are optional, but will enable user-facing features.

## Redis (queueing)

Enables distributed workloads using queues and workers (`my_task.request()` and `my_task.serve()`). Redis is also required for caching. By default, pyfilament will attempt to connect to `localhost:6379`. You can override it with

```
export FILAMENT_REDIS_HOST=new_redis_host
export FILAMENT_REDIS_PORT=6379
```

## State tracking

Enables frontend ui dashboard, API-triggered task cancellations, and STONITH. By default, pyfilament will use a local sqlite database. You can override it with:

```
export FILAMENT_DB_URI=postgresql+asyncpg://username:password@hostname:5432/dbname
```

## Disabling optional dependencies

The default `@task` decorator (`from filament import task`) assumes that both are enabled. There's plans to make disabling optional dependencies easier in a future release, but for now look in these tests for examples of how run without optional dependencies:

|test name|queueing|state tracking|
|---|---|---|
|[tests/test_task.py](tests/test_task.py)|disabled|disabled|
|[tests/test_queue.py](tests/test_queue.py)|enabled|disabled|
|[tests/test_cancel_state.py](tests/test_cancel_state.py)|disabled|enabled|
|default `@task`|enabled|enabled|
