Skip to content
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

feat(nx-python): automatically activate shared virtual environment #138

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

lucasvieirasilva
Copy link
Owner

Current Behavior

When the monorepo workspace uses the shared virtual environment mode, the user is obligated to activate the root virtual environment before running any @nxlv/python executors, like, test, lint, and build.

Expected Behavior

If the root pyproject.toml has the following configuration:

...
[tool.nx]
autoActivate = true
...

All the @nxlv/python commands will check if some virtual environment is already activated, if not, first activate the virtual environment before running the commands.

This PR also adds a new executor @nxlv/python:run-commands that wraps the default nx:run-commands and performs the action described above to activate the virtual environment first.

If you are using @nxlv/python version 16> you can use the following command to migrate all your nx:run-commands to @nxlv/python:run-commands:

npx nx migrate @nxlv/python

Related Issue(s)

Reference #132

Changes all the `@nxlv/python` executors to first verify if the shared virtual environment is
available in the workspace, if yes, activate before running the commands, also adds a new
`@nxlv/python:run-commands` executors to wrap the `nx:run-commands` and activate the virtual
environment before running the commands, if you are using `@nxlv/python` version 16> you can use
this following command to migrate all your `nx:run-commands` to `@nxlv/python:run-commands`: `npx nx
migrate @nxlv/python`

re #132
@lucasvieirasilva lucasvieirasilva linked an issue Jul 3, 2023 that may be closed by this pull request
1 task
@lucasvieirasilva lucasvieirasilva added the enhancement New feature or request label Jul 3, 2023
@lucasvieirasilva lucasvieirasilva self-assigned this Jul 3, 2023
@lucasvieirasilva lucasvieirasilva merged commit e275534 into main Jul 3, 2023
github-actions bot pushed a commit that referenced this pull request Jul 3, 2023
# [16.1.0](nx-python-v16.0.0...nx-python-v16.1.0) (2023-07-03)

### Features

* **nx-python:** automatically activate shared virtual environment ([#138](#138)) ([e275534](e275534)), closes [#132](#132)
@github-actions
Copy link

github-actions bot commented Jul 3, 2023

🎉 This PR is included in version 16.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

automatically activate shared virtual environment
1 participant