concoursetools


Nameconcoursetools JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
SummaryEasily create Concourse resource types in Python.
upload_time2024-11-07 16:19:39
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseApache License 2.0
keywords concourse ci cd
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/gchq/ConcourseTools/main/docs/source/_static/logo-dark.png">
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/gchq/ConcourseTools/main/docs/source/_static/logo.png">
  <img alt="ConcourseTools logo" src="https://raw.githubusercontent.com/gchq/ConcourseTools/main/docs/source/_static/logo.png">
</picture>

![version](https://img.shields.io/badge/version-0.8.0-informational)
![pre-release](https://img.shields.io/badge/pre--release-beta-red)
![python](https://img.shields.io/badge/python-%3E%3D3.9-informational)
![coverage](https://img.shields.io/badge/coverage-96%25-brightgreen)
![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=orange)

A Python package for easily implementing Concourse [resource types](https://concourse-ci.org/implementing-resource-types.html).


## About

[Concourse CI](https://concourse-ci.org/) is an "open-source continuous thing-doer" designed to enable general
automation with intuitive and re-usable components. Resources represent all external inputs and outputs to and from the
pipeline, and many of these have been implemented in open source. In order to best leverage the Python ecosystem of
open-source packages, Concourse Tools abstracts away the implementation details of Concourse resource types to allow
users to focus on writing the code they want to run.


## Installation

Install from [GitHub](https://github.com/gchq/ConcourseTools/), or from [PyPI](https://pypi.org/project/concoursetools/):

```shell
$ pip install concoursetools
```

## Usage

Start by familiarising yourself with the Concourse resource "rules" in the [documentation](https://concourse-ci.org/implementing-resource-types.html). To recreate that example, start by creating a new `concourse.py` file in your repository. The first step is to create a `Version` subclass:

```python
from dataclasses import dataclass
from concoursetools import TypedVersion


@dataclass()
class GitVersion(TypedVersion):
    ref: str
```

Next, create a subclass of `ConcourseResource`:

```python
from concoursetools import ConcourseResource


class GitResource(ConcourseResource[GitVersion]):

    def __init__(self, uri: str, branch: str, private_key: str) -> None:
        super().__init__(GitVersion)
        self.uri = uri
        self.branch = branch
        self.private_key = private_key
```

Here, the parameters in the `__init__` method will be taken from the `source` configuration for the resource.
Now, implement the three methods required to define the behaviour of the resource:


```python
from pathlib import Path
from typing import Any
from concoursetools import BuildMetadata


class GitResource(ConcourseResource[GitVersion]):
    ...

    def fetch_new_versions(self, previous_version: GitVersion | None) -> list[GitVersion]:
        ...

    def download_version(self, version: GitVersion, destination_dir: pathlib.Path,
                         build_metadata: BuildMetadata, **kwargs: Any) -> tuple[GitVersion, dict[str, str]]:
        ...

    def publish_new_version(self, sources_dir: pathlib.Path, build_metadata: BuildMetadata,
                            **kwargs: Any) -> tuple[GitVersion, dict[str, str]]:
        ...
```

The keyword arguments in `download_version` and `publish_new_version` correspond to `params` in the `get` step,
and `get_params` in the `put` step respectively.

Once you are happy with the resource, generate the `Dockerfile` using the Concourse Tools CLI:

```shell
$ python3 -m concoursetools dockerfile .
```

Finally, upload the Docker image to a registry, and use it in your pipelines!

For more information - and for more in-depth examples - see the [documentation](https://concoursetools.readthedocs.io/en/stable/).


## Bugs and Contributions

Concourse Tools is in beta, and still under somewhat-active development.  Contributions, fixes, suggestions and bug
reports are all welcome: Please familiarise yourself with our
[contribution guidelines](https://github.com/gchq/ConcourseTools/blob/main/CONTRIBUTING.md).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "concoursetools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "concourse, ci, cd",
    "author": null,
    "author_email": "GCHQ <oss@gchq.gov.uk>",
    "download_url": "https://files.pythonhosted.org/packages/d9/b5/29d138a5b2c8c490bd94a95c2c3640276e528959da06beb6e47af4d895d8/concoursetools-0.8.0.tar.gz",
    "platform": null,
    "description": "<picture>\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/gchq/ConcourseTools/main/docs/source/_static/logo-dark.png\">\n  <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/gchq/ConcourseTools/main/docs/source/_static/logo.png\">\n  <img alt=\"ConcourseTools logo\" src=\"https://raw.githubusercontent.com/gchq/ConcourseTools/main/docs/source/_static/logo.png\">\n</picture>\n\n![version](https://img.shields.io/badge/version-0.8.0-informational)\n![pre-release](https://img.shields.io/badge/pre--release-beta-red)\n![python](https://img.shields.io/badge/python-%3E%3D3.9-informational)\n![coverage](https://img.shields.io/badge/coverage-96%25-brightgreen)\n![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=orange)\n\nA Python package for easily implementing Concourse [resource types](https://concourse-ci.org/implementing-resource-types.html).\n\n\n## About\n\n[Concourse CI](https://concourse-ci.org/) is an \"open-source continuous thing-doer\" designed to enable general\nautomation with intuitive and re-usable components. Resources represent all external inputs and outputs to and from the\npipeline, and many of these have been implemented in open source. In order to best leverage the Python ecosystem of\nopen-source packages, Concourse Tools abstracts away the implementation details of Concourse resource types to allow\nusers to focus on writing the code they want to run.\n\n\n## Installation\n\nInstall from [GitHub](https://github.com/gchq/ConcourseTools/), or from [PyPI](https://pypi.org/project/concoursetools/):\n\n```shell\n$ pip install concoursetools\n```\n\n## Usage\n\nStart by familiarising yourself with the Concourse resource \"rules\" in the [documentation](https://concourse-ci.org/implementing-resource-types.html). To recreate that example, start by creating a new `concourse.py` file in your repository. The first step is to create a `Version` subclass:\n\n```python\nfrom dataclasses import dataclass\nfrom concoursetools import TypedVersion\n\n\n@dataclass()\nclass GitVersion(TypedVersion):\n    ref: str\n```\n\nNext, create a subclass of `ConcourseResource`:\n\n```python\nfrom concoursetools import ConcourseResource\n\n\nclass GitResource(ConcourseResource[GitVersion]):\n\n    def __init__(self, uri: str, branch: str, private_key: str) -> None:\n        super().__init__(GitVersion)\n        self.uri = uri\n        self.branch = branch\n        self.private_key = private_key\n```\n\nHere, the parameters in the `__init__` method will be taken from the `source` configuration for the resource.\nNow, implement the three methods required to define the behaviour of the resource:\n\n\n```python\nfrom pathlib import Path\nfrom typing import Any\nfrom concoursetools import BuildMetadata\n\n\nclass GitResource(ConcourseResource[GitVersion]):\n    ...\n\n    def fetch_new_versions(self, previous_version: GitVersion | None) -> list[GitVersion]:\n        ...\n\n    def download_version(self, version: GitVersion, destination_dir: pathlib.Path,\n                         build_metadata: BuildMetadata, **kwargs: Any) -> tuple[GitVersion, dict[str, str]]:\n        ...\n\n    def publish_new_version(self, sources_dir: pathlib.Path, build_metadata: BuildMetadata,\n                            **kwargs: Any) -> tuple[GitVersion, dict[str, str]]:\n        ...\n```\n\nThe keyword arguments in `download_version` and `publish_new_version` correspond to `params` in the `get` step,\nand `get_params` in the `put` step respectively.\n\nOnce you are happy with the resource, generate the `Dockerfile` using the Concourse Tools CLI:\n\n```shell\n$ python3 -m concoursetools dockerfile .\n```\n\nFinally, upload the Docker image to a registry, and use it in your pipelines!\n\nFor more information - and for more in-depth examples - see the [documentation](https://concoursetools.readthedocs.io/en/stable/).\n\n\n## Bugs and Contributions\n\nConcourse Tools is in beta, and still under somewhat-active development.  Contributions, fixes, suggestions and bug\nreports are all welcome: Please familiarise yourself with our\n[contribution guidelines](https://github.com/gchq/ConcourseTools/blob/main/CONTRIBUTING.md).\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Easily create Concourse resource types in Python.",
    "version": "0.8.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/gchq/ConcourseTools/issues",
        "Changelog": "https://concoursetools.readthedocs.io/en/latest/whats_new.html",
        "Documentation": "https://concoursetools.readthedocs.io/en/stable/",
        "Homepage": "https://github.com/gchq/ConcourseTools/",
        "Repository": "https://github.com/gchq/ConcourseTools/"
    },
    "split_keywords": [
        "concourse",
        " ci",
        " cd"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fbe8d255d1351f2d3a41f56febb70cfe92635f3122fc57ca85e6b7f7c4d3be7",
                "md5": "a3c85acc5cc08f2354499955c3314335",
                "sha256": "beb628e44a0bdd2d2f880d5d81ade8804e66962127b6735e87e10d3e45df47a8"
            },
            "downloads": -1,
            "filename": "concoursetools-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a3c85acc5cc08f2354499955c3314335",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 51389,
            "upload_time": "2024-11-07T16:19:37",
            "upload_time_iso_8601": "2024-11-07T16:19:37.806615Z",
            "url": "https://files.pythonhosted.org/packages/2f/be/8d255d1351f2d3a41f56febb70cfe92635f3122fc57ca85e6b7f7c4d3be7/concoursetools-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9b529d138a5b2c8c490bd94a95c2c3640276e528959da06beb6e47af4d895d8",
                "md5": "81160d3138580dbec8a98fb815e90aee",
                "sha256": "6778fe55eeb78f869965dac29fe2026389c89d47c433bc2347be68e3b734797b"
            },
            "downloads": -1,
            "filename": "concoursetools-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "81160d3138580dbec8a98fb815e90aee",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 62861,
            "upload_time": "2024-11-07T16:19:39",
            "upload_time_iso_8601": "2024-11-07T16:19:39.834175Z",
            "url": "https://files.pythonhosted.org/packages/d9/b5/29d138a5b2c8c490bd94a95c2c3640276e528959da06beb6e47af4d895d8/concoursetools-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-07 16:19:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gchq",
    "github_project": "ConcourseTools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "concoursetools"
}
        
Elapsed time: 0.39220s