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

add env var to auto activate venv #25

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

verte-zerg
Copy link

@verte-zerg verte-zerg commented Dec 11, 2024

Added support for MISE_POETRY_VENV_AUTO. If the variable is set to "1" or "true," the plugin will attempt to automatically activate the virtual environment. It checks the project for the presence of both poetry.lock and pyproject.toml files, and if they are found, venv is activated.

@verte-zerg verte-zerg force-pushed the add-pyproject-file-as-default branch from 533475f to 1c8c3f0 Compare December 11, 2024 15:41
@jdx
Copy link
Member

jdx commented Dec 11, 2024

this seems like a crazy change in behavior to me

@verte-zerg
Copy link
Author

verte-zerg commented Dec 11, 2024

This seems like a crazy change in behavior to me.

Okay, the only crazy part is that it will change the default behavior.
But the main issue is that this plugin cannot automatically activate the environment without creating a mise.toml file.
I can set MISE_TOOL_OPTS__PYPROJECT to pyproject.toml, but it will log an error every time the directory changes if the directory doesn't contain a pyproject.toml.

If you propose any other working solution, I can implement it.

@jdx
Copy link
Member

jdx commented Dec 11, 2024

I think you should add an env var to enable this behavior like MISE_POETRY_VENV_AUTO=1

@verte-zerg verte-zerg force-pushed the add-pyproject-file-as-default branch from 1c8c3f0 to 2209d68 Compare December 11, 2024 18:29
@verte-zerg
Copy link
Author

I think you should add an env var to enable this behavior like MISE_POETRY_VENV_AUTO=1

I've added support for the MISE_POETRY_VENV_AUTO variable and included a check to ensure the project contains both poetry.lock and pyproject.toml files before activating venv.

@verte-zerg verte-zerg force-pushed the add-pyproject-file-as-default branch from 2209d68 to ed32c7f Compare December 11, 2024 18:36
@verte-zerg verte-zerg changed the title add pyproject.toml as default add env var to auto activate venv Dec 11, 2024
@jdx jdx merged commit c285853 into mise-plugins:main Dec 11, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants