devopsdriver


Namedevopsdriver JSON
Version 0.1.45 PyPI version JSON
download
home_pageNone
SummaryDevOps tools
upload_time2024-04-29 03:23:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseThis is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. 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 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. For more information, please refer to <https://unlicense.org>
keywords azure devops jira confluence email pipelines tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![status sheild](https://img.shields.io/static/v1?label=status&message=beta&color=blue&style=plastic)
[![status sheild](https://img.shields.io/static/v1?label=released&message=v0.1.45&color=active&style=plastic)](https://pypi.org/project/devopsdriver/0.1.45/)
[![GitHub](https://img.shields.io/github/license/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver?tab=Unlicense-1-ov-file#readme)
[![GitHub contributors](https://img.shields.io/github/contributors/marcpage/devops-driver?style=flat)](https://github.com/marcpage/devops-driver/graphs/contributors)
[![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)

[![commit sheild](https://img.shields.io/github/last-commit/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver/commits)
[![activity sheild](https://img.shields.io/github/commit-activity/m/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver/commits)
[![GitHub top language](https://img.shields.io/github/languages/top/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver)
[![size sheild](https://img.shields.io/github/languages/code-size/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver)

[![example workflow](https://github.com/marcpage/devops-driver/actions/workflows/pr.yml/badge.svg)](https://github.com/marcpage/devops-driver/actions/workflows/pr.yml)
[![status sheild](https://img.shields.io/static/v1?label=test+coverage&message=99%&color=active&style=plastic)](https://github.com/marcpage/devops-driver/blob/main/Makefile#L4)
[![issues sheild](https://img.shields.io/github/issues-raw/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/marcpage/devops-driver?style=flat)](https://github.com/marcpage/devops-driver/pulls)

[![follow sheild](https://img.shields.io/github/followers/marcpage?label=Follow&style=social)](https://github.com/marcpage?tab=followers)
[![watch sheild](https://img.shields.io/github/watchers/marcpage/devops-driver?label=Watch&style=social)](https://github.com/marcpage/devops-driver/watchers)

[![Python](https://img.shields.io/static/v1?label=&message=Pure%20Python&color=ffde57&style=plastic&logo=python)](https://python.org/)
[![Azure](https://img.shields.io/static/v1?label=&message=Supports%20Microsoft%20Azure&color=blue&style=plastic&logo=microsoftazure)](https://azure.microsoft.com/)
[![Gmail](https://img.shields.io/static/v1?label=&message=Supports%20Google%20Gmail&color=white&style=plastic&logo=gmail)](https://gmail.com/)

OS: 
[![Windows](https://img.shields.io/static/v1?label=&message=Windows&color=blue&style=plastic&logo=windows)](https://microsoft.com/)
[![macOS](https://img.shields.io/static/v1?label=&message=macOS&color=white&logoColor=black&style=plastic&logo=apple)](https://apple.com/)
[![Linux](https://img.shields.io/static/v1?label=&message=Linux&color=seashell&logoColor=black&style=plastic&logo=linux)](https://linux.org/)

# devops-driver

Devops-driver is a collection of tools to help streamline developer's experience and gain insights into various processes.

## Tools

devopsdriver is a toolbox that helps to quickly put together reports. Some of the items in the toolbox are:

- **Settings**: store data, constants, settings, keys, tokens, etc. both in and out of the repository
- **send_email**: send emails over SMTP (including SSL), using `Settings` to store credentials
- **Template**: Simplify generating reports using `.mako` templates
- **Azure.workitem**: Search for and inspect Azure DevOps work items

## Example use-case

To allow seamless work in both pipelines as well as in the development environment, the `Settings` object gives you access to common settings among multiple scripts, secrets, and configuration constants in a way the helps keep secrets out of the repository but runs just as well in the pipeline as your machine.

Say you want a pipeline that looks for User Stories that are newer than 3 days and send out an email.

### \<platform dependent path\>/devopsdriver.yml
```yaml
smtp:
    sender: JohnDoe@company.com

secrets:
    azure.token: azure/token
    smtp.password: smtp/password
```

This file is in a global place (location varies by OS) and stores information that you may not want in your repository or is specific to development. 

| Platform | Global Directory       |
|----------|------------------------|
| Windows  | %APPDATA%\             |
| Linux    | ~/.devopsdriver/       |
| macOS    | ~/Library/Preferences/ |

The `secrets` are extra sensative and are stored in the OS keychain.

### Set secrets in the keychain
```bash
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install devopsdriver
$ settings --secrets
secret: smtp.password  key: smtp/password
smtp.password (smtp/password): ****
secret: azure.token  key: azure/token
smtp.password (azure/token): ****
$ settings --secrets
secret: azure.token  key: azure/token
	Value set
secret: smtp.password  key: smtp/password
	Value set
$
```
The first call to `settings` will look for every secret and check if they are already set in the keychain.
For any secret that has not been set in the keychain, you will be prompted to enter the password to store.
The second call to `settings` will verify that all the values have been set in the keychain.

### devopsdriver.yml
```yaml
azure:
    url: https://dev.azure.com/MyCompany

smtp:
    server: smtp.company.com
    port: 465

cli:
    azure.token: --azure-token
    smtp.password: --smtp-password
    smtp.sender: --smtp-sender

env:
    azure.token: AZURE_TOKEN
    smtp.sender: SMTP_SENDER
    smtp.password: SMTP_PASSWORD
```

This file lives next to your scripts in your repository.
These are settings that would be used by everyone, including the pipeline.
The `cli` and `env` map command line switches and environment variables to those keys.
This allows for many options for setting values depending on your needs.

### new_stories.yml
```yaml
scrum masters:
    - JohnDoe@company.com
    - JaneDoe@company.com
```
This file is specific to your script and not shared.
These are values that you want to use in your script but have them here for easy adjustment.

### new_stories.html.mako
```html
<h1>Stories created in the last ${days} days</h1>
<ul>
    % for story in stories:
    <li>${story.id} ${story.title}</li>
    % endfor
</ul>
```

This file is the template for the email body.

### new_stories.py
```python
from datetime import date, timedelta

from devopsdriver import Settings, Azure, send_email, Template
from devopsdriver.azdo import Wiql, GreaterThan

# Parse all the settings from files, command line, environment, and keychain
settings = Settings(__file__).key("secrets").cli("cli").env("env")

# Create connection to Azure Devops
azure = Azure(settings)

# Get User Stories created in the last three days
three_days_ago = date.today() - timedelta(days=settings["days of recent stories"])
new_stories = azure.workitem.find(
    Wiql().where(GreaterThan("CreatedDate", three_days_ago))
)

# Generate html body of the email
message = Template(__file__).render(
    days=settings["days of recent stories"],
    stories=new_stories,
)

# Send the email
send_email(
    recipients=settings["scrum masters"],
    subject=f'Stories created in the last {settings["days of recent stories"]} days',
    html_body=message,
    settings=settings,
)
```

### The email sent

**From**: JohnDoe@company.com

**To**: JohnDoe@company.com, JaneDoe@company.com

**Subject**: Stories created in the last 3 days

#### Stories created in the last 3 days

- 745 Needs a preprocessing step that makes it case insensitive
- 749 Create GitHub action to automate process
- 750 Create GitHub action to automate process
- 751 Test
- 752 Feedback Capture
- 753 draft doc history retrieval method
- 754 frontend - store to schema
- 755 Transfer job to production. Setup migrations to move to production
- 756 Query subscription status from App


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "devopsdriver",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "azure, devops, jira, confluence, email, pipelines, tools",
    "author": null,
    "author_email": "Marc Page <marcallenpage@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c3/09/6296e8c8fd00c5dafde321c4caa7c1572d411a1d2766042eaf8319f65f75/devopsdriver-0.1.45.tar.gz",
    "platform": null,
    "description": "![status sheild](https://img.shields.io/static/v1?label=status&message=beta&color=blue&style=plastic)\n[![status sheild](https://img.shields.io/static/v1?label=released&message=v0.1.45&color=active&style=plastic)](https://pypi.org/project/devopsdriver/0.1.45/)\n[![GitHub](https://img.shields.io/github/license/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver?tab=Unlicense-1-ov-file#readme)\n[![GitHub contributors](https://img.shields.io/github/contributors/marcpage/devops-driver?style=flat)](https://github.com/marcpage/devops-driver/graphs/contributors)\n[![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)\n\n[![commit sheild](https://img.shields.io/github/last-commit/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver/commits)\n[![activity sheild](https://img.shields.io/github/commit-activity/m/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver/commits)\n[![GitHub top language](https://img.shields.io/github/languages/top/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver)\n[![size sheild](https://img.shields.io/github/languages/code-size/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver)\n\n[![example workflow](https://github.com/marcpage/devops-driver/actions/workflows/pr.yml/badge.svg)](https://github.com/marcpage/devops-driver/actions/workflows/pr.yml)\n[![status sheild](https://img.shields.io/static/v1?label=test+coverage&message=99%&color=active&style=plastic)](https://github.com/marcpage/devops-driver/blob/main/Makefile#L4)\n[![issues sheild](https://img.shields.io/github/issues-raw/marcpage/devops-driver?style=plastic)](https://github.com/marcpage/devops-driver/issues)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr/marcpage/devops-driver?style=flat)](https://github.com/marcpage/devops-driver/pulls)\n\n[![follow sheild](https://img.shields.io/github/followers/marcpage?label=Follow&style=social)](https://github.com/marcpage?tab=followers)\n[![watch sheild](https://img.shields.io/github/watchers/marcpage/devops-driver?label=Watch&style=social)](https://github.com/marcpage/devops-driver/watchers)\n\n[![Python](https://img.shields.io/static/v1?label=&message=Pure%20Python&color=ffde57&style=plastic&logo=python)](https://python.org/)\n[![Azure](https://img.shields.io/static/v1?label=&message=Supports%20Microsoft%20Azure&color=blue&style=plastic&logo=microsoftazure)](https://azure.microsoft.com/)\n[![Gmail](https://img.shields.io/static/v1?label=&message=Supports%20Google%20Gmail&color=white&style=plastic&logo=gmail)](https://gmail.com/)\n\nOS: \n[![Windows](https://img.shields.io/static/v1?label=&message=Windows&color=blue&style=plastic&logo=windows)](https://microsoft.com/)\n[![macOS](https://img.shields.io/static/v1?label=&message=macOS&color=white&logoColor=black&style=plastic&logo=apple)](https://apple.com/)\n[![Linux](https://img.shields.io/static/v1?label=&message=Linux&color=seashell&logoColor=black&style=plastic&logo=linux)](https://linux.org/)\n\n# devops-driver\n\nDevops-driver is a collection of tools to help streamline developer's experience and gain insights into various processes.\n\n## Tools\n\ndevopsdriver is a toolbox that helps to quickly put together reports. Some of the items in the toolbox are:\n\n- **Settings**: store data, constants, settings, keys, tokens, etc. both in and out of the repository\n- **send_email**: send emails over SMTP (including SSL), using `Settings` to store credentials\n- **Template**: Simplify generating reports using `.mako` templates\n- **Azure.workitem**: Search for and inspect Azure DevOps work items\n\n## Example use-case\n\nTo allow seamless work in both pipelines as well as in the development environment, the `Settings` object gives you access to common settings among multiple scripts, secrets, and configuration constants in a way the helps keep secrets out of the repository but runs just as well in the pipeline as your machine.\n\nSay you want a pipeline that looks for User Stories that are newer than 3 days and send out an email.\n\n### \\<platform dependent path\\>/devopsdriver.yml\n```yaml\nsmtp:\n    sender: JohnDoe@company.com\n\nsecrets:\n    azure.token: azure/token\n    smtp.password: smtp/password\n```\n\nThis file is in a global place (location varies by OS) and stores information that you may not want in your repository or is specific to development. \n\n| Platform | Global Directory       |\n|----------|------------------------|\n| Windows  | %APPDATA%\\             |\n| Linux    | ~/.devopsdriver/       |\n| macOS    | ~/Library/Preferences/ |\n\nThe `secrets` are extra sensative and are stored in the OS keychain.\n\n### Set secrets in the keychain\n```bash\n$ python3 -m venv .venv\n$ source .venv/bin/activate\n$ pip install devopsdriver\n$ settings --secrets\nsecret: smtp.password  key: smtp/password\nsmtp.password (smtp/password): ****\nsecret: azure.token  key: azure/token\nsmtp.password (azure/token): ****\n$ settings --secrets\nsecret: azure.token  key: azure/token\n\tValue set\nsecret: smtp.password  key: smtp/password\n\tValue set\n$\n```\nThe first call to `settings` will look for every secret and check if they are already set in the keychain.\nFor any secret that has not been set in the keychain, you will be prompted to enter the password to store.\nThe second call to `settings` will verify that all the values have been set in the keychain.\n\n### devopsdriver.yml\n```yaml\nazure:\n    url: https://dev.azure.com/MyCompany\n\nsmtp:\n    server: smtp.company.com\n    port: 465\n\ncli:\n    azure.token: --azure-token\n    smtp.password: --smtp-password\n    smtp.sender: --smtp-sender\n\nenv:\n    azure.token: AZURE_TOKEN\n    smtp.sender: SMTP_SENDER\n    smtp.password: SMTP_PASSWORD\n```\n\nThis file lives next to your scripts in your repository.\nThese are settings that would be used by everyone, including the pipeline.\nThe `cli` and `env` map command line switches and environment variables to those keys.\nThis allows for many options for setting values depending on your needs.\n\n### new_stories.yml\n```yaml\nscrum masters:\n    - JohnDoe@company.com\n    - JaneDoe@company.com\n```\nThis file is specific to your script and not shared.\nThese are values that you want to use in your script but have them here for easy adjustment.\n\n### new_stories.html.mako\n```html\n<h1>Stories created in the last ${days} days</h1>\n<ul>\n    % for story in stories:\n    <li>${story.id} ${story.title}</li>\n    % endfor\n</ul>\n```\n\nThis file is the template for the email body.\n\n### new_stories.py\n```python\nfrom datetime import date, timedelta\n\nfrom devopsdriver import Settings, Azure, send_email, Template\nfrom devopsdriver.azdo import Wiql, GreaterThan\n\n# Parse all the settings from files, command line, environment, and keychain\nsettings = Settings(__file__).key(\"secrets\").cli(\"cli\").env(\"env\")\n\n# Create connection to Azure Devops\nazure = Azure(settings)\n\n# Get User Stories created in the last three days\nthree_days_ago = date.today() - timedelta(days=settings[\"days of recent stories\"])\nnew_stories = azure.workitem.find(\n    Wiql().where(GreaterThan(\"CreatedDate\", three_days_ago))\n)\n\n# Generate html body of the email\nmessage = Template(__file__).render(\n    days=settings[\"days of recent stories\"],\n    stories=new_stories,\n)\n\n# Send the email\nsend_email(\n    recipients=settings[\"scrum masters\"],\n    subject=f'Stories created in the last {settings[\"days of recent stories\"]} days',\n    html_body=message,\n    settings=settings,\n)\n```\n\n### The email sent\n\n**From**: JohnDoe@company.com\n\n**To**: JohnDoe@company.com, JaneDoe@company.com\n\n**Subject**: Stories created in the last 3 days\n\n#### Stories created in the last 3 days\n\n- 745 Needs a preprocessing step that makes it case insensitive\n- 749 Create GitHub action to automate process\n- 750 Create GitHub action to automate process\n- 751 Test\n- 752 Feedback Capture\n- 753 draft doc history retrieval method\n- 754 frontend - store to schema\n- 755 Transfer job to production. Setup migrations to move to production\n- 756 Query subscription status from App\n\n",
    "bugtrack_url": null,
    "license": "This is free and unencumbered software released into the public domain.  Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.  In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.  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 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.  For more information, please refer to <https://unlicense.org> ",
    "summary": "DevOps tools",
    "version": "0.1.45",
    "project_urls": {
        "Changelog": "https://github.com/marcpage/devops-driver/releases",
        "Documentation": "https://github.com/marcpage/devops-driver",
        "Homepage": "https://github.com/marcpage/devops-driver",
        "Issues": "https://github.com/marcpage/devops-driver/issues",
        "Repository": "https://github.com/marcpage/devops-driver.git"
    },
    "split_keywords": [
        "azure",
        " devops",
        " jira",
        " confluence",
        " email",
        " pipelines",
        " tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "946f4aa746bfd7feba100afab39b24c131b984fda8ce71c71e7be86716390144",
                "md5": "afe9b11d42a1bce853ec59af27163c2c",
                "sha256": "330ac2c8788055ffeda05b34ffff9e04906a48081f546093da5dca161c64b885"
            },
            "downloads": -1,
            "filename": "devopsdriver-0.1.45-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "afe9b11d42a1bce853ec59af27163c2c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 25706,
            "upload_time": "2024-04-29T03:23:05",
            "upload_time_iso_8601": "2024-04-29T03:23:05.047366Z",
            "url": "https://files.pythonhosted.org/packages/94/6f/4aa746bfd7feba100afab39b24c131b984fda8ce71c71e7be86716390144/devopsdriver-0.1.45-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3096296e8c8fd00c5dafde321c4caa7c1572d411a1d2766042eaf8319f65f75",
                "md5": "e5cb3ee9bcfbf56ca4f8484df64bcd87",
                "sha256": "3342557a4dd821ff96745bcf7204b2ca2feb192a5717d8a6d89058c91931ac68"
            },
            "downloads": -1,
            "filename": "devopsdriver-0.1.45.tar.gz",
            "has_sig": false,
            "md5_digest": "e5cb3ee9bcfbf56ca4f8484df64bcd87",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 34343,
            "upload_time": "2024-04-29T03:23:07",
            "upload_time_iso_8601": "2024-04-29T03:23:07.851617Z",
            "url": "https://files.pythonhosted.org/packages/c3/09/6296e8c8fd00c5dafde321c4caa7c1572d411a1d2766042eaf8319f65f75/devopsdriver-0.1.45.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-29 03:23:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "marcpage",
    "github_project": "devops-driver",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "devopsdriver"
}
        
Elapsed time: 0.35525s