tessl install tessl/pypi-tox-pyenv@1.1.0tox plugin that makes tox use `pyenv which` to find python executables
Agent Success
Agent success rate when using this tile
98%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.03x
Baseline
Agent success rate without this tile
95%
Build a command-line tool that resolves and reports Python executable paths for different Python versions using pyenv.
Your tool should accept a Python version identifier (e.g., python3.9, python2.7, pypy3) as a command-line argument and output the full path to the corresponding Python executable as managed by pyenv.
The tool must:
The tool must handle errors appropriately:
python3.9 when pyenv has Python 3.9 installed, the tool outputs the path /home/user/.pyenv/versions/3.9.0/bin/python3.9 and exits with code 0 @testpython2.7 when pyenv does not have Python 2.7 installed, the tool prints an error to stderr and exits with code 2 @test@generates
#!/usr/bin/env python
"""
Python Version Resolver - Resolves Python executable paths via pyenv
"""
def find_pyenv_binary():
"""
Locate the pyenv binary in the system PATH.
Returns:
str: Path to the pyenv binary
Raises:
FileNotFoundError: If pyenv is not found in PATH
"""
pass
def resolve_python_executable(version_identifier):
"""
Resolve the full path to a Python executable for a given version identifier.
Args:
version_identifier (str): Python version identifier (e.g., 'python3.9', 'pypy3')
Returns:
str: Full path to the Python executable
Raises:
FileNotFoundError: If pyenv is not available
RuntimeError: If pyenv cannot find the specified Python version
"""
pass
def main():
"""
Main entry point for the command-line tool.
Parses command-line arguments, resolves the Python executable,
and prints the result or error messages.
Exits with appropriate status codes:
0: Success
1: Invalid usage or pyenv not found
2: Python version not found by pyenv
"""
pass
if __name__ == '__main__':
main()Provides reference implementation for pyenv integration patterns