semvec/pypi-packages huggingface dataset:
aioevtracker 0.1.0
Async Python client for EV Tracker API
Requires Python: >=3.11
Keywords: aiohttp, async, charging, electric-vehicle, ev, evtracker

# aioevtracker

Async Python client for [EV Tracker](https://evtracker.cz) API.

## Installation

```bash
pip install aioevtracker
```

## Usage

```python
import asyncio
from aioevtracker import EVTrackerClient

async def main():
    async with EVTrackerClient(api_key="your-api-key") as client:
        # Get all cars
        cars = await client.get_cars()
        for car in cars:
            print(f"{car.name} (ID: {car.id})")

        # Get charging statistics
        state = await client.get_state()
        print(f"Monthly energy: {state.monthly_energy} kWh")
        print(f"Monthly cost: {state.monthly_cost} CZK")

        # Log a charging session
        session = await client.log_session_simple(
            energy_kwh=45.5,
            energy_source="GRID",
            rate_type="LOW",
        )
        print(f"Logged session ID: {session.id}")

asyncio.run(main())
```

## With existing aiohttp session

```python
import aiohttp
from aioevtracker import EVTrackerClient

async with aiohttp.ClientSession() as session:
    client = EVTrackerClient(
        api_key="your-api-key",
        session=session,
    )
    cars = await client.get_cars()
```

## API Reference

### EVTrackerClient

- `get_cars()` - Get list of user's cars
- `get_default_car()` - Get default car
- `get_state()` - Get Home Assistant state with statistics
- `log_session(...)` - Log a charging session with full control
- `log_session_simple(...)` - Log a charging session with smart defaults
- `validate_api_key()` - Validate the API key

### Models

- `Car` - Electric vehicle
- `ChargingSession` - Charging session
- `HomeAssistantState` - Statistics state

### Exceptions

- `EVTrackerApiError` - Base exception
- `EVTrackerAuthenticationError` - Invalid API key (401/403)
- `EVTrackerConnectionError` - Connection failed
- `EVTrackerRateLimitError` - Rate limit exceeded (429)

## License

MIT
dishka-cyclopts 1.0.1
Dishka integration for cyclopts
Requires Python: >=3.10

# Dishka × Cyclopts

Async Dishka integration for Cyclopts. It injects dependencies into async CLI commands using the familiar `@inject` decorator.

## Features

- **Automatic scope management**: async containers are closed after each command, so async generators/iterators are finalized.
- **Drop-in decorator**: use `@inject` on Cyclopts commands; annotate parameters with `FromDishka[...]`.
- **Positional-friendly**: injected params can precede user arguments; binding is normalized to kwargs.

## Installation

Install using `pip`

```sh
pip install dishka-cyclopts
```

Or with `uv`

```sh
uv add dishka-cyclopts
```

## Usage

```python
from cyclopts import App
from dishka import FromDishka, Provider, Scope, make_async_container, provide
from dishka_cyclopts import inject, setup_dishka


class Dependencies(Provider):
    @provide(scope=Scope.APP)
    def meaning(self) -> int:
        return 42


app = App(result_action="return_value")
setup_dishka(make_async_container(Dependencies()), app)


@app.command
@inject
async def main(value: FromDishka[int]) -> int:
    return value


if __name__ == "__main__":
    print(app())
```

`setup_dishka` patches Cyclopts to track the current app and stores the provided `AsyncContainer` inside `app.state`. After each command completes the container is closed, finalizing APP/REQUEST scoped resources (including async generators).

## Requirements

- Python 3.10+
- Cyclopts >= 4.3.0
- Dishka >= 1.7.2

## More Examples

Check out the [examples](https://github.com/GenessyX/dishka-cyclopts/tree/main/examples)
directory for more detailed examples.