Add new connectors (Phase 2)#52
Conversation
- Remove unused datetime imports from box.py, dropbox.py, ftp.py, googlecalendar.py, googledrive.py, office365groupsmail.py, onedrive.py - Remove unused field, Any, Dict imports from googletasks.py, rss.py - Fix line-too-long in office365groupsmail.py by extracting expand_value variable - All 2072 tests now pass including flake8
In Python 3.10 and 3.11, f-strings cannot nest the same quote type.
Changed inner quotes to single quotes in 6 locations:
- Line 735: quote('attachments')
- Line 806: quote('id,lastDeliveredDateTime')
- Line 809: quote('lastDeliveredDateTime desc')
- Line 966: quote('groupTypes/any(c:c eq \\'Unified\\')')
- Line 967: quote('id,displayName')
- Line 968: quote('999')
This fixes the SyntaxError: f-string: unmatched '(' error in Python 3.10/3.11.
Python 3.12+ relaxed this restriction but we need compatibility with 3.10+.
Fixes Azure DevOps pipeline failures on Python 3.10 and 3.11 test matrices.
Python 3.10/3.11 do not allow backslashes inside f-string expressions. Extract filter_value to a variable before using in f-string (line 966). This fixes: SyntaxError: f-string expression part cannot include a backslash
daviburg
left a comment
There was a problem hiding this comment.
[Dobby] Generated connector output is close after latest BPM master, but it is still not reproducible from BPM without companion generator changes.
I refreshed the local BPM repo to origin/master and rebuilt the generator before re-checking:
- BPM repo:
masterat995f7065516f8b8cc455ad096383067b9ebbbb77 - Command shape used:
LogicAppsCompiler <temp> unused --directClient --language=python --connectors=box,dropbox,excelonline,ftp,googlecalendar,googledrive,googletasks,office365groupsmail,onedriveforbusiness,rss - ARM data source: the same
westusmanagedApislist/export endpoints cached throughARMCACHE_PATH - PR head compared:
99b88e9047b64e597407e4d57290fdde5e73f857
The stale-BPM broad drift I saw earlier is mostly gone, but all 10 generated files still differ from latest BPM output. The remaining drift falls into these patterns:
-
Python 3.10/3.11-safe generated string literals.
Latest BPM master still emits nested same-quote f-strings such as:
query_params.append(f"queryParametersSingleEncoded={quote("true")}") query_params.append(f"source={quote("me")}") query_params.append(f"simulate={quote("false")}") query_params.append(f"$expand={quote("attachments")}")
The PR output changes these to single-quoted literals or locals, for example:
query_params.append(f"queryParametersSingleEncoded={quote('true')}") query_params.append(f"source={quote('me')}") expand_value = "threads($select=id;$expand=posts($select=id,createdDateTime))" query_params.append(f"$expand={quote(expand_value)}")
This is not just cosmetic: compiling latest BPM-generated
box.pyunder Python 3.11 fails withSyntaxError: f-string: unmatched '(', while the PR-extracted connector files compile under Python 3.11. Since the PR/CI matrix includes Python 3.10 and 3.11, this generator fix should live in BPM rather than only in the generated SDK output. -
Generated import cleanup.
Latest BPM output still emits unused imports in several generated files, commonly:
from datetime import datetime from typing import Optional, Any, Dict, List
The PR removes
datetimewhere no generated type uses it, and in some files narrows typing imports. That is fine for the SDK files, but it is still generated-code drift unless the BPM generator owns the import tracking change. -
One remaining method-level delta in Google Drive.
Latest BPM master output for
googledrive.pyemitsget_table_async(...), but the PR also includes:async def get_tables_async( self, dataset: str, ): """ Get sheets Retrieves sheet names from a Google Sheet file """ path = ( f"{self._connection_runtime_url}" f"/datasets/{quote(str(dataset), safe='')}/tables" ) ...
The PR samples/tests use this surface, so a future regeneration from current BPM master would drop an API this PR introduces.
Can you add/link a companion BPM repo PR that makes the Python DirectClient generator produce this PR output, then update this PR description from “No generator changes required” to the BPM PR/revision used for regeneration? I would expect the BPM-side fix to cover at least:
- Quote/default literal emission that compiles under Python 3.10/3.11.
- Import tracking so unused
datetime/typing imports are not emitted. - The Google Drive
get_tables_asyncgeneration gap, or an explanation/test proving why it should remain SDK-only. - Generator tests for the above so these edits do not need to be repeated by hand in future generated connector PRs.
…into hallvictoria/add-connectors-p2
|
Please regenerate all ten client modules from the corrected BPM generator revision in AzureUX-BPM PR 16382760 (validated at dc8d145a6b). The current SDK head predates the fix and still contains stale generated output. In particular, regeneration needs to carry forward the |
daviburg
left a comment
There was a problem hiding this comment.
Validated the regenerated output from BPM PR 16382760: path-based clients now preserve the caller value in request_url, and Google Tasks exposes create_task_async. Focused affected-client tests passed locally against this PR's source tree, and the hosted Python 3.10-3.14 matrix is green.
Follow-up suggestion: please add a regression assertion in a path-based client test (for example, test_get_file_content_by_path_success) that inspects mock_send.call_args[0][1] and verifies it contains path=/Documents/file.txt. The current tests invoke the method but only assert the response; asserting the outbound URL will prevent the original path-overwrite bug from returning.
Description
This PR adds 10 new connector clients to the Azure Connectors Python SDK with comprehensive test coverage and usage samples. This is Phase 2 of the connector rollout, expanding the SDK to support additional cloud storage providers, productivity tools, and RSS feeds.
Fixes: https://github.com/Azure/azure-functions-bucees-planning/issues/1148
Paired Generator PR
Changes
Connectors Added (10 total)
Testing
pytest)flake8 src/ tests/)Checklist
src/azure/connectors/*.py(unless regenerated)