Contributor’s Guide

All kinds of contributions are more than welcomed. You can help make tower CLI better by reporting bugs, come up with feature ideas or, even further, help maintainers out by making pull requests. Make sure you follow the rules below when contributing and you are ready to roll ;)

Bug Reports

Reporting bugs is highly valuable to us. For flexibility, we do not provide issue templates, but describe the issue as specific as possible to make it easier and faster for us to hunt down the issue.

  • First check existing issues to see if it has already been created, if it has, giving issue description a “thumbs up”.
  • Mark the issue with ‘bug’ label.
  • Be sure to mention Tower backend version, Tower CLI version and python interpreter version when the bug occurs.
  • Copy-paste the detailed usage (code snippet when using as python library and command when using as CLI) and error message if possible.

Feature Requests

We welcome all sorts of feature ideas, but note, it may be scheduled for a future release rather than the next one, please be patient while we process your request. We will ping you on github once the feature is implemented.

  • Mark the issue with ‘enhancement’ label.

Architecture Overview

All available Tower CLI resources descent from abstract class tower_cli.models.base.BaseResource, which provides two fundamental methods, read and write. read wraps around a GET method to the specified resource, while write wraps around a POST or PATCH on condition. Most public resource APIs, like create or list, are essentially using a combination of read and write to communicate with Tower REST APIs.

class tower_cli.models.base.BaseResource[source]

Abstract class representing resources within the Ansible Tower system, on which actions can be taken. Includes standard create, modify, list, get, and delete methods.

Some of these methods are not created as commands, but will be implemented as commands inside of non-abstract child classes. Particularly, create is not a command in this class, but will be for some (but not all) child classes.

read(pk=None, fail_on_no_results=False, fail_on_multiple_results=False, **kwargs)[source]

Retrieve and return objects from the Ansible Tower API.

Parameters:
  • pk (int) – Primary key of the resource to be read. Tower CLI will only attempt to read that object if pk is provided (not None).
  • fail_on_no_results (bool) – Flag that if set, zero results is considered a failure case and raises an exception; otherwise, empty list is returned. (Note: This is always True if a primary key is included.)
  • fail_on_multiple_results (bool) – Flag that if set, at most one result is expected, and more results constitutes a failure case. (Note: This is meaningless if a primary key is included, as there can never be multiple results.)
  • query (list) – Contains 2-tuples used as query parameters to filter resulting resource objects.
  • **kwargs – Keyword arguments which, all together, will be used as query parameters to filter resulting resource objects.
Returns:

loaded JSON from Tower backend response body.

Return type:

dict

Raises:
write(pk=None, create_on_missing=False, fail_on_found=False, force_on_exists=True, **kwargs)[source]

Modify the given object using the Ansible Tower API.

Parameters:
  • pk (int) – Primary key of the resource to be read. Tower CLI will only attempt to read that object if pk is provided (not None).
  • create_on_missing (bool) – Flag that if set, a new object is created if pk is not set and objects matching the appropriate unique criteria is not found.
  • fail_on_found (bool) – Flag that if set, the operation fails if an object matching the unique criteria already exists.
  • force_on_exists (bool) – Flag that if set, then if an object is modified based on matching via unique fields (as opposed to the primary key), other fields are updated based on data sent; If unset, then the non-unique values are only written in a creation case.
  • **kwargs – Keyword arguments which, all together, will be used as POST/PATCH body to create/modify the resource object. if pk is not set, key-value pairs of **kwargs which are also in resource’s identity will be used to lookup existing reosource.
Returns:

A dictionary combining the JSON output of the resource, as well as two extra fields: “changed”, a flag indicating if the resource is created or successfully updated; “id”, an integer which is the primary key of the specified object.

Return type:

dict

Raises:

tower_cli.exceptions.BadRequest – When required fields are missing in **kwargs when creating a new resource object.

Here is the detailed class hierarchy from tower_cli.models.base.BaseResource to all specific Tower resources:

digraph inheritance65b2eb7fec { rankdir=LR; size="8.0, 12.0"; "tower_cli.models.base.BaseResource" [URL="#tower_cli.models.base.BaseResource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Abstract class representing resources within the Ansible Tower system, on which actions can be taken."]; "tower_cli.models.base.ExeResource" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Executable resource - defines status and cancel methods"]; "tower_cli.models.base.MonitorableResource" -> "tower_cli.models.base.ExeResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.base.MonitorableResource" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A resource that is able to be tied to a running task, such as a job or project, and thus able to be monitored."]; "tower_cli.models.base.BaseResource" -> "tower_cli.models.base.MonitorableResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.base.ReadOnlyResource" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)"]; "tower_cli.models.base.BaseResource" -> "tower_cli.models.base.ReadOnlyResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.base.Resource" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="This is the parent class for all standard resources."]; "tower_cli.models.base.BaseResource" -> "tower_cli.models.base.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.base.ResourceMeta" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Metaclass for the creation of a Model subclass, which pulls fields"]; "tower_cli.models.base.SurveyResource" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Contains utilities and commands common to \"job template\" models,"]; "tower_cli.models.base.Resource" -> "tower_cli.models.base.SurveyResource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.fields.BaseField" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)"]; "tower_cli.models.fields.Field" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A class representing flags on a given field on a model."]; "tower_cli.models.fields.BaseField" -> "tower_cli.models.fields.Field" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.fields.ManyToManyField" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A class that contains utilities for the ResourceMeta metaclass"]; "tower_cli.models.fields.BaseField" -> "tower_cli.models.fields.ManyToManyField" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.ad_hoc.Resource" [URL="api_ref/resources/ad_hoc.html#tower_cli.resources.ad_hoc.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for ad hoc commands."]; "tower_cli.models.base.ExeResource" -> "tower_cli.resources.ad_hoc.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.credential.Resource" [URL="api_ref/resources/credential.html#tower_cli.resources.credential.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for credentials."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.credential.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.credential_type.Resource" [URL="api_ref/resources/credential_type.html#tower_cli.resources.credential_type.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for credential types."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.credential_type.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.group.Resource" [URL="api_ref/resources/group.html#tower_cli.resources.group.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for groups."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.group.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.host.Resource" [URL="api_ref/resources/host.html#tower_cli.resources.host.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for credentials."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.host.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.instance.Resource" [URL="api_ref/resources/instance.html#tower_cli.resources.instance.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for instances."]; "tower_cli.models.base.ReadOnlyResource" -> "tower_cli.resources.instance.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.instance_group.Resource" [URL="api_ref/resources/instance_group.html#tower_cli.resources.instance_group.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for instance groups."]; "tower_cli.models.base.ReadOnlyResource" -> "tower_cli.resources.instance_group.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.inventory.Resource" [URL="api_ref/resources/inventory.html#tower_cli.resources.inventory.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for inventories."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.inventory.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.inventory_script.Resource" [URL="api_ref/resources/inventory_script.html#tower_cli.resources.inventory_script.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for inventory scripts."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.inventory_script.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.inventory_source.Resource" [URL="api_ref/resources/inventory_source.html#tower_cli.resources.inventory_source.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for inventory sources."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.inventory_source.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.base.MonitorableResource" -> "tower_cli.resources.inventory_source.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.inventory_update.Resource" [URL="api_ref/resources/inventory_update.html#tower_cli.resources.inventory_update.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for inventory source updates."]; "tower_cli.models.base.ExeResource" -> "tower_cli.resources.inventory_update.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.job.Resource" [URL="api_ref/resources/job.html#tower_cli.resources.job.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for jobs."]; "tower_cli.models.base.ExeResource" -> "tower_cli.resources.job.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.job_template.Resource" [URL="api_ref/resources/job_template.html#tower_cli.resources.job_template.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for job templates."]; "tower_cli.models.base.SurveyResource" -> "tower_cli.resources.job_template.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.label.Resource" [URL="api_ref/resources/label.html#tower_cli.resources.label.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for labels."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.label.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.node.Resource" [URL="api_ref/resources/node.html#tower_cli.resources.node.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for workflow nodes."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.node.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.notification_template.Resource" [URL="api_ref/resources/notification_template.html#tower_cli.resources.notification_template.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for notification templates."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.notification_template.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.organization.Resource" [URL="api_ref/resources/organization.html#tower_cli.resources.organization.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top"]; "tower_cli.models.base.Resource" -> "tower_cli.resources.organization.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.project.Resource" [URL="api_ref/resources/project.html#tower_cli.resources.project.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for projects."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.project.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.models.base.MonitorableResource" -> "tower_cli.resources.project.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.project_update.Resource" [URL="api_ref/resources/project_update.html#tower_cli.resources.project_update.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for project updates."]; "tower_cli.models.base.ExeResource" -> "tower_cli.resources.project_update.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.role.Resource" [URL="api_ref/resources/role.html#tower_cli.resources.role.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for managing roles."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.role.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.schedule.Resource" [URL="api_ref/resources/schedule.html#tower_cli.resources.schedule.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for schedules."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.schedule.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.setting.Resource" [URL="api_ref/resources/setting.html#tower_cli.resources.setting.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for Tower configurations."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.setting.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.team.Resource" [URL="api_ref/resources/team.html#tower_cli.resources.team.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for teams."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.team.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.unified_job.Resource" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A resource for unified jobs."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.unified_job.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.user.Resource" [URL="api_ref/resources/user.html#tower_cli.resources.user.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for users."]; "tower_cli.models.base.Resource" -> "tower_cli.resources.user.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.workflow.Resource" [URL="api_ref/resources/workflow.html#tower_cli.resources.workflow.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for workflow job templates."]; "tower_cli.models.base.SurveyResource" -> "tower_cli.resources.workflow.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.resources.workflow.TreeNode" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)"]; "tower_cli.resources.workflow_job.Resource" [URL="api_ref/resources/workflow_job.html#tower_cli.resources.workflow_job.Resource",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="A resource for workflow jobs."]; "tower_cli.models.base.ExeResource" -> "tower_cli.resources.workflow_job.Resource" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Details of each Tower CLI resource module are available under tower_cli/resources/.

Some root-level modules under tower_cli/ folder are of great importance. Specifically, api.py contains details of the API client Tower CLI used to make HTTP(S) requests using requests, and conf.py is used to define and initialize singleton setting object tower_cli.conf.settings.

On the other hand, tower_cli/cli/ folder contains code that extends tower_cli from a python library into a full- fledged command-line interface. We use click as the CLI engine.

digraph inheritanced415d42f75 { rankdir=LR; size="8.0, 12.0"; "click.core.BaseCommand" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="The base command implements the minimal API contract of commands."]; "click.core.Command" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Commands are the basic building block of command line interfaces in"]; "click.core.BaseCommand" -> "click.core.Command" [arrowsize=0.5,style="setlinewidth(0.5)"]; "click.core.MultiCommand" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A multi command is the basic implementation of a command that"]; "click.core.Command" -> "click.core.MultiCommand" [arrowsize=0.5,style="setlinewidth(0.5)"]; "click.types.Choice" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="The choice type allows a value to be checked against a fixed set"]; "click.types.ParamType" -> "click.types.Choice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "click.types.File" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Declares a parameter to be a file for reading or writing. The file"]; "click.types.ParamType" -> "click.types.File" [arrowsize=0.5,style="setlinewidth(0.5)"]; "click.types.ParamType" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Helper for converting values through types. The following is"]; "tower_cli.cli.action.ActionSubcommand" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A Command subclass that adds support for the concept that invocation"]; "click.core.Command" -> "tower_cli.cli.action.ActionSubcommand" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.base.TowerCLI" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Tower CLI is a command-line interface tool for interacting with"]; "click.core.MultiCommand" -> "tower_cli.cli.base.TowerCLI" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.resource.ResSubcommand" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A subcommand that implements all command methods on the"]; "click.core.MultiCommand" -> "tower_cli.cli.resource.ResSubcommand" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.types.File" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A subclass of click.File that adds `os.path.expanduser`."]; "click.types.File" -> "tower_cli.cli.types.File" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.types.MappedChoice" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A subclass of click.Choice that allows a distinction between the"]; "click.types.Choice" -> "tower_cli.cli.types.MappedChoice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.types.Related" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A subclass of click.types.ParamType that represents a value"]; "click.types.ParamType" -> "tower_cli.cli.types.Related" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.types.StructuredInput" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="A subclass of Variables that deserializes JSON/YAML-formatted string/file content into python objects."]; "tower_cli.cli.types.Variables" -> "tower_cli.cli.types.StructuredInput" [arrowsize=0.5,style="setlinewidth(0.5)"]; "tower_cli.cli.types.Variables" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",tooltip="Allows reading from a file optionally with '@' prefix,"]; "click.types.File" -> "tower_cli.cli.types.Variables" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Code Contributions

Setting up development environment and playing around with Tower CLI is quite straight-forward, here is the usual development procedure:

  1. Branch out a local issue branch from the correct base branch.
  2. Create an empty virtual environment.
  3. Code.
  4. Run make install to install development Tower CLI and all its dependency to virtual environment.
  5. Manually test on your bug fix/feature and modify until manual tests pass.
  6. Run sudo pip install tox. Then at the root directory of Tower CLI repository, run sudo tox . to run flake8 verify and unit test against all supported python versions. Run and modify until all flake8 checks and unit tests pass.
  7. Commit, push to local fork and make pull request targeting the correct base branch.
  8. Wait for a maintainer to either approve and merge the pull request, or update pull request according to feedback comment.

Some points to keep in mind when developing:

  • Target the correct branch. Currently we use branch ‘v1’ to track 3.1.x versions and ‘master’ to track 3.2.0 and beyond.
  • Consider all API versions. Currently 3.1.x versions are exclusively used for API v1 and 3.2.0 and beyond are exclusively used for API v2, that means if you fixed a bug for 3.1.8, switch to 3.2.0 and see if the same or similar bug exists and needs similar fix.
  • Consider python 2/3 compatibility, make good use of six and tower_cli.compat.
  • Consider docs update. Whenever a new resource, new resource public method or new resource field is added, inspect the docs folder and make all necessary updates before committing. Whenever HISTORY.rst at base directory changes replace docs/source/HISTORY.rst with the latest version.
  • Adhere to the flake8 specifications when developing, the only exception we allow is the maximum line length, which is 120 characters rather than 79.
  • Be pythonic by using meaningful names and clear structures. Make code self-explanatory rather than adding excessive comments.
  • Be test-driven. Although not mandatory, please try keeping test coverage at least the same as before, we appreciate it if you can increase our test coverage in your pull requests.