prefect-bitbucket


Nameprefect-bitbucket JSON
Version 0.2.3 PyPI version JSON
download
home_pageNone
SummaryPrefect integrations for working with Bitbucket repositories.
upload_time2024-04-25 19:22:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseApache License 2.0
keywords prefect
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # prefect-bitbucket

<p align="center">
    <a href="https://pypi.python.org/pypi/prefect-bitbucket/" alt="PyPI version">
        <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-bitbucket?color=0052FF&labelColor=090422"></a>
    <a href="https://pepy.tech/badge/prefect-bitbucket/" alt="Downloads">
        <img src="https://img.shields.io/pypi/dm/prefect-bitbucket?color=0052FF&labelColor=090422" /></a>
</p>


## Welcome!

Prefect integrations for working with Bitbucket repositories.

## Getting Started

### Python setup

Requires an installation of Python 3.8+.

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://docs.prefect.io/).

### Installation

Install `prefect-bitbucket` with `pip`:

```bash
pip install prefect-bitbucket
```

Then, register to [view the block](https://docs.prefect.io/ui/blocks/) on Prefect Cloud:

```bash
prefect block register -m prefect_bitbucket
```

Note, to use the `load` method on Blocks, you must already have a block document [saved through code](https://docs.prefect.io/concepts/blocks/#saving-blocks) or [saved through the UI](https://docs.prefect.io/ui/blocks/).

### Write and run a flow
#### Load a pre-existing BitBucketCredentials block

```python
from prefect import flow
from prefect_bitbucket.credentials import BitBucketCredentials

@flow
def use_stored_bitbucket_creds_flow():
    bitbucket_credentials_block = BitBucketCredentials.load("BLOCK_NAME")

    return bitbucket_credentials_block

use_stored_bitbucket_creds_flow()
```

#### Create a new BitBucketCredentials block in a flow

```python
from prefect import flow
from prefect_bitbucket.credentials import BitBucketCredentials

@flow
def create_new_bitbucket_creds_flow():
    bitbucket_credentials_block = BitBucketCredentials(
        token="my-token",
        username="my-username"
    )

create_new_bitbucket_creds_flow()
```

#### Create a BitBucketRepository block for a public repo
```python
from prefect_bitbucket import BitBucketRepository

public_repo = "https://bitbucket.org/my-workspace/my-repository.git"

# Creates a public BitBucket repository BitBucketRepository block
public_bitbucket_block = BitBucketRepository(
    repository=public_repo
)

# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)
public_bitbucket_block.save("my-bitbucket-block")
```

#### Create a BitBucketRepository block for a public repo at a specific branch or tag
```python
from prefect_bitbucket import BitBucketRepository

public_repo = "https://bitbucket.org/my-workspace/my-repository.git"

# Creates a public BitBucket repository BitBucketRepository block
branch_bitbucket_block = BitBucketRepository(
    reference="my-branch-or-tag",  # e.g "master"
    repository=public_repo
)

# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)
branch_bitbucket_block.save("my-bitbucket-branch-block")
```
#### Create a new BitBucketCredentials block and a BitBucketRepository block for a private repo
```python
from prefect_bitbucket import BitBucketCredentials, BitBucketRepository

# For a private repo, we need credentials to access it
bitbucket_credentials_block = BitBucketCredentials(
    token="my-token",
    username="my-username"  # optional
)

# Saves the BitBucketCredentials block to your Prefect workspace (in the Blocks tab)
bitbucket_credentials_block.save(name="my-bitbucket-credentials-block")


# Creates a private BitBucket repository BitBucketRepository block
private_repo = "https://bitbucket.org/my-workspace/my-repository.git"
private_bitbucket_block = BitBucketRepository(
    repository=private_repo,
    bitbucket_credentials=bitbucket_credentials_block
)

# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)
private_bitbucket_block.save(name="my-private-bitbucket-block")
```

#### Use a preexisting BitBucketCredentials block to create a BitBucketRepository block for a private repo
```python
from prefect_bitbucket import BitBucketCredentials, BitBucketRepository

# Loads a preexisting BitBucketCredentials block
BitBucketCredentials.load("my-bitbucket-credentials-block")

# Creates a private BitBucket repository BitBucketRepository block
private_repo = "https://bitbucket.org/my-workspace/my-repository.git"
private_bitbucket_block = BitBucketRepository(
    repository=private_repo,
    bitbucket_credentials=bitbucket_credentials_block
)

# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)
private_bitbucket_block.save(name="my-private-bitbucket-block")
```

!!! info "Differences between Bitbucket Server and Bitbucket Cloud"

    For Bitbucket Cloud, only set the `token` to authenticate. For Bitbucket Server, set both the `token` and the `username`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "prefect-bitbucket",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "prefect",
    "author": null,
    "author_email": "\"Prefect Technologies, Inc.\" <help@prefect.io>",
    "download_url": "https://files.pythonhosted.org/packages/bd/f7/5d11d6f31a42707adb19008a5e3cf45e11f592beb980829e8672def09e49/prefect_bitbucket-0.2.3.tar.gz",
    "platform": null,
    "description": "# prefect-bitbucket\n\n<p align=\"center\">\n    <a href=\"https://pypi.python.org/pypi/prefect-bitbucket/\" alt=\"PyPI version\">\n        <img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/prefect-bitbucket?color=0052FF&labelColor=090422\"></a>\n    <a href=\"https://pepy.tech/badge/prefect-bitbucket/\" alt=\"Downloads\">\n        <img src=\"https://img.shields.io/pypi/dm/prefect-bitbucket?color=0052FF&labelColor=090422\" /></a>\n</p>\n\n\n## Welcome!\n\nPrefect integrations for working with Bitbucket repositories.\n\n## Getting Started\n\n### Python setup\n\nRequires an installation of Python 3.8+.\n\nWe recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.\n\nThese tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the [Prefect documentation](https://docs.prefect.io/).\n\n### Installation\n\nInstall `prefect-bitbucket` with `pip`:\n\n```bash\npip install prefect-bitbucket\n```\n\nThen, register to [view the block](https://docs.prefect.io/ui/blocks/) on Prefect Cloud:\n\n```bash\nprefect block register -m prefect_bitbucket\n```\n\nNote, to use the `load` method on Blocks, you must already have a block document [saved through code](https://docs.prefect.io/concepts/blocks/#saving-blocks) or [saved through the UI](https://docs.prefect.io/ui/blocks/).\n\n### Write and run a flow\n#### Load a pre-existing BitBucketCredentials block\n\n```python\nfrom prefect import flow\nfrom prefect_bitbucket.credentials import BitBucketCredentials\n\n@flow\ndef use_stored_bitbucket_creds_flow():\n    bitbucket_credentials_block = BitBucketCredentials.load(\"BLOCK_NAME\")\n\n    return bitbucket_credentials_block\n\nuse_stored_bitbucket_creds_flow()\n```\n\n#### Create a new BitBucketCredentials block in a flow\n\n```python\nfrom prefect import flow\nfrom prefect_bitbucket.credentials import BitBucketCredentials\n\n@flow\ndef create_new_bitbucket_creds_flow():\n    bitbucket_credentials_block = BitBucketCredentials(\n        token=\"my-token\",\n        username=\"my-username\"\n    )\n\ncreate_new_bitbucket_creds_flow()\n```\n\n#### Create a BitBucketRepository block for a public repo\n```python\nfrom prefect_bitbucket import BitBucketRepository\n\npublic_repo = \"https://bitbucket.org/my-workspace/my-repository.git\"\n\n# Creates a public BitBucket repository BitBucketRepository block\npublic_bitbucket_block = BitBucketRepository(\n    repository=public_repo\n)\n\n# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)\npublic_bitbucket_block.save(\"my-bitbucket-block\")\n```\n\n#### Create a BitBucketRepository block for a public repo at a specific branch or tag\n```python\nfrom prefect_bitbucket import BitBucketRepository\n\npublic_repo = \"https://bitbucket.org/my-workspace/my-repository.git\"\n\n# Creates a public BitBucket repository BitBucketRepository block\nbranch_bitbucket_block = BitBucketRepository(\n    reference=\"my-branch-or-tag\",  # e.g \"master\"\n    repository=public_repo\n)\n\n# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)\nbranch_bitbucket_block.save(\"my-bitbucket-branch-block\")\n```\n#### Create a new BitBucketCredentials block and a BitBucketRepository block for a private repo\n```python\nfrom prefect_bitbucket import BitBucketCredentials, BitBucketRepository\n\n# For a private repo, we need credentials to access it\nbitbucket_credentials_block = BitBucketCredentials(\n    token=\"my-token\",\n    username=\"my-username\"  # optional\n)\n\n# Saves the BitBucketCredentials block to your Prefect workspace (in the Blocks tab)\nbitbucket_credentials_block.save(name=\"my-bitbucket-credentials-block\")\n\n\n# Creates a private BitBucket repository BitBucketRepository block\nprivate_repo = \"https://bitbucket.org/my-workspace/my-repository.git\"\nprivate_bitbucket_block = BitBucketRepository(\n    repository=private_repo,\n    bitbucket_credentials=bitbucket_credentials_block\n)\n\n# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)\nprivate_bitbucket_block.save(name=\"my-private-bitbucket-block\")\n```\n\n#### Use a preexisting BitBucketCredentials block to create a BitBucketRepository block for a private repo\n```python\nfrom prefect_bitbucket import BitBucketCredentials, BitBucketRepository\n\n# Loads a preexisting BitBucketCredentials block\nBitBucketCredentials.load(\"my-bitbucket-credentials-block\")\n\n# Creates a private BitBucket repository BitBucketRepository block\nprivate_repo = \"https://bitbucket.org/my-workspace/my-repository.git\"\nprivate_bitbucket_block = BitBucketRepository(\n    repository=private_repo,\n    bitbucket_credentials=bitbucket_credentials_block\n)\n\n# Saves the BitBucketRepository block to your Prefect workspace (in the Blocks tab)\nprivate_bitbucket_block.save(name=\"my-private-bitbucket-block\")\n```\n\n!!! info \"Differences between Bitbucket Server and Bitbucket Cloud\"\n\n    For Bitbucket Cloud, only set the `token` to authenticate. For Bitbucket Server, set both the `token` and the `username`.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Prefect integrations for working with Bitbucket repositories.",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/PrefectHQ/prefect/tree/main/src/integrations/prefect-bitbucket"
    },
    "split_keywords": [
        "prefect"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33fed8fcca25172e2ef7db31e7f0ed81ebde4a3a557276904bd8658a0d159bc5",
                "md5": "405bd2dd495d50d34ceb059d655bd4f5",
                "sha256": "1976ddff7cca9c97fc114f5e3c3dd7048f61f08ddb550491bb034d072ce12249"
            },
            "downloads": -1,
            "filename": "prefect_bitbucket-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "405bd2dd495d50d34ceb059d655bd4f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7944,
            "upload_time": "2024-04-25T19:22:25",
            "upload_time_iso_8601": "2024-04-25T19:22:25.573773Z",
            "url": "https://files.pythonhosted.org/packages/33/fe/d8fcca25172e2ef7db31e7f0ed81ebde4a3a557276904bd8658a0d159bc5/prefect_bitbucket-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bdf75d11d6f31a42707adb19008a5e3cf45e11f592beb980829e8672def09e49",
                "md5": "3c45c65bf404ea73356176b0275da5eb",
                "sha256": "08d9ea3da100be18c2abd181f7aea00d9fe2b0b1375f2e13a266e208a246e4b8"
            },
            "downloads": -1,
            "filename": "prefect_bitbucket-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3c45c65bf404ea73356176b0275da5eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10319,
            "upload_time": "2024-04-25T19:22:26",
            "upload_time_iso_8601": "2024-04-25T19:22:26.871062Z",
            "url": "https://files.pythonhosted.org/packages/bd/f7/5d11d6f31a42707adb19008a5e3cf45e11f592beb980829e8672def09e49/prefect_bitbucket-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-25 19:22:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PrefectHQ",
    "github_project": "prefect",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "requirements": [],
    "lcname": "prefect-bitbucket"
}
        
Elapsed time: 0.24578s