diff --git a/.azdo/ci-pr.yaml b/.azdo/ci-pr.yaml new file mode 100644 index 0000000..89a7117 --- /dev/null +++ b/.azdo/ci-pr.yaml @@ -0,0 +1,56 @@ +# Azure DevOps PR validation pipeline +# Matches GitHub Actions workflow for consistency + +pr: +- main + +trigger: none # Only run on PRs, not on direct pushes + +pool: + vmImage: ubuntu-latest + +# Simplified to single Python version (per project requirements) +# Can expand to matrix testing later if needed + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.12' + addToPath: true + displayName: 'Use Python 3.12' + +- script: | + python -m pip install --upgrade pip + python -m pip install flake8 black build + if [ -f dev_dependencies.txt ]; then pip install -r dev_dependencies.txt; fi + displayName: 'Install dependencies' + +- script: | + black src tests --check + displayName: 'Check format with black' + +- script: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings + flake8 . --count --exit-zero --show-source --statistics + displayName: 'Lint with flake8' + +- script: | + python -m build + displayName: 'Build package' + +- script: | + python -m pip install dist/*.whl + displayName: 'Install wheel' + +- script: | + pytest + displayName: 'Test with pytest' + +- task: PublishTestResults@2 + condition: succeededOrFailed() + inputs: + testResultsFiles: '**/test-*.xml' + testRunTitle: 'Python 3.12' + displayName: 'Publish test results' diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..80bf5e4 --- /dev/null +++ b/.flake8 @@ -0,0 +1,9 @@ +[flake8] +max-line-length = 120 +max-complexity = 10 +exclude = + __pycache__ + .venv + venv + build + dist diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..47abe22 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,55 @@ +name: Python package + +permissions: + contents: read + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + # Simplified to single Python version (per project requirements) + # Can expand to matrix testing later: strategy.matrix.python-version: ["3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 black build + if [ -f dev_dependencies.txt ]; then pip install -r dev_dependencies.txt; fi + + - name: Check format with black + continue-on-error: true # TODO: fix detected formatting errors and remove this line. + run: | + black src tests --check + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings, matching Agents-for-python approach + flake8 . --count --exit-zero --show-source --statistics + + - name: Build package + run: | + python -m build + + - name: Install wheel + run: | + python -m pip install dist/*.whl + + - name: Test with pytest + run: | + pytest diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5ade441 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,73 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added +- Initial SDK implementation with CRUD operations +- Service principal authentication support +- Interactive browser authentication support +- SQL query execution via `query_sql()` +- File upload capabilities +- Pandas integration for query results +- Structured error handling with specific exception types +- GitHub Actions CI pipeline for automated testing +- Azure DevOps PR validation pipeline + +### Changed +- N/A + +### Deprecated +- N/A + +### Removed +- N/A + +### Fixed +- N/A + +### Security +- N/A + +## [0.1.0] - TBD + +### Added +- First alpha release +- Core Dataverse client with authentication +- Basic CRUD operations (create, get, update, delete) +- OData query support +- SQL query support +- Error handling framework +- Example scripts for common scenarios + +--- + +## Release Notes Template + +When creating a new release, copy this template: + +```markdown +## [X.Y.Z] - YYYY-MM-DD + +### Added +- New features + +### Changed +- Changes in existing functionality + +### Deprecated +- Soon-to-be removed features + +### Removed +- Removed features + +### Fixed +- Bug fixes + +### Security +- Security improvements or fixes +``` diff --git a/dev_dependencies.txt b/dev_dependencies.txt new file mode 100644 index 0000000..1c10927 --- /dev/null +++ b/dev_dependencies.txt @@ -0,0 +1,10 @@ +# Development dependencies for dataverse-client-python +# Install with: pip install -r dev_dependencies.txt + +pytest>=8.3.1 +pytest-asyncio>=0.21 +pytest-mock>=3.0 +black>=23.0 +flake8>=6.0 +build>=0.10 +twine>=4.0 diff --git a/pyproject.toml b/pyproject.toml index 1ca669b..f26cd28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,32 +1,32 @@ [build-system] -requires = ["setuptools>=61.0"] +requires = ["setuptools>=64"] build-backend = "setuptools.build_meta" [project] -name = "dataverse-python-client" +name = "dataverse-client-python" version = "0.1.0" -description = "Dataverse Python client" -authors = [{ name = "POC" }] -readme = "README.md" +description = "Python SDK for Microsoft Dataverse" +readme = {file = "README.md", content-type = "text/markdown"} +authors = [{name = "Microsoft Corporation"}] +license = "MIT" +license-files = ["LICENSE"] requires-python = ">=3.10" +classifiers = [ + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Operating System :: OS Independent", +] dependencies = [ - "azure-identity>=1.17.0", - "azure-core>=1.30.2", - "requests>=2.32.0", - "pytest>=8.3.1", - "pandas>=2.2.0", + "azure-identity>=1.17.0", + "azure-core>=1.30.2", + "requests>=2.32.0", + "pandas>=2.2.0", ] +[project.urls] +"Homepage" = "https://github.com/microsoft/PowerPlatform-DataverseClient-Python" + [tool.setuptools] -# Use the src/ layout package-dir = {"" = "src"} - -[tool.setuptools.packages.find] -# Discover packages under src/, include our package, and exclude non-package folders -where = ["src"] -include = ["dataverse_sdk*"] -exclude = ["tests*", "examples*"] - -[tool.pytest.ini_options] -addopts = "-q" -pythonpath = ["src"] diff --git a/src/dataverse_sdk/__init__.py b/src/dataverse_sdk/__init__.py index 1fced98..9c593a4 100644 --- a/src/dataverse_sdk/__init__.py +++ b/src/dataverse_sdk/__init__.py @@ -1,3 +1,4 @@ +from .__version__ import __version__ from .client import DataverseClient -__all__ = ["DataverseClient"] +__all__ = ["DataverseClient", "__version__"] diff --git a/src/dataverse_sdk/__version__.py b/src/dataverse_sdk/__version__.py new file mode 100644 index 0000000..d5895a7 --- /dev/null +++ b/src/dataverse_sdk/__version__.py @@ -0,0 +1,3 @@ +"""Version information for dataverse-client-python package.""" + +__version__ = "0.1.0"