Installation¶
Requirements¶
- Python 3.10+
- Compatible with
asyncio
andanyio
(Trio support)
Quick Install¶
Using pip (most common):
Using uv (recommended for new projects):
Using conda:
Optional Dependencies¶
effectpy has several optional dependencies for enhanced functionality:
AnyIO Runtime¶
For Trio/AnyIO backend support:
With pip:
With uv:
Exporters¶
For OpenTelemetry HTTP exporters (requires aiohttp
):
With pip:
With uv:
All Optional Dependencies¶
With pip:
With uv:
Development Installation¶
For contributing or running examples:
Using uv (recommended):
Using pip:
git clone https://github.com/stukennedy/effectpy.git
cd effectpy
pip install -e ".[anyio,exporters,docs]"
Verify Installation¶
Create a simple test file to verify your installation:
test_effectpy.py
import asyncio
from effectpy import *
async def main():
# Simple effect composition
result = await succeed(42).map(lambda x: x * 2)._run(Context())
print(f"Effect result: {result}") # Should print: Effect result: 84
# Test resource management
scope = Scope()
env = await LoggerLayer.build_scoped(Context(), scope)
instrumented = instrument("test", succeed("Hello effectpy!"))
message = await instrumented._run(env)
print(f"Instrumented: {message}")
await scope.close()
if __name__ == "__main__":
asyncio.run(main())
Run it:
Expected output:
What's Next?¶
Troubleshooting¶
Python Version Issues¶
Make sure you're using Python 3.10+:
Import Errors¶
If you see import errors, try:
- Reinstall effectpy:
pip uninstall effectpy && pip install effectpy
- Check virtual environment: Make sure you're in the correct virtual environment
- Clear Python cache:
python -Bc "import sys; print(sys.path)"
Optional Dependencies Not Found¶
If optional features don't work: