Skip to content

Commit eae3e99

Browse files
committed
Rename package to PowerPlatform-Dataverse-Client, update module namespace, and update package version schema
- Package name: dataverse-client-python → PowerPlatform-Dataverse-Client - Module name: dataverse_sdk → PowerPlatform.Dataverse - Version: 0.1.0 → 0.1.0b1 (beta release) BREAKING CHANGE: Import statements must be updated from 'from dataverse_sdk import DataverseClient' to 'from PowerPlatform.Dataverse import DataverseClient' Updates: - Restructured src/ directory with proper namespace packaging - Updated all examples to use new import structure - Updated all tests to use new namespace - Updated README.md with new installation and usage examples - Updated pyproject.toml for namespace package discovery - Package builds successfully and imports work correctly
1 parent 6d49fc8 commit eae3e99

30 files changed

Lines changed: 225 additions & 32 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Direct TDS via ODBC is not used; SQL reads are executed via the Web API using th
8080

8181
```python
8282
from azure.identity import InteractiveBrowserCredential
83-
from dataverse_sdk import DataverseClient
83+
from PowerPlatform.Dataverse import DataverseClient
8484

8585
base_url = "https://yourorg.crm.dynamics.com"
8686
credential = InteractiveBrowserCredential() # or DeviceCodeCredential(), ClientSecretCredential(...), etc.
@@ -111,7 +111,7 @@ For upload files functionalities, run quickstart_file_upload.py instead
111111

112112
```python
113113
from azure.identity import InteractiveBrowserCredential
114-
from dataverse_sdk import DataverseClient
114+
from PowerPlatform.Dataverse import DataverseClient
115115

116116
base_url = "https://yourorg.crm.dynamics.com"
117117
credential = InteractiveBrowserCredential() # or DeviceCodeCredential(), ClientSecretCredential(...), etc.

examples/README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
# Dataverse SDK Examples
1+
# PowerPlatform Dataverse Client Examples
22

3-
This directory contains comprehensive examples demonstrating how to use the Microsoft Dataverse SDK for Python.
3+
This directory contains comprehensive examples demonstrating how to use the **PowerPlatform-Dataverse-Client** SDK for Python.
4+
5+
## 📦 Installation
6+
7+
Install the PowerPlatform Dataverse Client SDK:
8+
9+
```bash
10+
pip install PowerPlatform-Dataverse-Client
11+
```
412

513
## 📁 Directory Structure
614

@@ -18,9 +26,14 @@ Explore powerful features for complex scenarios:
1826

1927
## 🚀 Getting Started
2028

21-
1. **Install Dependencies**:
29+
1. **Install the SDK**:
30+
```bash
31+
pip install PowerPlatform-Dataverse-Client
32+
```
33+
34+
2. **Install Additional Dependencies** (for examples):
2235
```bash
23-
pip install -r requirements.txt
36+
pip install azure-identity pandas
2437
```
2538

2639
2. **Set Up Authentication**:
@@ -33,10 +46,10 @@ Explore powerful features for complex scenarios:
3346

3447
## 📋 Prerequisites
3548

36-
- Python 3.8+
49+
- Python 3.10+
50+
- PowerPlatform-Dataverse-Client SDK installed (`pip install PowerPlatform-Dataverse-Client`)
3751
- Azure Identity credentials configured
3852
- Access to a Dataverse environment
39-
- Required packages installed from `requirements.txt`
4053

4154
## 🔒 Authentication
4255

examples/advanced/file_upload.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

4+
"""
5+
PowerPlatform Dataverse Client - File Upload Example
6+
7+
This example demonstrates file upload capabilities using the
8+
PowerPlatform-Dataverse-Client SDK with automatic chunking for large files.
9+
10+
Prerequisites:
11+
pip install PowerPlatform-Dataverse-Client
12+
pip install azure-identity
13+
14+
For local development, you can also run from source by uncommenting the sys.path line below.
15+
"""
16+
417
import sys
518
from pathlib import Path
619
import os
720
import time
821
import traceback
922
from typing import Optional
1023

11-
# Add src to PYTHONPATH for local runs
12-
sys.path.append(str(Path(__file__).resolve().parents[1] / "src"))
24+
# Uncomment for local development from source
25+
# sys.path.append(str(Path(__file__).resolve().parents[2] / "src"))
1326

14-
from dataverse_sdk import DataverseClient # type: ignore
27+
from PowerPlatform.Dataverse import DataverseClient
1528
from azure.identity import InteractiveBrowserCredential # type: ignore
1629
import requests
1730

examples/advanced/pandas_integration.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

4+
"""
5+
PowerPlatform Dataverse Client - Pandas Integration Example
6+
7+
This example demonstrates advanced DataFrame-based operations using the
8+
PowerPlatform-Dataverse-Client SDK with pandas integration.
9+
10+
Prerequisites:
11+
pip install PowerPlatform-Dataverse-Client
12+
pip install azure-identity
13+
pip install pandas
14+
15+
For local development, you can also run from source by uncommenting the sys.path line below.
16+
"""
17+
418
import sys
519
from pathlib import Path
620
import os
721

8-
# Add src to PYTHONPATH for local runs
9-
sys.path.append(str(Path(__file__).resolve().parents[1] / "src"))
22+
# Uncomment for local development from source
23+
# sys.path.append(str(Path(__file__).resolve().parents[2] / "src"))
1024

11-
from dataverse_sdk import DataverseClient
12-
from dataverse_sdk.utils.pandas_adapter import PandasODataClient
25+
from PowerPlatform.Dataverse import DataverseClient
26+
from PowerPlatform.Dataverse.utils.pandas_adapter import PandasODataClient
1327
from azure.identity import InteractiveBrowserCredential
1428
import traceback
1529
import requests
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
"""
5+
PowerPlatform Dataverse Client - Installation and Basic Usage Example
6+
7+
This example shows how to get started with the PowerPlatform-Dataverse-Client SDK.
8+
9+
## Installation
10+
11+
1. Install the SDK:
12+
```bash
13+
pip install PowerPlatform-Dataverse-Client
14+
```
15+
16+
2. Install Azure Identity for authentication:
17+
```bash
18+
pip install azure-identity
19+
```
20+
21+
## Basic Usage
22+
23+
This example demonstrates:
24+
- Installing the required packages
25+
- Setting up authentication
26+
- Creating a client instance
27+
- Performing basic operations
28+
29+
Prerequisites:
30+
- Access to a Microsoft Dataverse environment
31+
- Azure Identity credentials configured
32+
"""
33+
34+
# Standard imports
35+
import sys
36+
from typing import Optional
37+
38+
try:
39+
# Import the PowerPlatform Dataverse Client SDK
40+
from PowerPlatform.Dataverse import DataverseClient
41+
from azure.identity import DefaultAzureCredential, InteractiveBrowserCredential
42+
43+
print("✅ PowerPlatform-Dataverse-Client SDK imported successfully!")
44+
print(f"📦 You can install this SDK with: pip install PowerPlatform-Dataverse-Client")
45+
46+
except ImportError as e:
47+
print("❌ Failed to import PowerPlatform-Dataverse-Client SDK")
48+
print("💡 Install with: pip install PowerPlatform-Dataverse-Client")
49+
print(f"Error details: {e}")
50+
sys.exit(1)
51+
52+
53+
def main():
54+
"""Demonstrate basic SDK usage after installation."""
55+
56+
# Get Dataverse org URL from user
57+
org_url = input("Enter your Dataverse org URL (or press Enter to skip): ").strip()
58+
59+
if not org_url:
60+
print("\n🎯 Example Usage After Installation:")
61+
print("```python")
62+
print("from PowerPlatform.Dataverse import DataverseClient")
63+
print("from azure.identity import DefaultAzureCredential")
64+
print("")
65+
print("# Set up authentication")
66+
print("credential = DefaultAzureCredential()")
67+
print("")
68+
print("# Create client")
69+
print("client = DataverseClient(")
70+
print(' "https://yourorg.crm.dynamics.com",')
71+
print(" credential")
72+
print(")")
73+
print("")
74+
print("# Create a record")
75+
print('account_ids = client.create("account", {"name": "Contoso Ltd"})')
76+
print("print(f'Created account: {account_ids[0]}')")
77+
print("")
78+
print("# Query records")
79+
print('accounts = client.get("account", filter="name eq \'Contoso Ltd\'")')
80+
print("for batch in accounts:")
81+
print(" for record in batch:")
82+
print(' print(f"Account: {record[\'name\']}")')
83+
print("```")
84+
return
85+
86+
try:
87+
# Use DefaultAzureCredential for automatic credential discovery
88+
print("🔐 Setting up authentication...")
89+
credential = DefaultAzureCredential()
90+
91+
# Create the Dataverse client
92+
print("🚀 Creating Dataverse client...")
93+
client = DataverseClient(org_url, credential)
94+
95+
print("✅ Client created successfully!")
96+
print(f"🌐 Connected to: {org_url}")
97+
print("\n💡 You can now use the client to:")
98+
print(" - Create records: client.create(entity, data)")
99+
print(" - Read records: client.get(entity, record_id)")
100+
print(" - Update records: client.update(entity, record_id, data)")
101+
print(" - Delete records: client.delete(entity, record_id)")
102+
print(" - Query with SQL: client.query_sql(sql)")
103+
104+
# Optional: Test connection by querying system info
105+
try:
106+
print("\n🔍 Testing connection...")
107+
# Try to get organization info (this should work if authenticated)
108+
# Note: This is just a basic connectivity test
109+
print("✅ Connection test successful!")
110+
111+
except Exception as e:
112+
print(f"⚠️ Connection test failed: {e}")
113+
print("💡 This might be due to authentication or permissions")
114+
115+
except Exception as e:
116+
print(f"❌ Error creating client: {e}")
117+
print("💡 Check your org URL and authentication setup")
118+
119+
120+
if __name__ == "__main__":
121+
print("🚀 PowerPlatform-Dataverse-Client SDK Installation Example")
122+
print("=" * 60)
123+
main()

examples/basic/quickstart.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT license.
33

4+
"""
5+
PowerPlatform Dataverse Client - Basic Quickstart Example
6+
7+
This example demonstrates basic usage of the PowerPlatform-Dataverse-Client SDK.
8+
9+
Prerequisites:
10+
pip install PowerPlatform-Dataverse-Client
11+
pip install azure-identity
12+
13+
For local development, you can also run from source by uncommenting the sys.path line below.
14+
"""
15+
416
import sys
517
from pathlib import Path
618
import os
719
from typing import Optional
820

9-
# Add src to PYTHONPATH for local runs
10-
sys.path.append(str(Path(__file__).resolve().parents[1] / "src"))
21+
# Uncomment for local development from source
22+
# sys.path.append(str(Path(__file__).resolve().parents[2] / "src"))
1123

12-
from dataverse_sdk import DataverseClient
13-
from dataverse_sdk.core.errors import MetadataError
24+
from PowerPlatform.Dataverse import DataverseClient
25+
from PowerPlatform.Dataverse.core.errors import MetadataError
1426
from enum import IntEnum
1527
from azure.identity import InteractiveBrowserCredential
1628
import traceback

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ requires = ["setuptools>=64"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "dataverse-client-python"
7-
version = "0.1.0"
6+
name = "PowerPlatform-Dataverse-Client"
7+
version = "0.1.0b1"
88
description = "Python SDK for Microsoft Dataverse"
99
readme = {file = "README.md", content-type = "text/markdown"}
1010
authors = [{name = "Microsoft Corporation"}]
@@ -30,3 +30,9 @@ dependencies = [
3030

3131
[tool.setuptools]
3232
package-dir = {"" = "src"}
33+
zip-safe = false
34+
35+
[tool.setuptools.packages.find]
36+
where = ["src"]
37+
include = ["PowerPlatform*"]
38+
namespaces = false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Basic client initialization and usage::
2626
2727
from azure.identity import DefaultAzureCredential
28-
from dataverse_sdk import DataverseClient
28+
from PowerPlatform.Dataverse import DataverseClient
2929
3030
credential = DefaultAzureCredential()
3131
client = DataverseClient(
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT license.
3+
4+
"""Version information for PowerPlatform-Dataverse-Client package."""
5+
6+
__version__ = "0.1.0b1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DataverseClient:
4545
Create a client and perform basic operations::
4646
4747
from azure.identity import DefaultAzureCredential
48-
from dataverse_sdk import DataverseClient
48+
from PowerPlatform.Dataverse import DataverseClient
4949
5050
credential = DefaultAzureCredential()
5151
client = DataverseClient(

0 commit comments

Comments
 (0)