# Welcome to pyfabricops
[](https://pypi.org/project/pyfabricops/)
[](https://opensource.org/licenses/MIT)
[](https://pypi.org/project/pyfabricops/)
[](https://peps.python.org/pep-0561/)
[](https://github.com/alisonpezzott/pyfabricops/actions/workflows/test.yml)
> A Python wrapper library for Microsoft Fabric (and Power BI) operations, providing a simple interface to the official Fabric REST APIs. Falls back to Power BI REST APIs where needed. Designed to run in Python notebooks, pure Python scripts or integrated into YAML-based workflows for CI/CD.
Access to the repositoy on [GitHub](https://github.com/alisonpezzott/pyfabricops).
## π Features
- Authenticate using environment variables (GitHub Secrets, ADO Secrets, AzKeyVault, .env ...)
- Manage workspaces, capacities, semantic models, lakehouses, reports and connections
- Execute Git operations and automate Fabric deployment flows (Power BI inclusive)
- Capture and Manage Git branches automatically for CI/CD scenarios
- Many use cases and scenarios including yaml for test and deploy using GitHub Actions
## π Documentation
Access: [https://pyfabricops.readthedocs.io/en/latest/](https://pyfabricops.readthedocs.io/en/latest/)
## β
Requirements
- Requires Python >= 3.10 <=3.12.10
## βοΈ Installation
```bash
pip install -U pyfabricops
```
## βοΈ Usage
> Create a repository and clone it locally.
> Create a notebook or a script and import the library:
```python
# Import the library
import pyfabricops as pf
```
### Set the authentication provider
> Set auth environment variables acording to your authentication method
#### Environment variables (.env, GitHub Secrets, Ado Secrets...)
```python
pf.set_auth_provider("env")
```
This is the default behavior.
You can set these in a .env file or directly in your environment (GitHub Secrets, ADO Secrets...).
Example .env file:
```
FAB_CLIENT_ID=your_client_id_here
FAB_CLIENT_SECRET=your_client_secret_here
FAB_TENANT_ID=your_tenant_id_here
FAB_USERNAME=your_username_here # Necessary for some functions with no SPN support
FAB_PASSWORD=your_password_here # Necessary for some functions with no SPN support
```
#### Azure Key Vault
```python
pf.set_auth_provider("vault")
```
Ensure you have the required Azure Key Vault secrets set:
```
AZURE_CLIENT_ID=your_azure_client_id_here
AZURE_CLIENT_SECRET=your_azure_client_secret_here
AZURE_TENANT_ID=your_azure_tenant_id_here
AZURE_KEY_VAULT_NAME=your_key_vault_name_here
```
#### OAuth (Interactive)
```python
pf.set_auth_provider("oauth")
```
This will open a browser window for user authentication.
```
> Create a repository and clone it locally.
> Prepare your environment with the required variables according to your authentication method (GitHub Secrets, ADO Secrets, AzKeyVault, .env ...)
### Branches configuration
Create a branches.json file in the root of your repository to define your branch mappings:
```json
{
"main": "-PRD",
"master": "-PRD",
"dev": "-DEV",
"staging": "-STG"
}
```
This file maps your local branches to Fabric branches, allowing the library to automatically manage branch names for CI/CD scenarios.
## πͺ Examples
Visit: [https://github.com/alisonpezzott/pyfabricops-examples](https://github.com/alisonpezzott/pyfabricops-examples)
## 𧬠Project Structure
```bash
src/
βββ pyfabricops/
βββ cicd/
β βββ __init__.py
β βββ _support_files.py
βββ orchestration/
β βββ __init__.py
β βββ _workspaces.py
βββ __init__.py
βββ _auth.py
βββ _capacities.py
βββ _connections.py
βββ _core.py
βββ _data_pipelines.py
βββ _dataflows_gen1.py
βββ _dataflows_gen2.py
βββ _decorators.py
βββ _encrypt_gateway_credentials.py
βββ _exceptions.py
βββ _fabric_items.py
βββ _folders.py
βββ _gateways.py
βββ _git.py
βββ _items.py
βββ _lakehouses.py
βββ _logging.py
βββ _notebooks.py
βββ _reports_support.py
βββ _reports.py
βββ _scopes.py
βββ _semantic_models.py
βββ _shortcuts_payloads.py
βββ _shortcuts.py
βββ _utils.py
βββ _version.py
βββ _warehouses_support.py
βββ _warehouses.py
βββ _workspaces.py
```
### Logging configuration
The custom logging system implemented in `pyfabricops` provides a complete and flexible solution for monitoring and debugging the library.
#### π¨ **Custom Formatting**
- **Automatic colors**: Different colors for each log level (DEBUG=Cyan, INFO=Green, WARNING=Yellow, ERROR=Red, CRITICAL=Magenta)
- **Multiple styles**:
- `minimal`: Only timestamp, level and message
- `standard`: Includes module name in compact form
- `detailed`: Complete format with all information
#### ποΈ **Easy Configuration**
```python
import pyfabricops as pf
# Basic configuration
pf.setup_logging(level='INFO', format_style='standard')
# Debug mode for development
pf.enable_debug_mode(include_external=False)
# Disable logging completely
pf.disable_logging()
# Reset to default configuration
pf.reset_logging()
```
For complete logging configuration options, refer to the [logging_system.md](logging_system.md)
## β€οΈContributing
1. Fork this repository
2. Create a new branch (feat/my-feature)
3. Run `poetry install` to set up the development environment
4. Run `poetry run task test` to run tests
5. Submit a pull request π
## π Publishing
### For Maintainers
To publish a new version to PyPI:
1. Update the version in `pyproject.toml` and `src/pyfabricops/_version.py`
2. Commit and push changes
3. Create a new release on GitHub with a tag (e.g., `v0.1.0`)
4. The GitHub Action will automatically:
- Run tests
- Build the package
- Publish to PyPI
### Testing with TestPyPI
```bash
# Configure TestPyPI
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry config pypi-token.testpypi <your-testpypi-token>
# Build and publish to TestPyPI
poetry build
poetry publish -r testpypi
# Install from TestPyPI
pip install --index-url https://test.pypi.org/simple/ pyfabricops
```
### Prerequisites for Publishing
- Set up a PyPI account at https://pypi.org/
- Generate an API token at https://pypi.org/manage/account/token/
- Add the token as `PYPI_TOKEN` secret in GitHub repository settings
## π Issues
If you encounter any issues, please report them at [https://github.com/alisonpezzott/pyfabricops/issues](https://github.com/alisonpezzott/pyfabricops/issues)
## βοΈ License
This project is licensed under the MIT License β see the [LICENSE](LICENSE) file for details.
## π Acknowledgements
Created and maintained by Alison Pezzott
Feedback, issues and stars are welcome π
[](https://www.youtube.com/@alisonpezzott?sub_confirmation=1)
[](https://github.com/alisonpezzott)
[](https://linkedin.com/in/alisonpezzott)
[](https://discord.gg/sJTDvWz9sM)
[](https://t.me/alisonpezzott)
[](https://instagram.com/alisonpezzott)
Raw data
{
"_id": null,
"home_page": "https://github.com/alisonpezzott/pyfabricops.git",
"name": "pyfabricops",
"maintainer": null,
"docs_url": null,
"requires_python": "<=3.12.10,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "alisonpezzott",
"author_email": "alisonpezzott@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c3/cb/6106d818dc72e041719fc8203d29c6f03d3584a9659156f34bba4365deb3/pyfabricops-0.1.23.tar.gz",
"platform": null,
"description": "# Welcome to pyfabricops\n\n[](https://pypi.org/project/pyfabricops/)\n[](https://opensource.org/licenses/MIT)\n[](https://pypi.org/project/pyfabricops/)\n[](https://peps.python.org/pep-0561/) \n[](https://github.com/alisonpezzott/pyfabricops/actions/workflows/test.yml) \n\n> A Python wrapper library for Microsoft Fabric (and Power BI) operations, providing a simple interface to the official Fabric REST APIs. Falls back to Power BI REST APIs where needed. Designed to run in Python notebooks, pure Python scripts or integrated into YAML-based workflows for CI/CD.\nAccess to the repositoy on [GitHub](https://github.com/alisonpezzott/pyfabricops).\n\n## \ud83d\ude80 Features \n\n- Authenticate using environment variables (GitHub Secrets, ADO Secrets, AzKeyVault, .env ...)\n- Manage workspaces, capacities, semantic models, lakehouses, reports and connections\n- Execute Git operations and automate Fabric deployment flows (Power BI inclusive)\n- Capture and Manage Git branches automatically for CI/CD scenarios\n- Many use cases and scenarios including yaml for test and deploy using GitHub Actions\n\n## \ud83d\udcc3 Documentation \nAccess: [https://pyfabricops.readthedocs.io/en/latest/](https://pyfabricops.readthedocs.io/en/latest/) \n\n## \u2705 Requirements \n\n- Requires Python >= 3.10 <=3.12.10 \n\n## \u2692\ufe0f Installation\n\n```bash\npip install -U pyfabricops\n```\n\n## \u2699\ufe0f Usage\n\n> Create a repository and clone it locally.\n> Create a notebook or a script and import the library:\n\n```python\n# Import the library\nimport pyfabricops as pf\n```\n\n### Set the authentication provider\n\n> Set auth environment variables acording to your authentication method \n#### Environment variables (.env, GitHub Secrets, Ado Secrets...)\n```python\npf.set_auth_provider(\"env\")\n```\n\nThis is the default behavior.\nYou can set these in a .env file or directly in your environment (GitHub Secrets, ADO Secrets...).\n\nExample .env file:\n```\nFAB_CLIENT_ID=your_client_id_here\nFAB_CLIENT_SECRET=your_client_secret_here\nFAB_TENANT_ID=your_tenant_id_here\nFAB_USERNAME=your_username_here # Necessary for some functions with no SPN support\nFAB_PASSWORD=your_password_here # Necessary for some functions with no SPN support\n```\n\n#### Azure Key Vault\n\n```python\npf.set_auth_provider(\"vault\")\n```\nEnsure you have the required Azure Key Vault secrets set:\n```\nAZURE_CLIENT_ID=your_azure_client_id_here\nAZURE_CLIENT_SECRET=your_azure_client_secret_here\nAZURE_TENANT_ID=your_azure_tenant_id_here\nAZURE_KEY_VAULT_NAME=your_key_vault_name_here\n```\n\n#### OAuth (Interactive)\n\n```python\npf.set_auth_provider(\"oauth\")\n```\nThis will open a browser window for user authentication.\n\n```\n\n> Create a repository and clone it locally.\n> Prepare your environment with the required variables according to your authentication method (GitHub Secrets, ADO Secrets, AzKeyVault, .env ...)\n\n\n### Branches configuration\n\nCreate a branches.json file in the root of your repository to define your branch mappings:\n\n```json\n{\n \"main\": \"-PRD\",\n \"master\": \"-PRD\",\n \"dev\": \"-DEV\",\n \"staging\": \"-STG\"\n}\n```\nThis file maps your local branches to Fabric branches, allowing the library to automatically manage branch names for CI/CD scenarios.\n\n\n## \ud83e\ude84 Examples\n\nVisit: [https://github.com/alisonpezzott/pyfabricops-examples](https://github.com/alisonpezzott/pyfabricops-examples)\n\n\n## \ud83e\uddec Project Structure \n\n```bash\nsrc/\n\u2514\u2500\u2500 pyfabricops/\n \u251c\u2500\u2500 cicd/\n \u2502 \u251c\u2500\u2500 __init__.py\n \u2502 \u2514\u2500\u2500 _support_files.py\n \u251c\u2500\u2500 orchestration/\n \u2502 \u251c\u2500\u2500 __init__.py\n \u2502 \u2514\u2500\u2500 _workspaces.py\n \u251c\u2500\u2500 __init__.py\n \u251c\u2500\u2500 _auth.py\n \u251c\u2500\u2500 _capacities.py\n \u251c\u2500\u2500 _connections.py\n \u251c\u2500\u2500 _core.py\n \u251c\u2500\u2500 _data_pipelines.py\n \u251c\u2500\u2500 _dataflows_gen1.py\n \u251c\u2500\u2500 _dataflows_gen2.py\n \u251c\u2500\u2500 _decorators.py\n \u251c\u2500\u2500 _encrypt_gateway_credentials.py\n \u251c\u2500\u2500 _exceptions.py\n \u251c\u2500\u2500 _fabric_items.py\n \u251c\u2500\u2500 _folders.py\n \u251c\u2500\u2500 _gateways.py\n \u251c\u2500\u2500 _git.py\n \u251c\u2500\u2500 _items.py\n \u251c\u2500\u2500 _lakehouses.py\n \u251c\u2500\u2500 _logging.py\n \u251c\u2500\u2500 _notebooks.py\n \u251c\u2500\u2500 _reports_support.py\n \u251c\u2500\u2500 _reports.py\n \u251c\u2500\u2500 _scopes.py\n \u251c\u2500\u2500 _semantic_models.py\n \u251c\u2500\u2500 _shortcuts_payloads.py\n \u251c\u2500\u2500 _shortcuts.py\n \u251c\u2500\u2500 _utils.py\n \u251c\u2500\u2500 _version.py\n \u251c\u2500\u2500 _warehouses_support.py\n \u251c\u2500\u2500 _warehouses.py\n \u2514\u2500\u2500 _workspaces.py\n``` \n\n### Logging configuration \n\nThe custom logging system implemented in `pyfabricops` provides a complete and flexible solution for monitoring and debugging the library.\n\n\n#### \ud83c\udfa8 **Custom Formatting**\n- **Automatic colors**: Different colors for each log level (DEBUG=Cyan, INFO=Green, WARNING=Yellow, ERROR=Red, CRITICAL=Magenta)\n- **Multiple styles**:\n - `minimal`: Only timestamp, level and message\n - `standard`: Includes module name in compact form\n - `detailed`: Complete format with all information\n\n#### \ud83c\udf9b\ufe0f **Easy Configuration**\n```python\nimport pyfabricops as pf\n\n# Basic configuration\npf.setup_logging(level='INFO', format_style='standard')\n\n# Debug mode for development\npf.enable_debug_mode(include_external=False)\n\n# Disable logging completely\npf.disable_logging()\n\n# Reset to default configuration\npf.reset_logging()\n``` \n\nFor complete logging configuration options, refer to the [logging_system.md](logging_system.md) \n\n\n## \u2764\ufe0fContributing\n1. Fork this repository\n2. Create a new branch (feat/my-feature)\n3. Run `poetry install` to set up the development environment\n4. Run `poetry run task test` to run tests\n5. Submit a pull request \ud83d\ude80 \n\n## \ud83d\ude80 Publishing\n\n### For Maintainers\n\nTo publish a new version to PyPI:\n\n1. Update the version in `pyproject.toml` and `src/pyfabricops/_version.py`\n2. Commit and push changes\n3. Create a new release on GitHub with a tag (e.g., `v0.1.0`)\n4. The GitHub Action will automatically:\n - Run tests\n - Build the package\n - Publish to PyPI\n\n### Testing with TestPyPI\n\n```bash\n# Configure TestPyPI\npoetry config repositories.testpypi https://test.pypi.org/legacy/\npoetry config pypi-token.testpypi <your-testpypi-token>\n\n# Build and publish to TestPyPI\npoetry build\npoetry publish -r testpypi\n\n# Install from TestPyPI\npip install --index-url https://test.pypi.org/simple/ pyfabricops\n```\n\n### Prerequisites for Publishing\n\n- Set up a PyPI account at https://pypi.org/\n- Generate an API token at https://pypi.org/manage/account/token/\n- Add the token as `PYPI_TOKEN` secret in GitHub repository settings \n\n## \ud83d\udc1e Issues \nIf you encounter any issues, please report them at [https://github.com/alisonpezzott/pyfabricops/issues](https://github.com/alisonpezzott/pyfabricops/issues) \n\n## \u2696\ufe0f License\nThis project is licensed under the MIT License \u2013 see the [LICENSE](LICENSE) file for details. \n\n## \ud83c\udf1f Acknowledgements\nCreated and maintained by Alison Pezzott\nFeedback, issues and stars are welcome \ud83c\udf1f\n\n[](https://www.youtube.com/@alisonpezzott?sub_confirmation=1)\n[](https://github.com/alisonpezzott)\n[](https://linkedin.com/in/alisonpezzott)\n[](https://discord.gg/sJTDvWz9sM)\n[](https://t.me/alisonpezzott)\n[](https://instagram.com/alisonpezzott) \n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python wrapper library for Microsoft Fabric (and Power BI) operations, providing a simple interface to the official Fabric REST APIs. Falls back to Power BI REST APIs where needed. Designed to run in Python notebooks, pure Python scripts or integrated into YAML-based workflows for CI/CD.",
"version": "0.1.23",
"project_urls": {
"Docs": "https://pyfabricops.readthedocs.io/en/latest/",
"Examples": "https://github.com/alisonpezzott/pyfabricops-examples.git",
"Homepage": "https://github.com/alisonpezzott/pyfabricops.git",
"Issues": "https://github.com/alisonpezzott/pyfabricops/issues",
"Repository": "https://github.com/alisonpezzott/pyfabricops.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7261380ec7448a641c8ed38b3b1484a4f3b478edc32449865c4326afe0b85dbc",
"md5": "d2ca9ba0238db856e6bf1223711ca7ae",
"sha256": "384a7901a9d3716ec86fc972c258e6330cc58d2766412352db7bc227e266f12b"
},
"downloads": -1,
"filename": "pyfabricops-0.1.23-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d2ca9ba0238db856e6bf1223711ca7ae",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<=3.12.10,>=3.10",
"size": 107726,
"upload_time": "2025-07-19T21:27:30",
"upload_time_iso_8601": "2025-07-19T21:27:30.958470Z",
"url": "https://files.pythonhosted.org/packages/72/61/380ec7448a641c8ed38b3b1484a4f3b478edc32449865c4326afe0b85dbc/pyfabricops-0.1.23-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c3cb6106d818dc72e041719fc8203d29c6f03d3584a9659156f34bba4365deb3",
"md5": "2f41c5e0000a509996879bab726753a5",
"sha256": "7ed48321716f6cff139c73fb63e576c713a869d3963d9a3f0a3f6a2ffa913f86"
},
"downloads": -1,
"filename": "pyfabricops-0.1.23.tar.gz",
"has_sig": false,
"md5_digest": "2f41c5e0000a509996879bab726753a5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<=3.12.10,>=3.10",
"size": 87745,
"upload_time": "2025-07-19T21:27:32",
"upload_time_iso_8601": "2025-07-19T21:27:32.204555Z",
"url": "https://files.pythonhosted.org/packages/c3/cb/6106d818dc72e041719fc8203d29c6f03d3584a9659156f34bba4365deb3/pyfabricops-0.1.23.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-19 21:27:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alisonpezzott",
"github_project": "pyfabricops",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "azure-storage-blob",
"specs": [
[
"==",
"12.25.1"
]
]
},
{
"name": "azure-identity",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "azure-keyvault-secrets",
"specs": [
[
"==",
"4.9.0"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"3.4.6"
]
]
},
{
"name": "json5",
"specs": [
[
"==",
"0.9.28"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"2.3.0"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
"==",
"1.1.1"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.4"
]
]
}
],
"lcname": "pyfabricops"
}