Name | aceiot-models JSON |
Version |
0.3.4
JSON |
| download |
home_page | None |
Summary | Pydantic models and API client for ACE IoT Aerodrome platform |
upload_time | 2025-07-27 20:51:14 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT |
keywords |
aceiot
api
client
iot
pydantic
sdk
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# aceiot-models
Pydantic models and API client for the ACE IoT Aerodrome Platform
## Installation
```bash
pip install aceiot-models
```
For upload progress support:
```bash
pip install aceiot-models[upload-progress]
```
## Features
- **Pydantic Models**: Type-safe data models for all ACE IoT entities
- **API Client**: Comprehensive Python SDK for the ACE IoT API
- **Pagination Support**: Efficient handling of large datasets
- **Batch Processing**: Process large operations in manageable chunks
- **Type Hints**: Full type annotations for better IDE support
- **Error Handling**: Robust error handling with detailed error information
## Usage
### Using the API Client
```python
from aceiot_models.api import APIClient, APIError
# Initialize the client
client = APIClient(
base_url="https://flightdeck.aceiot.cloud/api",
api_key="your-api-key"
)
# Or use environment variables:
# export ACEIOT_API_URL=https://flightdeck.aceiot.cloud/api
# export ACEIOT_API_KEY=your-api-key
client = APIClient()
# Get clients
clients = client.get_clients(page=1, per_page=20)
# Create a point
from aceiot_models import PointCreate
point = PointCreate(
name="sensor/temperature/office",
site_id=1,
client_id=1,
point_type="analog",
collect_enabled=True
)
result = client.create_points([point.model_dump()])
```
### Using Pagination
```python
from aceiot_models.api import PaginatedResults
# Paginate through all sites
paginator = PaginatedResults(client.get_sites, per_page=100)
for page_sites in paginator:
for site in page_sites:
print(f"Site: {site['name']}")
# Or get all items at once
all_sites = paginator.all_items()
```
### Batch Processing
```python
from aceiot_models.api import batch_process
# Process points in batches
points = [...] # List of many points
def create_batch(batch):
return client.create_points(batch)
results = batch_process(
items=points,
process_func=create_batch,
batch_size=100,
progress_callback=lambda current, total: print(f"{current}/{total}")
)
```
### Using the Models
```python
from aceiot_models import Point, Sample, PointCreate
# Create a new point
point = PointCreate(
name="sensor/temperature/office",
site_id=1,
client_id=1,
point_type="analog",
collect_enabled=True
)
```
### Using the API Client
```python
from aceiot_models.api import APIClient, APIError
# Initialize the client
client = APIClient(
base_url="https://flightdeck.aceiot.cloud/api",
api_key="your-api-key"
)
# Fetch sites
try:
sites = client.get_sites(page=1, per_page=100)
print(f"Found {sites['total_items']} sites")
except APIError as e:
print(f"Error: {e}")
```
### Pagination
```python
from aceiot_models.api import PaginatedResults
# Iterate through all points page by page
paginator = PaginatedResults(client.get_points, per_page=500)
for page_points in paginator:
print(f"Processing {len(page_points)} points...")
# Process each page
# Or get all items at once
all_points = paginator.all_items()
```
### Batch Processing
```python
from aceiot_models.api import batch_process
# Process items in batches
def process_batch(items):
return client.create_points(items)
results = batch_process(
items=large_list_of_points,
process_func=process_batch,
batch_size=100,
progress_callback=lambda current, total: print(f"{current}/{total}")
)
```
## Configuration
The API client can be configured through environment variables:
- `ACEIOT_API_URL`: Base URL for the API
- `ACEIOT_API_KEY`: Your API key
- `ACEIOT_API_TIMEOUT`: Request timeout in seconds (default: 30)
## Examples
See the [examples directory](examples/) for complete usage examples.
## Testing
### Unit Tests
Run the unit tests:
```bash
pytest tests/ -v
```
### Integration Tests
Integration tests verify the API client works with a real API endpoint. See [tests/api/README_INTEGRATION.md](tests/api/README_INTEGRATION.md) for setup instructions.
```bash
# Set environment variables
export ACEIOT_API_URL="https://flightdeck.aceiot.cloud/api"
export ACEIOT_API_KEY="your-api-key"
export ACEIOT_INTEGRATION_TESTS="true"
# Run integration tests
pytest tests/api/test_integration.py -v
```
## Development
This project uses `uv` for dependency management. To set up a development environment:
```bash
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone the repository
git clone https://github.com/yourusername/aceiot-models.git
cd aceiot-models
# Install dependencies
uv sync --all-extras
# Run tests
uv run pytest
# Run linting
uv run ruff check .
uv run ruff format .
# Run type checking
uv run pyrefly check aceiot_models/
```
## License
MIT License
Raw data
{
"_id": null,
"home_page": null,
"name": "aceiot-models",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "Andrew Rodgers <andrew@aceiotsolutions.com>",
"keywords": "aceiot, api, client, iot, pydantic, sdk",
"author": null,
"author_email": "Andrew Rodgers <andrew@aceiotsolutions.com>",
"download_url": "https://files.pythonhosted.org/packages/35/18/6a53c61f2788fc211f8edeb468ea6dcd76584f5a2901efecea7439320bf6/aceiot_models-0.3.4.tar.gz",
"platform": null,
"description": "# aceiot-models\n\nPydantic models and API client for the ACE IoT Aerodrome Platform\n\n## Installation\n\n```bash\npip install aceiot-models\n```\n\nFor upload progress support:\n```bash\npip install aceiot-models[upload-progress]\n```\n\n## Features\n\n- **Pydantic Models**: Type-safe data models for all ACE IoT entities\n- **API Client**: Comprehensive Python SDK for the ACE IoT API\n- **Pagination Support**: Efficient handling of large datasets\n- **Batch Processing**: Process large operations in manageable chunks\n- **Type Hints**: Full type annotations for better IDE support\n- **Error Handling**: Robust error handling with detailed error information\n\n## Usage\n\n### Using the API Client\n\n```python\nfrom aceiot_models.api import APIClient, APIError\n\n# Initialize the client\nclient = APIClient(\n base_url=\"https://flightdeck.aceiot.cloud/api\",\n api_key=\"your-api-key\"\n)\n\n# Or use environment variables:\n# export ACEIOT_API_URL=https://flightdeck.aceiot.cloud/api\n# export ACEIOT_API_KEY=your-api-key\nclient = APIClient()\n\n# Get clients\nclients = client.get_clients(page=1, per_page=20)\n\n# Create a point\nfrom aceiot_models import PointCreate\n\npoint = PointCreate(\n name=\"sensor/temperature/office\",\n site_id=1,\n client_id=1,\n point_type=\"analog\",\n collect_enabled=True\n)\nresult = client.create_points([point.model_dump()])\n```\n\n### Using Pagination\n\n```python\nfrom aceiot_models.api import PaginatedResults\n\n# Paginate through all sites\npaginator = PaginatedResults(client.get_sites, per_page=100)\nfor page_sites in paginator:\n for site in page_sites:\n print(f\"Site: {site['name']}\")\n\n# Or get all items at once\nall_sites = paginator.all_items()\n```\n\n### Batch Processing\n\n```python\nfrom aceiot_models.api import batch_process\n\n# Process points in batches\npoints = [...] # List of many points\n\ndef create_batch(batch):\n return client.create_points(batch)\n\nresults = batch_process(\n items=points,\n process_func=create_batch,\n batch_size=100,\n progress_callback=lambda current, total: print(f\"{current}/{total}\")\n)\n```\n\n### Using the Models\n\n```python\nfrom aceiot_models import Point, Sample, PointCreate\n\n# Create a new point\npoint = PointCreate(\n name=\"sensor/temperature/office\",\n site_id=1,\n client_id=1,\n point_type=\"analog\",\n collect_enabled=True\n)\n```\n\n### Using the API Client\n\n```python\nfrom aceiot_models.api import APIClient, APIError\n\n# Initialize the client\nclient = APIClient(\n base_url=\"https://flightdeck.aceiot.cloud/api\",\n api_key=\"your-api-key\"\n)\n\n# Fetch sites\ntry:\n sites = client.get_sites(page=1, per_page=100)\n print(f\"Found {sites['total_items']} sites\")\nexcept APIError as e:\n print(f\"Error: {e}\")\n```\n\n### Pagination\n\n```python\nfrom aceiot_models.api import PaginatedResults\n\n# Iterate through all points page by page\npaginator = PaginatedResults(client.get_points, per_page=500)\nfor page_points in paginator:\n print(f\"Processing {len(page_points)} points...\")\n # Process each page\n\n# Or get all items at once\nall_points = paginator.all_items()\n```\n\n### Batch Processing\n\n```python\nfrom aceiot_models.api import batch_process\n\n# Process items in batches\ndef process_batch(items):\n return client.create_points(items)\n\nresults = batch_process(\n items=large_list_of_points,\n process_func=process_batch,\n batch_size=100,\n progress_callback=lambda current, total: print(f\"{current}/{total}\")\n)\n```\n\n## Configuration\n\nThe API client can be configured through environment variables:\n\n- `ACEIOT_API_URL`: Base URL for the API\n- `ACEIOT_API_KEY`: Your API key\n- `ACEIOT_API_TIMEOUT`: Request timeout in seconds (default: 30)\n\n## Examples\n\nSee the [examples directory](examples/) for complete usage examples.\n\n## Testing\n\n### Unit Tests\n\nRun the unit tests:\n\n```bash\npytest tests/ -v\n```\n\n### Integration Tests\n\nIntegration tests verify the API client works with a real API endpoint. See [tests/api/README_INTEGRATION.md](tests/api/README_INTEGRATION.md) for setup instructions.\n\n```bash\n# Set environment variables\nexport ACEIOT_API_URL=\"https://flightdeck.aceiot.cloud/api\"\nexport ACEIOT_API_KEY=\"your-api-key\"\nexport ACEIOT_INTEGRATION_TESTS=\"true\"\n\n# Run integration tests\npytest tests/api/test_integration.py -v\n```\n\n## Development\n\nThis project uses `uv` for dependency management. To set up a development environment:\n\n```bash\n# Install uv if you haven't already\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Clone the repository\ngit clone https://github.com/yourusername/aceiot-models.git\ncd aceiot-models\n\n# Install dependencies\nuv sync --all-extras\n\n# Run tests\nuv run pytest\n\n# Run linting\nuv run ruff check .\nuv run ruff format .\n\n# Run type checking\nuv run pyrefly check aceiot_models/\n```\n\n## License\n\nMIT License\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pydantic models and API client for ACE IoT Aerodrome platform",
"version": "0.3.4",
"project_urls": {
"Homepage": "https://github.com/ACE-IoT-Solutions/aceiot-models",
"Issues": "https://github.com/ACE-IoT-Solutions/aceiot-models/issues",
"Repository": "https://github.com/ACE-IoT-Solutions/aceiot-models.git"
},
"split_keywords": [
"aceiot",
" api",
" client",
" iot",
" pydantic",
" sdk"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "08fa15a4840c7dd27dd52fdd52c7e71db792e452af6df13322c25c20b08ba004",
"md5": "cb30c036c658da98806e1163b6dc1ee1",
"sha256": "2fc63a95e9d917417a01ace4c3614f7716e1af3586aced9c7201a5602fcda180"
},
"downloads": -1,
"filename": "aceiot_models-0.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cb30c036c658da98806e1163b6dc1ee1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 66334,
"upload_time": "2025-07-27T20:51:12",
"upload_time_iso_8601": "2025-07-27T20:51:12.443091Z",
"url": "https://files.pythonhosted.org/packages/08/fa/15a4840c7dd27dd52fdd52c7e71db792e452af6df13322c25c20b08ba004/aceiot_models-0.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "35186a53c61f2788fc211f8edeb468ea6dcd76584f5a2901efecea7439320bf6",
"md5": "e3148751b5a0badaa1fa776099d791e7",
"sha256": "3b257c357ad169bcec32b45fedc61511c1fb400ecd5e7cd33481e18fc276ad8c"
},
"downloads": -1,
"filename": "aceiot_models-0.3.4.tar.gz",
"has_sig": false,
"md5_digest": "e3148751b5a0badaa1fa776099d791e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 108102,
"upload_time": "2025-07-27T20:51:14",
"upload_time_iso_8601": "2025-07-27T20:51:14.149624Z",
"url": "https://files.pythonhosted.org/packages/35/18/6a53c61f2788fc211f8edeb468ea6dcd76584f5a2901efecea7439320bf6/aceiot_models-0.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-27 20:51:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ACE-IoT-Solutions",
"github_project": "aceiot-models",
"github_not_found": true,
"lcname": "aceiot-models"
}