Authenticate to Zitadel with miradi_auth-0.1.2 in conda env
Good morning,
I have a Python script that has a bunch of dependencies isolated in a conda environment. According to the readm.me of miradi_auth-0.1.2, this should be installed from pipx. The issue is that this creates a different environment.
I would like to check if there is a way to install miradi_auth-0.1.2 in a conda environment.
If this is not possible, I may be able to call "miradi-auth login --env live" from a subprocess in python, although this does not seem too clean.
-
Official comment
Hi Diego,
Yes, pipx is just one convenient way to install it. Its whole job is to keep the tool in its own isolated environment, which is why your script can't see it. miradi-auth is a normal pure-Python package (its only dependency is httpx), so you can install it straight into your conda environment instead:
Using the same wheel you download from the Miradi Tools page on Miradi Share:conda activate <your-env-name>
pip install /path/to/miradi_auth-0.1.2-py3-none-any.whl # wherever you saved the downloadAfter that, both the miradi-auth command and the importable package live in your conda environment. And you can skip the subprocess approach entirely, it's designed to be called directly from Python:
from miradi_auth import get_token
token = get_token(env="live") # refreshes automatically as needed
You still do the one-time interactive sign-in once from a terminal (with the env active) to create the stored session:miradi-auth login --env live
From then on, get_token(env="live") reads and silently refreshes that stored token in-process.
-Brian
Please sign in to leave a comment.
Comments
1 comment