[Python] Using a Python CLI (via the Click package) without activating a virtualenv

Discussão em 'Python' iniciado por Stack, Julho 9, 2025.

  1. Stack

    Stack Membro Participativo

    A devops guy on my team has written a "devops-cli" tool in Python, using the Click package. It works just fine but requires users to manually activate a virtualenv before using it. Open up a new tab and try to call a command and you get an error. It works, but it's just annoying. He's offered up a tool called direnv which when configured will activate / deactivate venvs when you cd into a directory that requires one.

    But per the Click documentation, it seems as if we should be able to use the CLI tool without manually, or programmatically, activating a venv first.

    Could someone more familiar with Click, or Python based CLIs, offer insight into this? I've used Python CLIs before and never had to manually activate a venv first.

    Continue reading...

Compartilhe esta Página