msdev-kit 0.1.7__tar.gz → 0.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- msdev_kit-0.1.8/LICENSE +21 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/PKG-INFO +36 -1
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/README.md +33 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/__init__.py +1 -1
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/dataflow.py +117 -1
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/pyproject.toml +2 -1
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/auth.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/__init__.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/admin.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/capacity.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/database.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/dataset.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/kql.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/notebook.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/operations.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/pipeline.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/report.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/utilities.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/fabric/workspace.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/graph/__init__.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/graph/client.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/sharepoint/__init__.py +0 -0
- {msdev_kit-0.1.7 → msdev_kit-0.1.8}/msdev_kit/sharepoint/client.py +0 -0
msdev_kit-0.1.8/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bernardo Rufino
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: msdev-kit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: Microsoft developer toolkit: Fabric, MS Graph, and SharePoint
|
|
5
5
|
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Bernardo Rufino
|
|
7
8
|
Author-email: contact@bernardorufino.com
|
|
8
9
|
Requires-Python: >=3.10
|
|
@@ -19,6 +20,7 @@ Requires-Dist: cryptography (>=46.0.6,<47.0.0)
|
|
|
19
20
|
Requires-Dist: numpy (==2.1.3)
|
|
20
21
|
Requires-Dist: openpyxl (==3.1.5)
|
|
21
22
|
Requires-Dist: pandas (==2.2.3)
|
|
23
|
+
Requires-Dist: pydantic (>=2.13.4,<3.0.0)
|
|
22
24
|
Requires-Dist: pyodbc (==5.2.0)
|
|
23
25
|
Requires-Dist: python-dotenv (>=1.2.2,<2)
|
|
24
26
|
Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
|
|
@@ -36,6 +38,10 @@ Microsoft developer toolkit for Python: Fabric/Power BI, MS Graph (Entra), and S
|
|
|
36
38
|
[](https://pypi.org/project/msdev-kit/)
|
|
37
39
|
[](https://opensource.org/licenses/MIT)
|
|
38
40
|
|
|
41
|
+
> Until 2026-06-17 this package was developed in a private repository. The git
|
|
42
|
+
> history was squashed when the project was opened to the public, so commits
|
|
43
|
+
> before that date are not preserved.
|
|
44
|
+
|
|
39
45
|
## Installation
|
|
40
46
|
|
|
41
47
|
```shell
|
|
@@ -396,3 +402,32 @@ Hostname and site path inputs are normalized automatically:
|
|
|
396
402
|
- Datasets hosted in Azure Analysis Services or with a live connection to on-premises AAS are not supported.
|
|
397
403
|
- Service Principals are not supported for datasets with RLS or SSO enabled.
|
|
398
404
|
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## Examples
|
|
408
|
+
|
|
409
|
+
End-to-end scripts for the most common scenarios live in [`examples/`](./examples).
|
|
410
|
+
They share a small `_setup.py` that builds Auth and the service clients from
|
|
411
|
+
environment variables (or `./utils/.env`). Run any of them from the repo root:
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
python -m examples.workspaces
|
|
415
|
+
python -m examples.dataflows
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## Contributing
|
|
421
|
+
|
|
422
|
+
External contributions are welcome via pull requests. Please:
|
|
423
|
+
|
|
424
|
+
1. Open an issue first for non-trivial changes so the design can be discussed.
|
|
425
|
+
2. Use `feature/<name>` / `fix/<name>` branches. Direct pushes to `main` are
|
|
426
|
+
blocked by repository rulesets.
|
|
427
|
+
3. Keep PRs focused. Add or update tests under `tests/` for any behavior change.
|
|
428
|
+
4. Run `pytest` locally before opening a PR; the `Collaboration` workflow runs
|
|
429
|
+
the same suite on every PR and must pass before merging.
|
|
430
|
+
|
|
431
|
+
PyPI releases are published automatically from `main` by the `Publish to PyPI`
|
|
432
|
+
workflow, gated by a manual approval on the `pypi` environment.
|
|
433
|
+
|
|
@@ -6,6 +6,10 @@ Microsoft developer toolkit for Python: Fabric/Power BI, MS Graph (Entra), and S
|
|
|
6
6
|
[](https://pypi.org/project/msdev-kit/)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
+
> Until 2026-06-17 this package was developed in a private repository. The git
|
|
10
|
+
> history was squashed when the project was opened to the public, so commits
|
|
11
|
+
> before that date are not preserved.
|
|
12
|
+
|
|
9
13
|
## Installation
|
|
10
14
|
|
|
11
15
|
```shell
|
|
@@ -365,3 +369,32 @@ Hostname and site path inputs are normalized automatically:
|
|
|
365
369
|
- Only **DAX** queries are supported (no MDX, INFO functions, or DMV).
|
|
366
370
|
- Datasets hosted in Azure Analysis Services or with a live connection to on-premises AAS are not supported.
|
|
367
371
|
- Service Principals are not supported for datasets with RLS or SSO enabled.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## Examples
|
|
376
|
+
|
|
377
|
+
End-to-end scripts for the most common scenarios live in [`examples/`](./examples).
|
|
378
|
+
They share a small `_setup.py` that builds Auth and the service clients from
|
|
379
|
+
environment variables (or `./utils/.env`). Run any of them from the repo root:
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
python -m examples.workspaces
|
|
383
|
+
python -m examples.dataflows
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## Contributing
|
|
389
|
+
|
|
390
|
+
External contributions are welcome via pull requests. Please:
|
|
391
|
+
|
|
392
|
+
1. Open an issue first for non-trivial changes so the design can be discussed.
|
|
393
|
+
2. Use `feature/<name>` / `fix/<name>` branches. Direct pushes to `main` are
|
|
394
|
+
blocked by repository rulesets.
|
|
395
|
+
3. Keep PRs focused. Add or update tests under `tests/` for any behavior change.
|
|
396
|
+
4. Run `pytest` locally before opening a PR; the `Collaboration` workflow runs
|
|
397
|
+
the same suite on every PR and must pass before merging.
|
|
398
|
+
|
|
399
|
+
PyPI releases are published automatically from `main` by the `Publish to PyPI`
|
|
400
|
+
workflow, gated by a manual approval on the `pypi` environment.
|
|
@@ -7,11 +7,23 @@ import time
|
|
|
7
7
|
import base64
|
|
8
8
|
import requests
|
|
9
9
|
import pandas as pd
|
|
10
|
-
from typing import Dict, List
|
|
10
|
+
from typing import Dict, List, Optional
|
|
11
|
+
from pydantic import BaseModel, ConfigDict
|
|
11
12
|
from .utilities import create_directory
|
|
12
13
|
from .workspace import Workspace
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
class ComputeEngineSettingsModel(BaseModel):
|
|
17
|
+
model_config = ConfigDict(extra='forbid')
|
|
18
|
+
|
|
19
|
+
allowFastCopy: Optional[bool] = None
|
|
20
|
+
allowPartitionedCompute: Optional[bool] = None
|
|
21
|
+
allowModernEvaluationEngine: Optional[bool] = None
|
|
22
|
+
enableVorder: Optional[bool] = None
|
|
23
|
+
enableOptimizedCopyToLakehouse: Optional[bool] = None
|
|
24
|
+
maxConcurrency: Optional[int] = None
|
|
25
|
+
|
|
26
|
+
|
|
15
27
|
class Dataflow:
|
|
16
28
|
|
|
17
29
|
def __init__(self, token: str):
|
|
@@ -475,6 +487,110 @@ class Dataflow:
|
|
|
475
487
|
return {'message': {'error': error_message, 'status_code': response.status_code}}
|
|
476
488
|
|
|
477
489
|
|
|
490
|
+
def update_compute_engine_settings(self, workspace_id: str, dataflow_id: str, settings: Dict = None) -> Dict:
|
|
491
|
+
"""
|
|
492
|
+
Updates the computeEngineSettings of a Dataflow Gen2 CI/CD (native Fabric) item.
|
|
493
|
+
Only works for Dataflow Gen2 (CI/CD) items.
|
|
494
|
+
|
|
495
|
+
Args:
|
|
496
|
+
workspace_id (str): The ID of the workspace where the Dataflow Gen2 resides.
|
|
497
|
+
dataflow_id (str): The ID of the Dataflow Gen2 to update.
|
|
498
|
+
settings (Dict, optional): Custom compute engine settings. If not provided,
|
|
499
|
+
uses the default configuration.
|
|
500
|
+
|
|
501
|
+
Returns:
|
|
502
|
+
Dict: status message and content of the updated dataflow.
|
|
503
|
+
"""
|
|
504
|
+
# Validate settings using Pydantic if provided
|
|
505
|
+
if settings is not None:
|
|
506
|
+
try:
|
|
507
|
+
validated = ComputeEngineSettingsModel(**settings)
|
|
508
|
+
settings = validated.model_dump(exclude_unset=True)
|
|
509
|
+
except Exception as e:
|
|
510
|
+
return {'message': {'error': f'Invalid compute engine settings: {e}'}}
|
|
511
|
+
|
|
512
|
+
# Fetch current definition
|
|
513
|
+
definition_result = self.get_dataflow_gen2_definition(workspace_id, dataflow_id)
|
|
514
|
+
if definition_result.get('message') != 'Success':
|
|
515
|
+
# Not a CI/CD Gen2.1 dataflow or error fetching
|
|
516
|
+
return {
|
|
517
|
+
'message': {
|
|
518
|
+
'error': 'This dataflow is not a Dataflow Gen2 CI/CD or could not retrieve its definition.',
|
|
519
|
+
'details': definition_result.get('message')
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
definition = definition_result['content']
|
|
524
|
+
display_name = self.get_dataflow_name(workspace_id, dataflow_id) or 'dataflow'
|
|
525
|
+
|
|
526
|
+
# Modify computeEngineSettings in queryMetadata.json
|
|
527
|
+
parts = definition.get('definition', {}).get('parts', [])
|
|
528
|
+
patched = False
|
|
529
|
+
|
|
530
|
+
for part in parts:
|
|
531
|
+
if part.get('path') == 'queryMetadata.json':
|
|
532
|
+
payload = part.get('payload')
|
|
533
|
+
if payload:
|
|
534
|
+
try:
|
|
535
|
+
metadata_bytes = base64.b64decode(payload)
|
|
536
|
+
try:
|
|
537
|
+
decoded_str = metadata_bytes.decode('utf-8-sig')
|
|
538
|
+
except UnicodeDecodeError:
|
|
539
|
+
decoded_str = metadata_bytes.decode('utf-8', errors='replace')
|
|
540
|
+
|
|
541
|
+
metadata = json.loads(decoded_str)
|
|
542
|
+
|
|
543
|
+
current_engine_settings = metadata.get('computeEngineSettings', {})
|
|
544
|
+
new_engine_settings = {}
|
|
545
|
+
|
|
546
|
+
# Keep both old and new keys allowed in the schema
|
|
547
|
+
allowed_keys = [
|
|
548
|
+
"allowFastCopy",
|
|
549
|
+
"allowPartitionedCompute",
|
|
550
|
+
"allowModernEvaluationEngine",
|
|
551
|
+
"enableVorder",
|
|
552
|
+
"enableOptimizedCopyToLakehouse",
|
|
553
|
+
"maxConcurrency"
|
|
554
|
+
]
|
|
555
|
+
for key in allowed_keys:
|
|
556
|
+
if key in current_engine_settings:
|
|
557
|
+
new_engine_settings[key] = current_engine_settings[key]
|
|
558
|
+
|
|
559
|
+
if settings is not None:
|
|
560
|
+
# Update existing settings with user-provided settings
|
|
561
|
+
for k, v in settings.items():
|
|
562
|
+
new_engine_settings[k] = v
|
|
563
|
+
|
|
564
|
+
# If maxConcurrency is not in settings, remove it
|
|
565
|
+
if 'maxConcurrency' not in settings:
|
|
566
|
+
new_engine_settings.pop('maxConcurrency', None)
|
|
567
|
+
else:
|
|
568
|
+
# Default settings if none provided (without maxConcurrency)
|
|
569
|
+
new_engine_settings = {
|
|
570
|
+
"allowFastCopy": False,
|
|
571
|
+
"allowPartitionedCompute": True,
|
|
572
|
+
"allowModernEvaluationEngine": True,
|
|
573
|
+
"enableVorder": False,
|
|
574
|
+
"enableOptimizedCopyToLakehouse": True
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
metadata['computeEngineSettings'] = new_engine_settings
|
|
578
|
+
|
|
579
|
+
# Minify and encode
|
|
580
|
+
updated_bytes = json.dumps(metadata, ensure_ascii=False, separators=(',', ':')).encode('utf-8')
|
|
581
|
+
part['payload'] = base64.b64encode(updated_bytes).decode('utf-8')
|
|
582
|
+
patched = True
|
|
583
|
+
except Exception as e:
|
|
584
|
+
return {'message': {'error': f'Failed to patch queryMetadata.json: {e}'}}
|
|
585
|
+
break
|
|
586
|
+
|
|
587
|
+
if not patched:
|
|
588
|
+
return {'message': {'error': 'queryMetadata.json not found in dataflow definition.'}}
|
|
589
|
+
|
|
590
|
+
# Call update_dataflow_gen2_from_definition to save changes
|
|
591
|
+
return self.update_dataflow_gen2_from_definition(workspace_id, dataflow_id, display_name, definition)
|
|
592
|
+
|
|
593
|
+
|
|
478
594
|
def _rewrite_data_destination_queries(self, m_code: str, destination_type: str,
|
|
479
595
|
destination_workspace_id: str,
|
|
480
596
|
destination_item_id: str) -> str:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "msdev-kit"
|
|
3
3
|
description = "Microsoft developer toolkit: Fabric, MS Graph, and SharePoint"
|
|
4
|
-
version = "0.1.
|
|
4
|
+
version = "0.1.8"
|
|
5
5
|
requires-python = ">=3.10"
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
license = {text = "MIT"}
|
|
@@ -21,6 +21,7 @@ dependencies = [
|
|
|
21
21
|
"pyyaml (>=6.0.3,<7.0.0)",
|
|
22
22
|
"azure-kusto-data (>=6.0.1,<7.0.0)",
|
|
23
23
|
"cryptography (>=46.0.6,<47.0.0)",
|
|
24
|
+
"pydantic (>=2.13.4,<3.0.0)",
|
|
24
25
|
]
|
|
25
26
|
|
|
26
27
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|