Dataverse-Python-Best-Practices
Dataverse-Python-Best-Practices是一款code方向的AI技能,核心价值是# Dataverse SDK for Python - Best Practices Guide ## Overview Production-ready patterns and best practices extracted from Microsoft's official PowerPlatform-DataverseClient-Python repository, example,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
# Dataverse SDK for Python - Best Practices Guide ## Overview Production-ready patterns and best practices extracted from Microsoft's official PowerPlatform-DataverseClient-Python repository, example
mkdir -p ./skills/dataverse-python-best-practices && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/dataverse-python-best-practices/SKILL.md -o ./skills/dataverse-python-best-practices/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
# Dataverse SDK for Python - Best Practices Guide
Overview
Production-ready patterns and best practices extracted from Microsoft's official PowerPlatform-DataverseClient-Python repository, examples, and recommended workflows.
1. Installation & Environment Setup
Production Installation
# Install the published SDK from PyPI
pip install PowerPlatform-Dataverse-Client
# Install Azure Identity for authentication
pip install azure-identity
# Optional: pandas integration for data manipulation
pip install pandasDevelopment Installation
# Clone the repository
git clone https://github.com/microsoft/PowerPlatform-DataverseClient-Python.git
cd PowerPlatform-DataverseClient-Python
# Install in editable mode for live development
pip install -e .
# Install development dependencies
pip install pytest pytest-cov black isort mypy ruffPython Version Support
- **Minimum**: Python 3.10
- **Recommended**: Python 3.11+ for best performance
- **Supported**: Python 3.10, 3.11, 3.12, 3.13, 3.14
Verify Installation
from PowerPlatform.Dataverse import __version__
from PowerPlatform.Dataverse.client import DataverseClient
from azure.identity import InteractiveBrowserCredential
print(f"SDK Version: {__version__}")
print("Installation successful!")---
2. Authentication Patterns
Interactive Development (Browser-Based)
from azure.identity import InteractiveBrowserCredential
from PowerPlatform.Dataverse.client import DataverseClient
credential = InteractiveBrowserCredential()
client = DataverseClient("https://yourorg.crm.dynamics.com", credential)**When to use:** Local development, interactive testing, single-user scenarios.
Production (Client Secret)
from azure.identity import ClientSecretCredential
from PowerPlatform.Dataverse.client import DataverseClient
credential = ClientSecretCredential(
tenant_id="your-tenant-id",
client_id="your-client-id",
client_secret="your-client-secret"
)
client = DataverseClient("https://yourorg.crm.dynamics.com", credential)**When to use:** Server-side applications, Azure automation, scheduled jobs.
Certificate-Based Authentication
from azure.identity import ClientCertificateCredential
from PowerPlatform.Dataverse.client import DataverseClient
credential = ClientCertificateCredential(
tenant_id="your-tenant-id",
client_id="your-client-id",
certificate_path="path/to/certificate.pem"
)
client = DataverseClient("https://yourorg.crm.dynamics.com", credential)**When to use:** Highly secure environments, certificate-pinning requirements.
Azure CLI Authentication
from azure.identity import AzureCliCredential
from PowerPlatform.Dataverse.client import DataverseClient
credential = AzureCliCredential()
client = DataverseClient("https://yourorg.crm.dynamics.com", credential)**When to use:** Local testing with Azure CLI installed, Azure DevOps pipelines.
---
3. Singleton Client Pattern
**Best Practice**: Create one `DataverseClient` instance and reuse it throughout your application.
# ❌ ANTI-PATTERN: Creating new clients repeatedly
def fetch_account(account_id):
credential = InteractiveBrowserCredential()
client = DataverseClient("https://yourorg.crm.dynamics.com", credential)
return client.get("account", account_id)
# ✅ PATTERN: Singleton client
class DataverseService:
_instance = None
def __new__(cls):
if cls._instance is None:
credential = InteractiveBrowserCredential()
cls._instance = DataverseClient(
"https://yourorg.crm.dynamics.com",
credential
)
return cls._instance
# Usage
service = DataverseService()
account = service.get("account", account_id)---
4. Configuration Optimization
Connection Settings
from PowerPlatform.Dataverse.core.config import DataverseConfig
from PowerPlatform.Dataverse.cli🎯 Best For
- UI designers
- Product designers
- Claude users
- GitHub Copilot users
- Software engineers
💡 Use Cases
- Generating component mockups
- Creating design system tokens
- Python code quality enforcement
- Dependency management
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply Dataverse-Python-Best-Practices to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Does this work with Figma?
Some design skills integrate with Figma plugins. Check the Works With section for supported tools.
Is Dataverse-Python-Best-Practices compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for Dataverse-Python-Best-Practices?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install Dataverse-Python-Best-Practices?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/dataverse-python-best-practices/SKILL.md, ready to use.
Can I customize this skill for my team?
Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.
⚠️ Common Mistakes to Avoid
Skipping usability testing
AI-generated designs should be validated with real users before development.
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.