conflook


Nameconflook JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryInspect ugly config files.
upload_time2023-12-15 10:47:52
maintainer
docs_urlNone
authorpuqeko
requires_python>=3.9
licenseMIT
keywords cli configuration inspect utility development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Conflook

A command line utiltiy for inspecting hard-to-read project config files such as json, yaml, and toml.

## Usage

```
Usage: conflook [OPTIONS] FILE [KEYPATH]

  Show summarised structure or value at keypath.

Options:
  -v, --version        Show the version and exit.
  -h, --help           Show this message and exit.
  -l, --limit INTEGER  Default 10. Truncate output if more than `limit` lines.
                       If 0, there is no limit.
```

Keypath is a dot separated list of keys or indicies. For example, `database.ports.2` would access the `database` table, then the `ports` array within that, then the 3rd item (at index 2) within that array. A consequence of this notation is that not all possible keys can be addressed.

If the value at the end of a valid keypath is a map-like object then it is shown as a list of keys followed by their type followed by a preview of their contents.

For example,

```
database, Table(4)
server         String(11) 192.168.1.1
ports          Array(3)   [8001, 8001, 8002]
connection_max Integer    5000
enabled        bool       True
```

A content preview attempts to be close to the real text content in the configuration file. For example, a YAML `!!binary` entry will not be decoded. Control sequences (eg newlines) in strings will be escaped.

Note that if no matching key is found in a keypath then conflook will show

- The shortest key for which the given key is a prefix, or
- The closest matching key as determined by difflib

For example,

```
conflook eg.toml data.prots
```

Gives

```
database.ports, Array(3)
[8001, 8001, 8002]
```

## Install

[Avaliable on PyPI](https://pypi.org/project/conflook/).

- Install with PIP.

  ```
  pip install conflook
  ```

  Run from command line

  ```
  conflook --help
  ```

- OR, Add as development dependancy to PDM project.

  ```
  pdm add --dev conflook
  ```

  Run from `pdm`

  ```
  pdm run conflook --help
  ```

## Develop

1. Download this repository `git clone ...`.

2. [Install PDM](https://pdm.fming.dev/#installation).
   Use PDM to install python dependancies with `pdm sync`.

   PDM will keep the versions of 3rd party libraries consistent with `pdm.lock`. The 3rd party libraries which this project depend on are listed in `pyproject.toml` along with other project settings used by the [PyPI](https://pypi.org) and exposing a command when installed.

3. [Enable pre-commit](https://pre-commit.com/#install).
   Will run automatic checks for each `git commit`, as described in `.pre-commit-config.yaml`. Might need to run `pdm run pre-commit install` to setup. [Pylint](https://pylint.org) will check for the things specified in `pylintrc.toml`. Sometimes these checks can be ignored with a `# pylint: disable=` comment if they are too pedantic.

PDM should install an editable package. Make sure to put `pdm run` before any commands to make sure the correct Python interpreter is being used and the projects dependancies are avaliable. For example, `pdm run conflook ...` will run this utility, `pdm run pre-commit run` will manually run pre-commit checks, and `pdm run python` will start an interactive python session.

The folder `eg/` contains example files.

## TODO

- search
- grep friendly
  - line numbers
  - don't truncate
- stats
- extract sub object or array to file (or is this out of scope?)


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "conflook",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "cli,configuration,inspect,utility,development",
    "author": "puqeko",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/50/c4/7d5e3a34e3402943a6face4290e99d4938c94146e1e8eb9efa2012792fe8/conflook-0.1.3.tar.gz",
    "platform": null,
    "description": "# Conflook\n\nA command line utiltiy for inspecting hard-to-read project config files such as json, yaml, and toml.\n\n## Usage\n\n```\nUsage: conflook [OPTIONS] FILE [KEYPATH]\n\n  Show summarised structure or value at keypath.\n\nOptions:\n  -v, --version        Show the version and exit.\n  -h, --help           Show this message and exit.\n  -l, --limit INTEGER  Default 10. Truncate output if more than `limit` lines.\n                       If 0, there is no limit.\n```\n\nKeypath is a dot separated list of keys or indicies. For example, `database.ports.2` would access the `database` table, then the `ports` array within that, then the 3rd item (at index 2) within that array. A consequence of this notation is that not all possible keys can be addressed.\n\nIf the value at the end of a valid keypath is a map-like object then it is shown as a list of keys followed by their type followed by a preview of their contents.\n\nFor example,\n\n```\ndatabase, Table(4)\nserver         String(11) 192.168.1.1\nports          Array(3)   [8001, 8001, 8002]\nconnection_max Integer    5000\nenabled        bool       True\n```\n\nA content preview attempts to be close to the real text content in the configuration file. For example, a YAML `!!binary` entry will not be decoded. Control sequences (eg newlines) in strings will be escaped.\n\nNote that if no matching key is found in a keypath then conflook will show\n\n- The shortest key for which the given key is a prefix, or\n- The closest matching key as determined by difflib\n\nFor example,\n\n```\nconflook eg.toml data.prots\n```\n\nGives\n\n```\ndatabase.ports, Array(3)\n[8001, 8001, 8002]\n```\n\n## Install\n\n[Avaliable on PyPI](https://pypi.org/project/conflook/).\n\n- Install with PIP.\n\n  ```\n  pip install conflook\n  ```\n\n  Run from command line\n\n  ```\n  conflook --help\n  ```\n\n- OR, Add as development dependancy to PDM project.\n\n  ```\n  pdm add --dev conflook\n  ```\n\n  Run from `pdm`\n\n  ```\n  pdm run conflook --help\n  ```\n\n## Develop\n\n1. Download this repository `git clone ...`.\n\n2. [Install PDM](https://pdm.fming.dev/#installation).\n   Use PDM to install python dependancies with `pdm sync`.\n\n   PDM will keep the versions of 3rd party libraries consistent with `pdm.lock`. The 3rd party libraries which this project depend on are listed in `pyproject.toml` along with other project settings used by the [PyPI](https://pypi.org) and exposing a command when installed.\n\n3. [Enable pre-commit](https://pre-commit.com/#install).\n   Will run automatic checks for each `git commit`, as described in `.pre-commit-config.yaml`. Might need to run `pdm run pre-commit install` to setup. [Pylint](https://pylint.org) will check for the things specified in `pylintrc.toml`. Sometimes these checks can be ignored with a `# pylint: disable=` comment if they are too pedantic.\n\nPDM should install an editable package. Make sure to put `pdm run` before any commands to make sure the correct Python interpreter is being used and the projects dependancies are avaliable. For example, `pdm run conflook ...` will run this utility, `pdm run pre-commit run` will manually run pre-commit checks, and `pdm run python` will start an interactive python session.\n\nThe folder `eg/` contains example files.\n\n## TODO\n\n- search\n- grep friendly\n  - line numbers\n  - don't truncate\n- stats\n- extract sub object or array to file (or is this out of scope?)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Inspect ugly config files.",
    "version": "0.1.3",
    "project_urls": null,
    "split_keywords": [
        "cli",
        "configuration",
        "inspect",
        "utility",
        "development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0678e3f1a1864e45452dc02766dfb05821fd02ff098a9b803dadfe505784fc94",
                "md5": "f9c018526a41cc383ca65f0a52141d64",
                "sha256": "4cc96ff6942a3f473e4f8857dd507d044a00257fb26510a8b77400c0dfb15578"
            },
            "downloads": -1,
            "filename": "conflook-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f9c018526a41cc383ca65f0a52141d64",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11865,
            "upload_time": "2023-12-15T10:47:49",
            "upload_time_iso_8601": "2023-12-15T10:47:49.057797Z",
            "url": "https://files.pythonhosted.org/packages/06/78/e3f1a1864e45452dc02766dfb05821fd02ff098a9b803dadfe505784fc94/conflook-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50c47d5e3a34e3402943a6face4290e99d4938c94146e1e8eb9efa2012792fe8",
                "md5": "4dce9be517e481538d76d6fc15bd20c4",
                "sha256": "2f59ba7425e5c8f2f8c61583362c397f8b4fd897727ae330c4dfcdf087cc7033"
            },
            "downloads": -1,
            "filename": "conflook-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4dce9be517e481538d76d6fc15bd20c4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 10235,
            "upload_time": "2023-12-15T10:47:52",
            "upload_time_iso_8601": "2023-12-15T10:47:52.139873Z",
            "url": "https://files.pythonhosted.org/packages/50/c4/7d5e3a34e3402943a6face4290e99d4938c94146e1e8eb9efa2012792fe8/conflook-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-15 10:47:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "conflook"
}
        
Elapsed time: 0.15065s