updatefromgit


Nameupdatefromgit JSON
Version 2.0.5 PyPI version JSON
download
home_pageNone
SummaryUpdate Fabric Workspace From Git Repo using A user with Email And Password
upload_time2024-10-17 07:25:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT License Copyright (c) 2024 muhssamy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords python updatefromgit microsoft fabric
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![UpdateFromGit PyPI and TestPyPI](https://github.com/muhssamy/updatefromgit/actions/workflows/github-release.yml/badge.svg)](https://github.com/muhssamy/updatefromgit/actions/workflows/github-release.yml)

# Update From Git

This package is built on top of this [repository](https://github.com/PowerBiDevCamp/FabConWorkshopSweden).I have enhanced it to be more suitable for Azure Pipelines.

## Description

This package is designed to be used within an Azure DevOps Pipeline to update a Fabric Workspace from a Git repository using a user with an email and password. It supports both public client and confidential client applications. For more information about the differences, click [here](https://learn.microsoft.com/en-us/entra/msal/msal-client-applications)

**Note** This is currently the only available method because Microsoft does not support service principals for these operations. Once it becomes available, please use it. For more information, check Microsoft Entra supported identities [here](https://learn.microsoft.com/en-us/rest/api/fabric/core/git/update-from-git).

Another method is to schedule a notebook on Fabric running under the authority of a user who is a contributor or higher in an administration workspace using [this](https://semantic-link-labs.readthedocs.io/en/stable/sempy_labs.html#sempy_labs.update_from_git) libirary.

### Install

To install the package, use the following command:

```python
pip install updatefromgit
```

### Usage

First, import the required functions. This example uses a `confidential App` but you can use a public one and omit the `client secret`

```python
import logging
import os
import sys
import time
from azlog import AzLogger

from updatefromgit import (
    acquire_token_user_id_password_confidential,
    commit_all_items_to_git,
    get_git_status,
    update_workspace_from_git,
)

logger = AzLogger(__name__)
logger.setLevel(logging.INFO)

```

Next, create your constants:

```python
FABRIC_API_URL = "https://api.fabric.microsoft.com/v1"
CLIENT_ID = ""
TENANT_ID = ""
USERNAME = ""
PASSWORD = ""
WORKSPACE_ID = ""

```

Then, you can call the functions:

```python
access_token = acquire_token_user_id_password_confidential(
    TENANT_ID, CLIENT_ID, USERNAME, PASSWORD, CLIENT_SECRET
)
update_workspace_from_git(WORKSPACE_ID, access_token)
time.sleep(600) #adjust it per your need
workspace_head = get_git_status(WORKSPACE_ID, access_token)
commit_all_items_to_git(WORKSPACE_ID, workspace_head, access_token)
logger.command("Program Completed")

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "updatefromgit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "Muhammad Samy <muhssamy@gmail.com>",
    "keywords": "python, updatefromgit, Microsoft Fabric",
    "author": null,
    "author_email": "Muhammad Samy <muhssamy@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/68/76/1239a4404353acc14e21759af81aa940f2d603976396264371dd408c0ce2/updatefromgit-2.0.5.tar.gz",
    "platform": null,
    "description": "\n[![UpdateFromGit PyPI and TestPyPI](https://github.com/muhssamy/updatefromgit/actions/workflows/github-release.yml/badge.svg)](https://github.com/muhssamy/updatefromgit/actions/workflows/github-release.yml)\n\n# Update From Git\n\nThis package is built on top of this [repository](https://github.com/PowerBiDevCamp/FabConWorkshopSweden).I have enhanced it to be more suitable for Azure Pipelines.\n\n## Description\n\nThis package is designed to be used within an Azure DevOps Pipeline to update a Fabric Workspace from a Git repository using a user with an email and password. It supports both public client and confidential client applications. For more information about the differences, click [here](https://learn.microsoft.com/en-us/entra/msal/msal-client-applications)\n\n**Note** This is currently the only available method because Microsoft does not support service principals for these operations. Once it becomes available, please use it. For more information, check Microsoft Entra supported identities [here](https://learn.microsoft.com/en-us/rest/api/fabric/core/git/update-from-git).\n\nAnother method is to schedule a notebook on Fabric running under the authority of a user who is a contributor or higher in an administration workspace using [this](https://semantic-link-labs.readthedocs.io/en/stable/sempy_labs.html#sempy_labs.update_from_git) libirary.\n\n### Install\n\nTo install the package, use the following command:\n\n```python\npip install updatefromgit\n```\n\n### Usage\n\nFirst, import the required functions. This example uses a `confidential App` but you can use a public one and omit the `client secret`\n\n```python\nimport logging\nimport os\nimport sys\nimport time\nfrom azlog import AzLogger\n\nfrom updatefromgit import (\n    acquire_token_user_id_password_confidential,\n    commit_all_items_to_git,\n    get_git_status,\n    update_workspace_from_git,\n)\n\nlogger = AzLogger(__name__)\nlogger.setLevel(logging.INFO)\n\n```\n\nNext, create your constants:\n\n```python\nFABRIC_API_URL = \"https://api.fabric.microsoft.com/v1\"\nCLIENT_ID = \"\"\nTENANT_ID = \"\"\nUSERNAME = \"\"\nPASSWORD = \"\"\nWORKSPACE_ID = \"\"\n\n```\n\nThen, you can call the functions:\n\n```python\naccess_token = acquire_token_user_id_password_confidential(\n    TENANT_ID, CLIENT_ID, USERNAME, PASSWORD, CLIENT_SECRET\n)\nupdate_workspace_from_git(WORKSPACE_ID, access_token)\ntime.sleep(600) #adjust it per your need\nworkspace_head = get_git_status(WORKSPACE_ID, access_token)\ncommit_all_items_to_git(WORKSPACE_ID, workspace_head, access_token)\nlogger.command(\"Program Completed\")\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 muhssamy  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Update Fabric Workspace From Git Repo using A user with Email And Password",
    "version": "2.0.5",
    "project_urls": {
        "Repository": "https://github.com/muhssamy/updatefromgit"
    },
    "split_keywords": [
        "python",
        " updatefromgit",
        " microsoft fabric"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63452a1ed81254b3e696f7d33993e1a84886c03a659715555e6ed1f1f002c29c",
                "md5": "a47b26dde0c4c85150e20ac534bf281a",
                "sha256": "218fd5098f70b07c338f59d37d9c59fa00d8e4dc88c0f42caace503c125f6828"
            },
            "downloads": -1,
            "filename": "updatefromgit-2.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a47b26dde0c4c85150e20ac534bf281a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8864,
            "upload_time": "2024-10-17T07:25:06",
            "upload_time_iso_8601": "2024-10-17T07:25:06.602885Z",
            "url": "https://files.pythonhosted.org/packages/63/45/2a1ed81254b3e696f7d33993e1a84886c03a659715555e6ed1f1f002c29c/updatefromgit-2.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68761239a4404353acc14e21759af81aa940f2d603976396264371dd408c0ce2",
                "md5": "e07a348c9a8cbad1b6abab292d79cfc3",
                "sha256": "fe4cb06fadd68e65dcba35c59f1ff3425268b74d860dcab34451f11d7a3b55a3"
            },
            "downloads": -1,
            "filename": "updatefromgit-2.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "e07a348c9a8cbad1b6abab292d79cfc3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8884,
            "upload_time": "2024-10-17T07:25:07",
            "upload_time_iso_8601": "2024-10-17T07:25:07.883519Z",
            "url": "https://files.pythonhosted.org/packages/68/76/1239a4404353acc14e21759af81aa940f2d603976396264371dd408c0ce2/updatefromgit-2.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-17 07:25:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "muhssamy",
    "github_project": "updatefromgit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "updatefromgit"
}
        
Elapsed time: 0.33057s