little-timmy


Namelittle-timmy JSON
Version 1.2.0 PyPI version JSON
download
home_pageNone
SummaryLittle Timmy will try their best to find those unused Ansible variables.
upload_time2024-10-13 16:39:27
maintainerNone
docs_urlNone
authorHuw
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Huw 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
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # little-timmy

Little Timmy will try their best to find those unused Ansible variables.

```sh
cd repo/ansible/plays
ansible-galaxy collection install -f -r requirements.yml -p .
ansible-galaxy role install -f -r requirements.yml -p galaxy_roles

pip3 install little-timmy

little-timmy
# or 
python3 -m little_timmy
```

Little Timmy can find the "80%" of unused variables but due to the numerous ways variables can be declared
and consumed in Ansible, some will be missed.

It should find unused variables in:

- `group_vars`
- `host_vars`
- `vars`
- `defaults`
- Inventory files

The above files are parsed to find variable declarations followed by a rudimentary search for their usage in
playbooks, templates, tasks, and handler files.

It will not find unused variables for:

- `set_facts`
- `register`
- Dynamically created or referenced variables
- Variables consumed in any custom python filters or similar

## Github Action

Workflow

```yaml
name: little-timmy
on:
  push:
jobs:
  little-timmy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run action
        uses: hoo29/little-timmy@v1-action
```

Variables

```yaml
inputs:
  directory:
    description: The root directory for your ansible
    required: false
    default: "."
  additional_cli_args:
    description: Additional CLI arguments to pass to little-timmy
    required: false
    default: ""
  galaxy_role_requirements_file:
    description: Location, relative to `directory`, of the ansible galaxy roles requirements file.
    required: false
  galaxy_collection_requirements_file:
    description: Location, relative to `directory`, of the ansible galaxy collections requirements file.
    required: false
  ansible_vault_password:
    description: |
      Optional ansible-vault password. The content will be a written to a 
      file and ANSIBLE_VAULT_PASSWORD_FILE set to its location. Only used
      by ansible if a vaulted value is found.
    required: false
    default: replace-me-if-vault-is-used
```

## Version and Tags

The latest version can be found in [pyproject.toml](./pyproject.toml) and the
changelog is [CHANGELOG.md](./CHANGELOG.md).

The tags on this repo are used for the Github action and do not relate the published
python module.

## Config

Additional, optional configuration can be specified in a YAML configuration file named `.little-timmy`.
The file can be located at any level between the current working directory and `/`.

```yaml
skip_vars:
  - vars
  - to
  - ignore
skip_dirs:
  - venv
  - tests
  - molecule
```

## Help

```text
little-timmy -h

usage: little-timmy [OPTIONS] [directory]

Process a directory path

positional arguments:
  directory             The directory to process

options:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        Config file to use. By default it will search all dirs to `/` for .little-timmy
  -d, --dave-mode, --no-dave-mode
                        Make logging work on dave's macbook.
  -e, --exit-success, --no-exit-success
                        Exit 0 when unused vars are found.
  -g, --github-action, --no-github-action
                        Output results for github actions.
  -j, --json-output, --no-json-output
                        Output results as json to stdout. Disables the stderr logger.
  -l LOG_LEVEL, --log-level LOG_LEVEL
                        set the logging level (default: INFO).
  -v, --version, --no-version
                        Output the version.
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "little-timmy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Huw",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/00/6b/20e615172f0f8c358a37374c9f9cad96c68b038a89ea5db19a5ab5897151/little_timmy-1.2.0.tar.gz",
    "platform": null,
    "description": "# little-timmy\n\nLittle Timmy will try their best to find those unused Ansible variables.\n\n```sh\ncd repo/ansible/plays\nansible-galaxy collection install -f -r requirements.yml -p .\nansible-galaxy role install -f -r requirements.yml -p galaxy_roles\n\npip3 install little-timmy\n\nlittle-timmy\n# or \npython3 -m little_timmy\n```\n\nLittle Timmy can find the \"80%\" of unused variables but due to the numerous ways variables can be declared\nand consumed in Ansible, some will be missed.\n\nIt should find unused variables in:\n\n- `group_vars`\n- `host_vars`\n- `vars`\n- `defaults`\n- Inventory files\n\nThe above files are parsed to find variable declarations followed by a rudimentary search for their usage in\nplaybooks, templates, tasks, and handler files.\n\nIt will not find unused variables for:\n\n- `set_facts`\n- `register`\n- Dynamically created or referenced variables\n- Variables consumed in any custom python filters or similar\n\n## Github Action\n\nWorkflow\n\n```yaml\nname: little-timmy\non:\n  push:\njobs:\n  little-timmy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - name: Run action\n        uses: hoo29/little-timmy@v1-action\n```\n\nVariables\n\n```yaml\ninputs:\n  directory:\n    description: The root directory for your ansible\n    required: false\n    default: \".\"\n  additional_cli_args:\n    description: Additional CLI arguments to pass to little-timmy\n    required: false\n    default: \"\"\n  galaxy_role_requirements_file:\n    description: Location, relative to `directory`, of the ansible galaxy roles requirements file.\n    required: false\n  galaxy_collection_requirements_file:\n    description: Location, relative to `directory`, of the ansible galaxy collections requirements file.\n    required: false\n  ansible_vault_password:\n    description: |\n      Optional ansible-vault password. The content will be a written to a \n      file and ANSIBLE_VAULT_PASSWORD_FILE set to its location. Only used\n      by ansible if a vaulted value is found.\n    required: false\n    default: replace-me-if-vault-is-used\n```\n\n## Version and Tags\n\nThe latest version can be found in [pyproject.toml](./pyproject.toml) and the\nchangelog is [CHANGELOG.md](./CHANGELOG.md).\n\nThe tags on this repo are used for the Github action and do not relate the published\npython module.\n\n## Config\n\nAdditional, optional configuration can be specified in a YAML configuration file named `.little-timmy`.\nThe file can be located at any level between the current working directory and `/`.\n\n```yaml\nskip_vars:\n  - vars\n  - to\n  - ignore\nskip_dirs:\n  - venv\n  - tests\n  - molecule\n```\n\n## Help\n\n```text\nlittle-timmy -h\n\nusage: little-timmy [OPTIONS] [directory]\n\nProcess a directory path\n\npositional arguments:\n  directory             The directory to process\n\noptions:\n  -h, --help            show this help message and exit\n  -c CONFIG_FILE, --config-file CONFIG_FILE\n                        Config file to use. By default it will search all dirs to `/` for .little-timmy\n  -d, --dave-mode, --no-dave-mode\n                        Make logging work on dave's macbook.\n  -e, --exit-success, --no-exit-success\n                        Exit 0 when unused vars are found.\n  -g, --github-action, --no-github-action\n                        Output results for github actions.\n  -j, --json-output, --no-json-output\n                        Output results as json to stdout. Disables the stderr logger.\n  -l LOG_LEVEL, --log-level LOG_LEVEL\n                        set the logging level (default: INFO).\n  -v, --version, --no-version\n                        Output the version.\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Huw  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": "Little Timmy will try their best to find those unused Ansible variables.",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/hoo29/little-timmy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ab84b70558346bbedb5548900084a02c2a996955393324b345dc0622fb5578c",
                "md5": "6ae6e35cce935678ad9d064556b861ef",
                "sha256": "6fa8e673a5924820bb5fc23aa8acbc8e80482e897bf913ab10f2c8ef62907a58"
            },
            "downloads": -1,
            "filename": "little_timmy-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6ae6e35cce935678ad9d064556b861ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9243,
            "upload_time": "2024-10-13T16:39:26",
            "upload_time_iso_8601": "2024-10-13T16:39:26.124392Z",
            "url": "https://files.pythonhosted.org/packages/9a/b8/4b70558346bbedb5548900084a02c2a996955393324b345dc0622fb5578c/little_timmy-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "006b20e615172f0f8c358a37374c9f9cad96c68b038a89ea5db19a5ab5897151",
                "md5": "4e9d158e3fc9f88ee4b0898397bb9593",
                "sha256": "fbc71742b03af03b26b0001e3a3fa13f20bc43facf71e04fee7088175b41b861"
            },
            "downloads": -1,
            "filename": "little_timmy-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4e9d158e3fc9f88ee4b0898397bb9593",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8606,
            "upload_time": "2024-10-13T16:39:27",
            "upload_time_iso_8601": "2024-10-13T16:39:27.373814Z",
            "url": "https://files.pythonhosted.org/packages/00/6b/20e615172f0f8c358a37374c9f9cad96c68b038a89ea5db19a5ab5897151/little_timmy-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-13 16:39:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hoo29",
    "github_project": "little-timmy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "little-timmy"
}
        
Huw
Elapsed time: 0.46939s