Metadata-Version: 2.1
Name: meteoswiss-async
Version: 0.1.0rc24.post1
Summary: Asynchronous client for MeteoSwiss API.
Author-email: Alberto Montes <al.montes.gomez@gmail.com>
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: aiohttp==3.9.5
Requires-Dist: asyncstdlib==3.12.3
Requires-Dist: dataclasses-json==0.6.6
Requires-Dist: bandit[toml]==1.7.8 ; extra == "dev"
Requires-Dist: black==24.4.2 ; extra == "dev"
Requires-Dist: check-manifest==0.49 ; extra == "dev"
Requires-Dist: flake8-bugbear==24.4.26 ; extra == "dev"
Requires-Dist: flake8-docstrings ; extra == "dev"
Requires-Dist: flake8-formatter_junit_xml ; extra == "dev"
Requires-Dist: flake8 ; extra == "dev"
Requires-Dist: flake8-pyproject ; extra == "dev"
Requires-Dist: isort==5.13.2 ; extra == "dev"
Requires-Dist: pre-commit==3.7.1 ; extra == "dev"
Requires-Dist: pylint==3.1.0 ; extra == "dev"
Requires-Dist: pytest-cov==5.0.0 ; extra == "dev"
Requires-Dist: pytest-mock<3.14.1 ; extra == "dev"
Requires-Dist: pytest-runner ; extra == "dev"
Requires-Dist: pytest==8.2.0 ; extra == "dev"
Requires-Dist: pytest-github-actions-annotate-failures ; extra == "dev"
Requires-Dist: pytype ; extra == "dev"
Requires-Dist: rich ; extra == "dev"
Requires-Dist: shellcheck-py==0.10.0.1 ; extra == "dev"
Project-URL: Documentation, https://github.com/albertomontesg/meteoswiss-async/blob/main/README.md
Project-URL: Source, https://github.com/albertomontesg/meteoswiss-async
Project-URL: Tracker, https://github.com/albertomontesg/meteoswiss-async/issues
Provides-Extra: dev

# Python Async API Client

This have in mind to start developing API clients for Home Assistant to be 100% asynchronous

## How to Use it?

Fork this repository by using it as a template.

## Structure

This package provides good defaults for any API client code that is split on the following modules:

-   **`errors.py`**: module that define the custom errors the API and/or client would be returning to their users.
-   **`model.py`**: definition of the API data model. All returned objects from the clients would be defined here.
-   **`client.py`**: the logic around calling the API

## Development

To start developing with this package, fork it, create a virtual environment and install all the dependencies needed for development.

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install '.[dev]'
```

## Best Practices

This package provides already an skeleton with some best practices when starting developing your API client.

1.  100% async from the start: Home Assistant runs its main logic using an asynchronous engine, and having 3rd party clients running async can have performance benefits and ease of integration on new and existing components.
2.  A `aiohttp.ClientSession` should always to be a constructor argument (so a session and connection pool can be shared between multiple clients). The template already provides a class constructor to create the Client without any initial `ClientSession` in case it is not available.
3.  The output of each API endpoint is a typed `Model` that is build as a dataclass and can be parsed from a JSON response or a nested dictionary. This ensures the consumer of the API outputs can take benefits from the benefits dataclasses provide like readaibility on its structure and field types.
4.  The whole library is annotated with Python types so type checkers can help us detect errors early on rather than at runtime.

