{"id":14958,"library":"taplo-test","title":"Taplo (CLI Wrapper for Python)","description":"Taplo is a versatile, feature-rich TOML toolkit written in Rust, providing capabilities for linting, formatting, and validating TOML documents. This registry entry refers to the Python interface provided by the `taplo-test` PyPI package, which acts as a command-line interface (CLI) wrapper for the core Taplo CLI tool. The core Taplo project is actively maintained, with frequent releases. While the Python package `taplo-test` currently stands at version 0.9.1rc1, it provides access to the functionalities of the underlying Taplo CLI, which has reached versions like 0.9.3 and beyond.","status":"active","version":"0.9.3","language":"en","source_language":"en","source_url":"https://github.com/tamasfe/taplo","tags":["toml","linter","formatter","validation","cli-wrapper","rust"],"install":[{"cmd":"pip install taplo-test","lang":"bash","label":"Install `taplo-test` PyPI package"}],"dependencies":[],"imports":[],"quickstart":{"code":"import subprocess\nimport os\n\n# Create a dummy TOML file for demonstration\ntoml_content_unformatted = '''\n[package]\nname = \"my-app\"\nversion = \"0.1.0\"\nauthors = [\"John Doe\"]\n\n  dependencies =\n  [\n    \"toml\"\n  ]\n'''\n\ntoml_file = \"example.toml\"\nwith open(toml_file, \"w\") as f:\n    f.write(toml_content_unformatted)\n\nprint(f\"Original {toml_file} content:\\n{toml_content_unformatted}\")\n\n# --- Formatting using the wrapped Taplo CLI ---\ntry:\n    # Format the file in-place\n    format_result = subprocess.run([\"taplo\", \"format\", toml_file], capture_output=True, text=True, check=True)\n    print(f\"\\nTaplo format stdout: {format_result.stdout}\")\n    if format_result.stderr:\n        print(f\"Taplo format stderr: {format_result.stderr}\")\n\n    with open(toml_file, \"r\") as f:\n        formatted_content = f.read()\n    print(f\"Formatted {toml_file} content:\\n{formatted_content}\")\n\n    # --- Validation using the wrapped Taplo CLI ---\n    check_result = subprocess.run([\"taplo\", \"check\", toml_file], capture_output=True, text=True, check=True)\n    print(f\"\\nTaplo check stdout: {check_result.stdout}\")\n    if check_result.stderr:\n        print(f\"Taplo check stderr: {check_result.stderr}\")\n    print(f\"{toml_file} is valid according to Taplo.\")\n\nexcept FileNotFoundError:\n    print(\"Error: 'taplo' command not found. Ensure Taplo CLI is installed and in your PATH.\")\n    print(\"You might need to install the Taplo CLI separately or ensure the pip package correctly installs it.\")\nexcept subprocess.CalledProcessError as e:\n    print(f\"Error running Taplo CLI: {e}\")\n    print(f\"Stdout: {e.stdout}\")\n    print(f\"Stderr: {e.stderr}\")\nfinally:\n    # Clean up the dummy file\n    if os.path.exists(toml_file):\n        os.remove(toml_file)\n","lang":"python","description":"This quickstart demonstrates how to use the `taplo-test` package to interact with the underlying Taplo CLI for formatting and validating TOML files. It uses Python's `subprocess` module to call the `taplo` command-line tool."},"warnings":[{"fix":"Be aware that you are interacting with a wrapper around a CLI tool. Use `subprocess.run()` to invoke `taplo` commands directly for full control over CLI options. Ensure the `taplo` executable is in your system's PATH, or provide its full path to `subprocess.run()`.","message":"The PyPI package `taplo-test` (0.9.1rc1) is a Python wrapper for the Rust-based Taplo CLI. The version `0.9.3` refers to the core Taplo CLI functionality, not the exact version of the `taplo-test` Python package on PyPI. Users expecting a pure Python library with direct function calls (e.g., `import taplo; taplo.format()`) might find the interaction primarily through subprocess calls to the `taplo` executable.","severity":"gotcha","affected_versions":"All versions of `taplo-test` (0.9.1rc1) and potentially future wrappers."},{"fix":"Manage Taplo's behavior by creating a `taplo.toml` file in your project's root or configuring it within `pyproject.toml`. Refer to the official Taplo documentation for detailed configuration options.","message":"Taplo CLI configuration, including formatting rules and schema validation, is typically managed through `taplo.toml` files or the `[tool.taplo]` section in `pyproject.toml`. These configurations are external to your Python code and are read by the `taplo` executable.","severity":"gotcha","affected_versions":"All versions."},{"fix":"Pin the version of `taplo-test` (and indirectly the underlying Taplo CLI) in your `requirements.txt` or `pyproject.toml` to ensure consistent behavior. Regularly check the official Taplo GitHub releases and changelogs for breaking changes when updating.","message":"The underlying Rust-based Taplo CLI is under active development. While efforts are made for stability, breaking changes could occur in its CLI arguments or output, which might affect Python scripts relying on `subprocess` to call `taplo`.","severity":"breaking","affected_versions":"Potentially between major and minor versions of the core Taplo CLI (e.x., 0.9.x to 0.10.x)."}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[],"ecosystem":"pypi"}