-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: expose READTHEDOCS_VIRTUALENV_PATH
variable
#9971
Conversation
This variable points to where Read the Docs created the virtualenv. Closes #9629
This variable contains the path we need to call the Python executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple concerns here, but I agree with the overall approach. Using this env definitely simplifies things and allows us to make sure we don't break them for the user, as well.
I think the hacky part and possible user confusion is my biggest worry.
""" | ||
Return path to the virtualenv bin path, or a specific binary. | ||
|
||
:param filename: If specified, add this filename to the path return | ||
:returns: Path to virtualenv bin or filename in virtualenv bin | ||
""" | ||
parts = [self.venv_path(), 'bin'] | ||
parts = ["$READTHEDOCS_VIRTUALENV_PATH", "bin"] | ||
if conda: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an awkward place to introduce conda. Previously this function didn't know about conda at all, and I'm wondering if it's the right place for this logic? Or perhaps we need to rename this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong preference here. It's the same code -- The only difference is the prefix (virtualenv or condaenv variable). I put it in the super-class only to avoid repetition of the same logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this to make the code more explicit: 66fe0a7. Let me know if that looks better 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is definitely nicer. Though I'd argue the venv
in the name is misleading for conda envs :) Perhaps it should just be called env_bin
or similar? Not a huge deal tho.
This is ready for another round of review. I think I addressed all the feedback provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on board with this as is.
A small nitpick is the venv_bin
implementation is still a bit hacky how it is different in signature. Now that we've removed some so much logic from it, I wonder if it's even still useful?
Co-authored-by: Eric Holscher <[email protected]>
I added a note in We can come back to this later if we want to. For now, I want to deploy the feature and unblock this to move forward and deploy these changes. |
Hello everyone, I have a build failure with an error for a project which uses conda:
I think this error is related to this PR. |
@Bilokin please open a new issue filling the template and linking back to this issue if you think it's related. Thanks 👍 |
The variable
$READTHEDOCS_VIRTUALENV_PATH
points to where Read the Docs created the virtualenv.While working on this I found that we can use this variable to run our own commands. This way, we will be avoiding mistakes and potentially having differences path between "the real path" and the content of this variable. I changed our code to use this variable when running
/bin/python
and others.Besides, I did the same for Conda environments and the variables
CONDA_ENV_PATHS
andCONDA_DEFAULT_ENV
that were already defined.This makes the code cleaner and simpler, while more standardized as well. Users can use these variables in the same way Read the Docs does and be sure the content they are expecting is going to be there.
Closes #9629
📚 Documentation previews 📚
docs
): https://docs--9971.org.readthedocs.build/en/9971/dev
): https://dev--9971.org.readthedocs.build/en/9971/