Task:
Build a Python package named xpath located at /app/xpath/ (and ensure it is importable as a package by the tests). The package must expose submodules so that the imports in the tests work:
from xpath import cli
from xpath import xpath
Requirements:
Package structure
Create a package directory /app/xpath/ with an init.py (can be empty).
Inside /app/xpath/, implement:
cli.py
xpath.py
cli.py (Click-based CLI)
Define a Click command named main with no required arguments:
Signature: def main(): (decorated with @click.command())
Behavior:
When invoked (e.g., via CliRunner().invoke(cli.main)), it should print the exact string "xpath.cli.main" to stdout.
It should exit with code 0 for a normal run.
Help argument:
The command must support the standard Click --help option. The help output should include the exact line: "--help Show this message and exit."
xpath.py (helper module)
Provide a simple, importable function to satisfy the test import. For example:
Include a short docstring describing its placeholder nature.
Tests compatibility
Ensure importing works:
When tests run, they can do: from xpath import cli and from xpath import xpath
Do not require external resources; keep implementations minimal and deterministic.
Placement note
The implementation must go in /app/xpath/ (as a package). If you instead place code in /app/xpath.py (single-file module), adjust accordingly only if tests explicitly rely on that path; however, the tests provided expect the package layout described above.
Deliverable
A working /app/xpath/ package containing:
init.py
cli.py (with main click command)
xpath.py (with parse_xpath function)
The implementation goes in /app/xpath/ (as a package).