-
-
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 location of virtualenv #9629
Comments
Hi @davidism! I don't have experience working with PDM, so maybe what I'm going to suggest makes no sense 😄 However, for Poetry users that have a similar situation where the "feature of auto-creation of the virtualenv interferes with Read the Docs default build workflow" we documented a workaround for that at https://docs.readthedocs.io/en/latest/build-customization.html#install-dependencies-with-poetry. I saw that PDM does support something similar https://pdm.fming.dev/latest/usage/venv/#disable-virtualenv-mode That solution/workaround does work for your case? |
In PDM, disabling virtualenv support means enable the old |
@davidfischer @ericholscher This is the virtualenv feature I was talking about yesterday. |
Gotcha, I was going to suggest something like |
I'm planning to switch Flask, Click, etc. to PDM soon. It would be nice to be able to directly reference the virtualenv location. What's the status of work on this? |
@davidism I will add this to our upcoming sprint so we can take a look at it. I think it's reasonable to add it to the environment, and won't be complex, but mostly just need to do the PR 👍 |
This variable points to where Read the Docs created the virtualenv. Closes #9629
I went ahead and implemented this feature in #9971. Hopefully, we can review it this week and deploy it the next one. Considering |
@frostming does this look correct? |
LGTM |
Will you close this once it's deployed? Or is it ready for me to test? |
@davidism It should go out in our deploy next week on Tuesday. This issue will likely get closed once the issue is merged, but Tuesday is the day :) |
* Build: expose `READTHEDOCS_VIRTUALENV_PATH` variable This variable points to where Read the Docs created the virtualenv. Closes #9629 * Build: use our own variable `$READTHEDOCS_VIRTUALENV_PATH` This variable contains the path we need to call the Python executable. * Build: use environment variables for Conda as well * Tests: add missing variable * Lint * Lint again * Missing : * Test: update env variables * Test: make it work locally and CicleCI * Docs: add link to the builds page * Refactor: make `venv_bin` more concrete to match venv/conda * Build: missing return * API: sanitize build command properly * Update readthedocs/api/v2/serializers.py Co-authored-by: Eric Holscher <[email protected]> --------- Co-authored-by: Eric Holscher <[email protected]>
@davidism @frostming This is already deployed. You should be able to make usage of the variable |
Looks like it worked: https://readthedocs.org/projects/flask-sqlalchemy/builds/19424647/ thanks! |
I'm using the PDM dependency management tool, moving away from
requirements.txt
files. If PDM does not detect an active virtualenv, or is not told about the location of a virtualenv, it will create one and install packages there.Read the Docs does not activate or expose the path to the virtualenv it creates. It seems that
which python
does report the virtualenv python despite that, so a hack is used to get the path and tell PDM about it. pdm-project/pdm#1365 (comment)It would be helpful if Read the Docs made the virtualenv easier to find. You could set
VIRTUAL_ENV
, or maybeRTD_VIRTUAL_ENV
if you don't want to affect other tools by default. Alternatively, activate it.The text was updated successfully, but these errors were encountered: