-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve virtual-environment creation #26
Improve virtual-environment creation #26
Conversation
3c78761
to
bf141ab
Compare
f6a7436
to
00f3920
Compare
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 think we need some test cases for this logic. I would look at the e2e tests in mise like https://github.com/jdx/mise/blob/main/e2e/core/test_python_venv for some inspiration.
bin/exec-env
Outdated
|
||
if is_enabled MISE_POETRY_AUTO_INSTALL; then | ||
echoerr "Executing \`poetry install\` to populate virtual environment." | ||
poetry_bin "${project_root}" --ansi install |
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.
the terminal might not support colors. I think there is an env var that gets passed from mise saying if there are colors enabled. If not we should add that first to detect if we can safely enable colors.
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.
there's MISE_COLOR
but I'm not sure it gets passed into plugins - is that the one you were thinking of?
There is also reference to CLICOLOR
in the docs, but I don't think that gets passed in either.
poetry
uses the NO_COLOR
env var for the same purpose, I think.
The reason I had set --ansi
because when poetry
runs non-interactively in the plugin it doesn't display colours.
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.
there are situations like if TERM=dumb
where it can be a tty but colors should still not be enabled. I think we should add a new env var like MISE_PLUGIN_COLORS=1
to this list: https://github.com/jdx/mise/blob/ba66d4659c6d8f3ffa589dacfe402d6988e46d9a/src/plugins/asdf_plugin.rs#L410-L416
we don't want to use MISE_COLOR
I don't think because mise might be used for non-tty things inside of a plugin
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.
OK - I've added a check on (the currently non-existent) MISE_PLUGIN_COLORS
which means that --ansi
is disabled for now
- use `poetry run true` dummy command to create the virtual-env if it doesn't exist (this is necessary for `MISE_POETRY_AUTO_INSTALL` to work) - show ANSI colouring when env is created/populated - general refactoring
00f3920
to
138ceb3
Compare
I'm not done yet (needs more tests), but I made a start in |
008da6b
to
aedc98b
Compare
8aceea5
to
017d25c
Compare
be42ef2
to
feed16a
Compare
feed16a
to
11dd1bd
Compare
I tried to get the tests to run as a |
wow nice work! is it ready? |
Thanks @jdx :) I think it is - I'm just not sure whether I interpreted the |
poetry run true
dummy command to create the virtual-env if itdoesn't exist (this is necessary for
MISE_POETRY_AUTO_INSTALL
towork)
I've tried to interpret what the purpose of the
MISE_POETRY_AUTO_VENV
is, and I think it's supposed to be an optional guard against "activating" the venv if the lock file is missing.