Name | lirayspy JSON |
Version |
0.0.4
JSON |
| download |
home_page | None |
Summary | Python client library for LiRAYS API - Fiber Network Design |
upload_time | 2025-08-03 01:05:00 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
lirays
api
gis
fiber
network
design
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# LiRAYS Python API Client
[](https://badge.fury.io/py/lirayspy)
[](https://pypi.org/project/lirayspy/)
[](https://opensource.org/licenses/MIT)
A comprehensive Python client library for the **LiRAYS API** - the leading platform for fiber network design and geographic information systems (GIS). This library provides a clean, intuitive interface to interact with all LiRAYS API endpoints including authentication, project management, plan execution, layer management, feature operations, and real-time tool execution.
## ๐ Features
- **๐ Authentication**: Secure JWT-based authentication with automatic token refresh
- **๐ Project Management**: Complete CRUD operations for GIS projects
- **๐ Plan Management**: Create and manage analysis plans with status tracking
- **๐๏ธ Layer Management**: Handle 25+ geographic layer types with full classification support
- **๐ Feature Operations**: Full geometry support (Points, LineStrings, Polygons) with batch operations
- **๐ ๏ธ Tool Execution**: Real-time streaming execution of GIS analysis tools with progress tracking
- **๐ Context Manager Support**: Automatic resource cleanup and connection management
- **๐ฆ Type Safety**: Full type hints and enum support for better development experience
- **โก Session Management**: Persistent sessions with automatic reconnection
## ๐ฆ Installation
```bash
pip install lirayspy
```
## โก Quick Start
```python
from lirayspy import LiRAYSApiClient
from lirayspy.tools import LayerClass, GeomType, PlanStatus
# Initialize client with context manager (recommended)
with LiRAYSApiClient("https://api.lirays.com") as client:
# Authenticate
if client.login("your-email@example.com", "your-password"):
print("Successfully authenticated!")
# Create a project
project = client.create_project(
name="Fiber Network Expansion",
description="Q4 2024 fiber network expansion project"
)
# Create a plan
plan = client.create_plan(
project_id=project["id"],
name="Phase 1 Analysis",
status=PlanStatus.IN_PROGRESS
)
# Create a layer for fiber infrastructure
layer = client.create_layer(
plan_id=plan["id"],
layer_class=LayerClass.FIBER_24,
name="24-Core Fiber Network"
)
# Add a point feature (network node)
feature = client.create_feature(
layer_id=layer["id"],
geom_type=GeomType.POINT,
coordinates=[-122.4194, 37.7749] # San Francisco coordinates
)
print(f"Created feature: {feature['id']}")
```
## ๐ Comprehensive API Documentation
### ๐ Authentication
```python
from lirayspy import LiRAYSApiClient
# Initialize client
client = LiRAYSApiClient("https://api.lirays.com")
# Login with credentials
success = client.login("user@example.com", "password")
if success:
print(f"Logged in as: {client.email}")
# Check health status
if client.health_check():
print("API is healthy and responding")
# Logout (clears tokens)
client.logout()
```
### ๐ Project Management
```python
# Create a new project
project = client.create_project(
name="Smart City Infrastructure",
description="IoT and fiber network integration project"
)
# List projects with pagination
projects = client.get_projects(page=1, per_page=10)
print(f"Found {len(projects['resources'])} projects")
# Get specific project
project_details = client.get_project(project["id"])
# Update project
updated_project = client.update_project(
project["id"],
name="Smart City Infrastructure v2.0",
description="Updated project scope"
)
# Delete project (will cascade delete all child resources)
client.delete_project(project["id"])
```
### ๐ Plan Management
```python
from lirayspy.tools import PlanStatus
# Create a plan
plan = client.create_plan(
project_id=project["id"],
name="Network Optimization Analysis",
description="Optimize fiber routing for maximum efficiency",
status=PlanStatus.NOT_ASSIGNED
)
# Get plans for a project
plans = client.get_plans(page=1, per_page=20, project_id=project["id"])
# Update plan status
updated_plan = client.update_plan(
plan["id"],
status=PlanStatus.COMPLETED
)
# Get specific plan
plan_details = client.get_plan(plan["id"])
```
### ๐๏ธ Layer Management
LiRAYS supports 25+ layer types for comprehensive network design:
```python
from lirayspy.tools import LayerClass
# Available layer classes include:
# - Primary: PLAN_AREA, PARCELS, CABINET
# - Network Points: MST, SPLICE, RESIDENTIAL
# - Hand-holes: VAULT_24X36, VAULT_17X30, VAULT_10X15
# - Fiber: FIBER_24, FIBER_48, FIBER_72, FIBER_144, FIBER_288
# - Conduits: CONDUIT_075, CONDUIT_125
# - And many more...
# Create different types of layers
fiber_layer = client.create_layer(
plan_id=plan["id"],
layer_class=LayerClass.FIBER_144,
name="High-Capacity Backbone"
)
vault_layer = client.create_layer(
plan_id=plan["id"],
layer_class=LayerClass.VAULT_24X36,
name="Distribution Vaults"
)
# Get available layer classes
layer_classes = client.get_layer_classes()
ready_layers = client.get_ready_layer_classes()
# List layers for a plan
layers = client.get_layers(page=1, per_page=50, plan_id=plan["id"])
# Update layer
updated_layer = client.update_layer(
fiber_layer["id"],
name="Updated Fiber Network"
)
```
### ๐ Feature Operations
Complete geometry support with batch operations:
```python
from lirayspy.tools import GeomType
# Create a point feature (network node, splice point, etc.)
point_feature = client.create_feature(
layer_id=layer["id"],
geom_type=GeomType.POINT,
coordinates=[-122.4194, 37.7749]
)
# Create a line feature (fiber cable route)
line_feature = client.create_feature(
layer_id=layer["id"],
geom_type=GeomType.LINESTRING,
coordinates=[
[-122.4194, 37.7749],
[-122.4184, 37.7759],
[-122.4174, 37.7769]
]
)
# Create a polygon feature (service area, easement)
polygon_feature = client.create_feature(
layer_id=layer["id"],
geom_type=GeomType.POLYGON,
coordinates=[[
[-122.4200, 37.7740],
[-122.4180, 37.7740],
[-122.4180, 37.7760],
[-122.4200, 37.7760],
[-122.4200, 37.7740] # Close the polygon
]]
)
# Batch create multiple features
batch_coordinates = [
[-122.4100, 37.7800],
[-122.4110, 37.7810],
[-122.4120, 37.7820]
]
batch_result = client.create_feature_batch(
layer_id=layer["id"],
geom_type=GeomType.POINT,
features_coordinates=batch_coordinates
)
# Update feature geometry
updated_feature = client.update_feature(
point_feature["id"],
coordinates=[-122.4200, 37.7750]
)
# Get features for a layer
features = client.get_features(page=1, per_page=100, layer_id=layer["id"])
# Delete features (individual and batch)
client.delete_feature(point_feature["id"])
# Batch delete multiple features
feature_ids = [f["id"] for f in batch_result["features"]]
client.delete_feature_batch(feature_ids)
```
### ๐ ๏ธ Tool Execution
Real-time streaming execution of GIS analysis tools:
```python
# Get available analysis tools
available_actions = client.get_available_actions()
print(f"Available tools: {available_actions}")
# Get tool requirements
if "network_analysis" in available_actions:
requirements = client.get_tool_required_payload("network_analysis")
print(f"Tool requirements: {requirements}")
# Execute tool with streaming progress
action_config = {
"analysis_depth": 3,
"optimization_level": "high",
"include_cost_analysis": True
}
input_data = {
"project_id": project["id"],
"layer_ids": [layer["id"]]
}
print("Executing network analysis tool...")
for result in client.execute_action("network_analysis", action_config, input_data):
print(f"Status: {result.get('status')}")
print(f"Progress: {result.get('progress', 0)}%")
if result.get("status") == "completed":
print("Analysis completed successfully!")
print(f"Results: {result.get('result')}")
break
elif result.get("status") == "failed":
print(f"Analysis failed: {result.get('error')}")
break
```
## ๐ง Advanced Usage
### Context Manager (Recommended)
Always use the context manager for automatic resource cleanup:
```python
with LiRAYSApiClient("https://api.lirays.com") as client:
client.login("user@example.com", "password")
# Perform operations...
# Session is automatically closed when exiting the context
```
### Error Handling
```python
try:
with LiRAYSApiClient("https://api.lirays.com") as client:
if not client.login("user@example.com", "wrong-password"):
raise Exception("Authentication failed")
project = client.create_project("Test Project")
except Exception as e:
print(f"Operation failed: {e}")
# Context manager ensures cleanup even on errors
```
### Custom Configuration
```python
# Custom API endpoint and version
client = LiRAYSApiClient(
base_url="https://custom-api.lirays.com",
version="v2"
)
# Reset client configuration
client.reset(
base_url="https://new-api.lirays.com",
version="v1"
)
```
## ๐ Layer Types Reference
LiRAYS supports comprehensive layer classification for fiber network design:
### Primary Infrastructure
- `PLAN_AREA` - Project planning areas
- `PARCELS` - Property parcels and boundaries
- `CABINET` - Network cabinets and enclosures
### Network Logical Points
- `MST` - Main Service Terminals
- `SPLICE` - Splice points and connections
- `SPLICE_MST` - Combined splice and MST points
- `RESIDENTIAL` - Residential connection points
### Hand-holes and Vaults
- `VAULT_24X36` - 24"ร36" utility vaults
- `VAULT_17X30` - 17"ร30" utility vaults
- `VAULT_10X15` - 10"ร15" utility vaults
- `VAULT_OTHERS` - Custom vault configurations
### Fiber Infrastructure
- `FIBER_24` - 24-count fiber cables
- `FIBER_48` - 48-count fiber cables
- `FIBER_72` - 72-count fiber cables
- `FIBER_144` - 144-count fiber cables
- `FIBER_288` - 288-count fiber cables
- `FIBER_TAIL` - Fiber tail connections
- `FIBER_DROP` - Drop fiber connections
### Conduits and Infrastructure
- `CONDUIT_075` - 0.75" conduit systems
- `CONDUIT_125` - 1.25" conduit systems
- `TUNNEL` - Underground tunnel systems
## ๐งช Testing
The package includes a comprehensive test suite in the demo:
```python
# Run the complete API test suite
python demo/demo.py
```
The test suite covers:
- โ
Authentication and health checks
- โ
Complete CRUD operations for all resource types
- โ
Batch operations and bulk processing
- โ
Tool execution with progress tracking
- โ
Data integrity verification
- โ
Automatic cleanup and state restoration
## ๐ Examples
### Complete Workflow Example
```python
from lirayspy import LiRAYSApiClient
from lirayspy.tools import LayerClass, GeomType, PlanStatus
def create_fiber_network_project():
"""Complete example: Create a fiber network design project"""
with LiRAYSApiClient("https://api.lirays.com") as client:
# Authenticate
if not client.login("engineer@network.com", "password"):
return "Authentication failed"
try:
# Create project
project = client.create_project(
name="Downtown Fiber Expansion 2024",
description="High-speed fiber network expansion for downtown district"
)
# Create analysis plan
plan = client.create_plan(
project_id=project["id"],
name="Route Optimization Analysis",
description="Optimize fiber routes for minimal cost and maximum coverage",
status=PlanStatus.IN_PROGRESS
)
# Create infrastructure layers
fiber_layer = client.create_layer(
plan_id=plan["id"],
layer_class=LayerClass.FIBER_144,
name="Backbone Fiber Network"
)
vault_layer = client.create_layer(
plan_id=plan["id"],
layer_class=LayerClass.VAULT_24X36,
name="Distribution Vaults"
)
# Add network infrastructure
# Main distribution points
vault_coords = [
[-122.4194, 37.7749], # Downtown hub
[-122.4154, 37.7709], # South district
[-122.4234, 37.7789] # North district
]
vault_features = client.create_feature_batch(
layer_id=vault_layer["id"],
geom_type=GeomType.POINT,
features_coordinates=vault_coords
)
# Fiber backbone route
backbone_route = client.create_feature(
layer_id=fiber_layer["id"],
geom_type=GeomType.LINESTRING,
coordinates=[
[-122.4194, 37.7749],
[-122.4184, 37.7759],
[-122.4174, 37.7769],
[-122.4164, 37.7779]
]
)
print(f"โ
Created project: {project['name']}")
print(f"โ
Created plan: {plan['name']}")
print(f"โ
Created {len(vault_features['features'])} vault points")
print(f"โ
Created backbone route: {backbone_route['id']}")
# Execute network analysis
print("๐ Running network optimization analysis...")
for result in client.execute_action(
"network_optimization",
config={"optimization_type": "cost_distance"},
input_={"plan_id": plan["id"]}
):
if result.get("status") == "completed":
print("โ
Network analysis completed!")
break
elif result.get("status") == "failed":
print(f"โ Analysis failed: {result.get('error')}")
break
return f"Project '{project['name']}' created successfully!"
except Exception as e:
return f"Error: {e}"
# Run the example
result = create_fiber_network_project()
print(result)
```
## ๐ ๏ธ Development
### Setting up Development Environment
```bash
# Clone the repository
git clone https://github.com/LiRAYSgj/Lirays-Api-Python-Client.git
cd Lirays-Api-Python-Client
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
# Run tests
python demo/demo.py
# Format code
black lirayspy/ demo/
isort lirayspy/ demo/
# Type checking
mypy lirayspy/
```
### Running Tests
```bash
# Run the comprehensive test suite
python demo/demo.py
# The test will prompt for:
# - API URL (default: https://api.lirays.com)
# - Email credentials
# - Password
```
## ๐ Requirements
- **Python**: 3.8+
- **Dependencies**:
- `requests >= 2.31.0` - HTTP client library
- `typing-extensions >= 4.0.0` (for Python < 3.10)
## ๐ License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## ๐ค Support
- **Documentation**: [GitHub Repository](https://github.com/LiRAYSgj/Lirays-Api-Python-Client)
- **Issues**: [Report Bug](https://github.com/LiRAYSgj/Lirays-Api-Python-Client/issues)
- **Email**: support@lirays.com
## ๐ Links
- **PyPI Package**: [https://pypi.org/project/lirayspy/](https://pypi.org/project/lirayspy/)
- **Source Code**: [https://github.com/LiRAYSgj/Lirays-Api-Python-Client](https://github.com/LiRAYSgj/Lirays-Api-Python-Client)
- **LiRAYS Platform**: [https://lirays.com](https://lirays.com)
---
**Built with โค๏ธ for the fiber network design community**
Raw data
{
"_id": null,
"home_page": null,
"name": "lirayspy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "lirays, api, gis, fiber, network, design",
"author": null,
"author_email": "LiRAYS API Client <support@lirays.com>",
"download_url": "https://files.pythonhosted.org/packages/12/b6/d281c8490d169408ddd916c168098ecd7429ff6d917eefc8297d44c2e6dd/lirayspy-0.0.4.tar.gz",
"platform": null,
"description": "# LiRAYS Python API Client\n\n[](https://badge.fury.io/py/lirayspy)\n[](https://pypi.org/project/lirayspy/)\n[](https://opensource.org/licenses/MIT)\n\nA comprehensive Python client library for the **LiRAYS API** - the leading platform for fiber network design and geographic information systems (GIS). This library provides a clean, intuitive interface to interact with all LiRAYS API endpoints including authentication, project management, plan execution, layer management, feature operations, and real-time tool execution.\n\n## \ud83d\ude80 Features\n\n- **\ud83d\udd10 Authentication**: Secure JWT-based authentication with automatic token refresh\n- **\ud83d\udcca Project Management**: Complete CRUD operations for GIS projects\n- **\ud83d\udccb Plan Management**: Create and manage analysis plans with status tracking\n- **\ud83d\uddc2\ufe0f Layer Management**: Handle 25+ geographic layer types with full classification support\n- **\ud83d\udccd Feature Operations**: Full geometry support (Points, LineStrings, Polygons) with batch operations\n- **\ud83d\udee0\ufe0f Tool Execution**: Real-time streaming execution of GIS analysis tools with progress tracking\n- **\ud83d\udd04 Context Manager Support**: Automatic resource cleanup and connection management\n- **\ud83d\udce6 Type Safety**: Full type hints and enum support for better development experience\n- **\u26a1 Session Management**: Persistent sessions with automatic reconnection\n\n## \ud83d\udce6 Installation\n\n```bash\npip install lirayspy\n```\n\n## \u26a1 Quick Start\n\n```python\nfrom lirayspy import LiRAYSApiClient\nfrom lirayspy.tools import LayerClass, GeomType, PlanStatus\n\n# Initialize client with context manager (recommended)\nwith LiRAYSApiClient(\"https://api.lirays.com\") as client:\n # Authenticate\n if client.login(\"your-email@example.com\", \"your-password\"):\n print(\"Successfully authenticated!\")\n \n # Create a project\n project = client.create_project(\n name=\"Fiber Network Expansion\",\n description=\"Q4 2024 fiber network expansion project\"\n )\n \n # Create a plan\n plan = client.create_plan(\n project_id=project[\"id\"],\n name=\"Phase 1 Analysis\",\n status=PlanStatus.IN_PROGRESS\n )\n \n # Create a layer for fiber infrastructure\n layer = client.create_layer(\n plan_id=plan[\"id\"],\n layer_class=LayerClass.FIBER_24,\n name=\"24-Core Fiber Network\"\n )\n \n # Add a point feature (network node)\n feature = client.create_feature(\n layer_id=layer[\"id\"],\n geom_type=GeomType.POINT,\n coordinates=[-122.4194, 37.7749] # San Francisco coordinates\n )\n \n print(f\"Created feature: {feature['id']}\")\n```\n\n## \ud83d\udcda Comprehensive API Documentation\n\n### \ud83d\udd10 Authentication\n\n```python\nfrom lirayspy import LiRAYSApiClient\n\n# Initialize client\nclient = LiRAYSApiClient(\"https://api.lirays.com\")\n\n# Login with credentials\nsuccess = client.login(\"user@example.com\", \"password\")\nif success:\n print(f\"Logged in as: {client.email}\")\n\n# Check health status\nif client.health_check():\n print(\"API is healthy and responding\")\n\n# Logout (clears tokens)\nclient.logout()\n```\n\n### \ud83d\udcca Project Management\n\n```python\n# Create a new project\nproject = client.create_project(\n name=\"Smart City Infrastructure\",\n description=\"IoT and fiber network integration project\"\n)\n\n# List projects with pagination\nprojects = client.get_projects(page=1, per_page=10)\nprint(f\"Found {len(projects['resources'])} projects\")\n\n# Get specific project\nproject_details = client.get_project(project[\"id\"])\n\n# Update project\nupdated_project = client.update_project(\n project[\"id\"],\n name=\"Smart City Infrastructure v2.0\",\n description=\"Updated project scope\"\n)\n\n# Delete project (will cascade delete all child resources)\nclient.delete_project(project[\"id\"])\n```\n\n### \ud83d\udccb Plan Management\n\n```python\nfrom lirayspy.tools import PlanStatus\n\n# Create a plan\nplan = client.create_plan(\n project_id=project[\"id\"],\n name=\"Network Optimization Analysis\",\n description=\"Optimize fiber routing for maximum efficiency\",\n status=PlanStatus.NOT_ASSIGNED\n)\n\n# Get plans for a project\nplans = client.get_plans(page=1, per_page=20, project_id=project[\"id\"])\n\n# Update plan status\nupdated_plan = client.update_plan(\n plan[\"id\"],\n status=PlanStatus.COMPLETED\n)\n\n# Get specific plan\nplan_details = client.get_plan(plan[\"id\"])\n```\n\n### \ud83d\uddc2\ufe0f Layer Management\n\nLiRAYS supports 25+ layer types for comprehensive network design:\n\n```python\nfrom lirayspy.tools import LayerClass\n\n# Available layer classes include:\n# - Primary: PLAN_AREA, PARCELS, CABINET\n# - Network Points: MST, SPLICE, RESIDENTIAL\n# - Hand-holes: VAULT_24X36, VAULT_17X30, VAULT_10X15\n# - Fiber: FIBER_24, FIBER_48, FIBER_72, FIBER_144, FIBER_288\n# - Conduits: CONDUIT_075, CONDUIT_125\n# - And many more...\n\n# Create different types of layers\nfiber_layer = client.create_layer(\n plan_id=plan[\"id\"],\n layer_class=LayerClass.FIBER_144,\n name=\"High-Capacity Backbone\"\n)\n\nvault_layer = client.create_layer(\n plan_id=plan[\"id\"],\n layer_class=LayerClass.VAULT_24X36,\n name=\"Distribution Vaults\"\n)\n\n# Get available layer classes\nlayer_classes = client.get_layer_classes()\nready_layers = client.get_ready_layer_classes()\n\n# List layers for a plan\nlayers = client.get_layers(page=1, per_page=50, plan_id=plan[\"id\"])\n\n# Update layer\nupdated_layer = client.update_layer(\n fiber_layer[\"id\"],\n name=\"Updated Fiber Network\"\n)\n```\n\n### \ud83d\udccd Feature Operations\n\nComplete geometry support with batch operations:\n\n```python\nfrom lirayspy.tools import GeomType\n\n# Create a point feature (network node, splice point, etc.)\npoint_feature = client.create_feature(\n layer_id=layer[\"id\"],\n geom_type=GeomType.POINT,\n coordinates=[-122.4194, 37.7749]\n)\n\n# Create a line feature (fiber cable route)\nline_feature = client.create_feature(\n layer_id=layer[\"id\"],\n geom_type=GeomType.LINESTRING,\n coordinates=[\n [-122.4194, 37.7749],\n [-122.4184, 37.7759],\n [-122.4174, 37.7769]\n ]\n)\n\n# Create a polygon feature (service area, easement)\npolygon_feature = client.create_feature(\n layer_id=layer[\"id\"],\n geom_type=GeomType.POLYGON,\n coordinates=[[\n [-122.4200, 37.7740],\n [-122.4180, 37.7740],\n [-122.4180, 37.7760],\n [-122.4200, 37.7760],\n [-122.4200, 37.7740] # Close the polygon\n ]]\n)\n\n# Batch create multiple features\nbatch_coordinates = [\n [-122.4100, 37.7800],\n [-122.4110, 37.7810],\n [-122.4120, 37.7820]\n]\n\nbatch_result = client.create_feature_batch(\n layer_id=layer[\"id\"],\n geom_type=GeomType.POINT,\n features_coordinates=batch_coordinates\n)\n\n# Update feature geometry\nupdated_feature = client.update_feature(\n point_feature[\"id\"],\n coordinates=[-122.4200, 37.7750]\n)\n\n# Get features for a layer\nfeatures = client.get_features(page=1, per_page=100, layer_id=layer[\"id\"])\n\n# Delete features (individual and batch)\nclient.delete_feature(point_feature[\"id\"])\n\n# Batch delete multiple features\nfeature_ids = [f[\"id\"] for f in batch_result[\"features\"]]\nclient.delete_feature_batch(feature_ids)\n```\n\n### \ud83d\udee0\ufe0f Tool Execution\n\nReal-time streaming execution of GIS analysis tools:\n\n```python\n# Get available analysis tools\navailable_actions = client.get_available_actions()\nprint(f\"Available tools: {available_actions}\")\n\n# Get tool requirements\nif \"network_analysis\" in available_actions:\n requirements = client.get_tool_required_payload(\"network_analysis\")\n print(f\"Tool requirements: {requirements}\")\n\n# Execute tool with streaming progress\naction_config = {\n \"analysis_depth\": 3,\n \"optimization_level\": \"high\",\n \"include_cost_analysis\": True\n}\n\ninput_data = {\n \"project_id\": project[\"id\"],\n \"layer_ids\": [layer[\"id\"]]\n}\n\nprint(\"Executing network analysis tool...\")\nfor result in client.execute_action(\"network_analysis\", action_config, input_data):\n print(f\"Status: {result.get('status')}\")\n print(f\"Progress: {result.get('progress', 0)}%\")\n \n if result.get(\"status\") == \"completed\":\n print(\"Analysis completed successfully!\")\n print(f\"Results: {result.get('result')}\")\n break\n elif result.get(\"status\") == \"failed\":\n print(f\"Analysis failed: {result.get('error')}\")\n break\n```\n\n## \ud83d\udd27 Advanced Usage\n\n### Context Manager (Recommended)\n\nAlways use the context manager for automatic resource cleanup:\n\n```python\nwith LiRAYSApiClient(\"https://api.lirays.com\") as client:\n client.login(\"user@example.com\", \"password\")\n \n # Perform operations...\n # Session is automatically closed when exiting the context\n```\n\n### Error Handling\n\n```python\ntry:\n with LiRAYSApiClient(\"https://api.lirays.com\") as client:\n if not client.login(\"user@example.com\", \"wrong-password\"):\n raise Exception(\"Authentication failed\")\n \n project = client.create_project(\"Test Project\")\n \nexcept Exception as e:\n print(f\"Operation failed: {e}\")\n # Context manager ensures cleanup even on errors\n```\n\n### Custom Configuration\n\n```python\n# Custom API endpoint and version\nclient = LiRAYSApiClient(\n base_url=\"https://custom-api.lirays.com\",\n version=\"v2\"\n)\n\n# Reset client configuration\nclient.reset(\n base_url=\"https://new-api.lirays.com\",\n version=\"v1\"\n)\n```\n\n## \ud83d\udccb Layer Types Reference\n\nLiRAYS supports comprehensive layer classification for fiber network design:\n\n### Primary Infrastructure\n- `PLAN_AREA` - Project planning areas\n- `PARCELS` - Property parcels and boundaries \n- `CABINET` - Network cabinets and enclosures\n\n### Network Logical Points\n- `MST` - Main Service Terminals\n- `SPLICE` - Splice points and connections\n- `SPLICE_MST` - Combined splice and MST points\n- `RESIDENTIAL` - Residential connection points\n\n### Hand-holes and Vaults\n- `VAULT_24X36` - 24\"\u00d736\" utility vaults\n- `VAULT_17X30` - 17\"\u00d730\" utility vaults \n- `VAULT_10X15` - 10\"\u00d715\" utility vaults\n- `VAULT_OTHERS` - Custom vault configurations\n\n### Fiber Infrastructure\n- `FIBER_24` - 24-count fiber cables\n- `FIBER_48` - 48-count fiber cables\n- `FIBER_72` - 72-count fiber cables\n- `FIBER_144` - 144-count fiber cables\n- `FIBER_288` - 288-count fiber cables\n- `FIBER_TAIL` - Fiber tail connections\n- `FIBER_DROP` - Drop fiber connections\n\n### Conduits and Infrastructure\n- `CONDUIT_075` - 0.75\" conduit systems\n- `CONDUIT_125` - 1.25\" conduit systems\n- `TUNNEL` - Underground tunnel systems\n\n## \ud83e\uddea Testing\n\nThe package includes a comprehensive test suite in the demo:\n\n```python\n# Run the complete API test suite\npython demo/demo.py\n```\n\nThe test suite covers:\n- \u2705 Authentication and health checks\n- \u2705 Complete CRUD operations for all resource types\n- \u2705 Batch operations and bulk processing\n- \u2705 Tool execution with progress tracking\n- \u2705 Data integrity verification\n- \u2705 Automatic cleanup and state restoration\n\n## \ud83d\udcd6 Examples\n\n### Complete Workflow Example\n\n```python\nfrom lirayspy import LiRAYSApiClient\nfrom lirayspy.tools import LayerClass, GeomType, PlanStatus\n\ndef create_fiber_network_project():\n \"\"\"Complete example: Create a fiber network design project\"\"\"\n \n with LiRAYSApiClient(\"https://api.lirays.com\") as client:\n # Authenticate\n if not client.login(\"engineer@network.com\", \"password\"):\n return \"Authentication failed\"\n \n try:\n # Create project\n project = client.create_project(\n name=\"Downtown Fiber Expansion 2024\",\n description=\"High-speed fiber network expansion for downtown district\"\n )\n \n # Create analysis plan\n plan = client.create_plan(\n project_id=project[\"id\"],\n name=\"Route Optimization Analysis\",\n description=\"Optimize fiber routes for minimal cost and maximum coverage\",\n status=PlanStatus.IN_PROGRESS\n )\n \n # Create infrastructure layers\n fiber_layer = client.create_layer(\n plan_id=plan[\"id\"],\n layer_class=LayerClass.FIBER_144,\n name=\"Backbone Fiber Network\"\n )\n \n vault_layer = client.create_layer(\n plan_id=plan[\"id\"],\n layer_class=LayerClass.VAULT_24X36,\n name=\"Distribution Vaults\"\n )\n \n # Add network infrastructure\n # Main distribution points\n vault_coords = [\n [-122.4194, 37.7749], # Downtown hub\n [-122.4154, 37.7709], # South district\n [-122.4234, 37.7789] # North district\n ]\n \n vault_features = client.create_feature_batch(\n layer_id=vault_layer[\"id\"],\n geom_type=GeomType.POINT,\n features_coordinates=vault_coords\n )\n \n # Fiber backbone route\n backbone_route = client.create_feature(\n layer_id=fiber_layer[\"id\"],\n geom_type=GeomType.LINESTRING,\n coordinates=[\n [-122.4194, 37.7749],\n [-122.4184, 37.7759],\n [-122.4174, 37.7769],\n [-122.4164, 37.7779]\n ]\n )\n \n print(f\"\u2705 Created project: {project['name']}\")\n print(f\"\u2705 Created plan: {plan['name']}\")\n print(f\"\u2705 Created {len(vault_features['features'])} vault points\")\n print(f\"\u2705 Created backbone route: {backbone_route['id']}\")\n \n # Execute network analysis\n print(\"\ud83d\udd04 Running network optimization analysis...\")\n for result in client.execute_action(\n \"network_optimization\",\n config={\"optimization_type\": \"cost_distance\"},\n input_={\"plan_id\": plan[\"id\"]}\n ):\n if result.get(\"status\") == \"completed\":\n print(\"\u2705 Network analysis completed!\")\n break\n elif result.get(\"status\") == \"failed\":\n print(f\"\u274c Analysis failed: {result.get('error')}\")\n break\n \n return f\"Project '{project['name']}' created successfully!\"\n \n except Exception as e:\n return f\"Error: {e}\"\n\n# Run the example\nresult = create_fiber_network_project()\nprint(result)\n```\n\n## \ud83d\udee0\ufe0f Development\n\n### Setting up Development Environment\n\n```bash\n# Clone the repository\ngit clone https://github.com/LiRAYSgj/Lirays-Api-Python-Client.git\ncd Lirays-Api-Python-Client\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Run tests\npython demo/demo.py\n\n# Format code\nblack lirayspy/ demo/\nisort lirayspy/ demo/\n\n# Type checking\nmypy lirayspy/\n```\n\n### Running Tests\n\n```bash\n# Run the comprehensive test suite\npython demo/demo.py\n\n# The test will prompt for:\n# - API URL (default: https://api.lirays.com)\n# - Email credentials\n# - Password\n```\n\n## \ud83d\udccb Requirements\n\n- **Python**: 3.8+\n- **Dependencies**:\n - `requests >= 2.31.0` - HTTP client library\n - `typing-extensions >= 4.0.0` (for Python < 3.10)\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## \ud83e\udd1d Support\n\n- **Documentation**: [GitHub Repository](https://github.com/LiRAYSgj/Lirays-Api-Python-Client)\n- **Issues**: [Report Bug](https://github.com/LiRAYSgj/Lirays-Api-Python-Client/issues)\n- **Email**: support@lirays.com\n\n## \ud83d\udd17 Links\n\n- **PyPI Package**: [https://pypi.org/project/lirayspy/](https://pypi.org/project/lirayspy/)\n- **Source Code**: [https://github.com/LiRAYSgj/Lirays-Api-Python-Client](https://github.com/LiRAYSgj/Lirays-Api-Python-Client)\n- **LiRAYS Platform**: [https://lirays.com](https://lirays.com)\n\n---\n\n**Built with \u2764\ufe0f for the fiber network design community**\n",
"bugtrack_url": null,
"license": null,
"summary": "Python client library for LiRAYS API - Fiber Network Design",
"version": "0.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/LiRAYSgj/Lirays-Api-Python-Client/issues",
"Documentation": "https://github.com/LiRAYSgj/Lirays-Api-Python-Client#readme",
"Homepage": "https://github.com/LiRAYSgj/Lirays-Api-Python-Client",
"Repository": "https://github.com/LiRAYSgj/Lirays-Api-Python-Client"
},
"split_keywords": [
"lirays",
" api",
" gis",
" fiber",
" network",
" design"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2ba705e741ddd5707212748c42718bcd664d074f6235dd02bf00508c69d820bc",
"md5": "18c2c2d9af830362a95d6b4e5f77bf1e",
"sha256": "870f444944aa11dc91a78231c304bf7349d6831ec9ee43fd82d2c93e70b914fb"
},
"downloads": -1,
"filename": "lirayspy-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18c2c2d9af830362a95d6b4e5f77bf1e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11222,
"upload_time": "2025-08-03T01:04:59",
"upload_time_iso_8601": "2025-08-03T01:04:59.625076Z",
"url": "https://files.pythonhosted.org/packages/2b/a7/05e741ddd5707212748c42718bcd664d074f6235dd02bf00508c69d820bc/lirayspy-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "12b6d281c8490d169408ddd916c168098ecd7429ff6d917eefc8297d44c2e6dd",
"md5": "064085e97fcd29ed0d103bf3d54ee54c",
"sha256": "633724885626059a82d21f30b5d300315dfb4a579e8f306f0639fa72618a1bee"
},
"downloads": -1,
"filename": "lirayspy-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "064085e97fcd29ed0d103bf3d54ee54c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 15838,
"upload_time": "2025-08-03T01:05:00",
"upload_time_iso_8601": "2025-08-03T01:05:00.888201Z",
"url": "https://files.pythonhosted.org/packages/12/b6/d281c8490d169408ddd916c168098ecd7429ff6d917eefc8297d44c2e6dd/lirayspy-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-03 01:05:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LiRAYSgj",
"github_project": "Lirays-Api-Python-Client",
"github_not_found": true,
"lcname": "lirayspy"
}