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

[feature] Run tasks in Python virtual environment #1658

Open
sharpepd opened this issue Sep 23, 2024 · 0 comments
Open

[feature] Run tasks in Python virtual environment #1658

sharpepd opened this issue Sep 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@sharpepd
Copy link

Is your feature request related to a problem? Please describe.

I am new to moon, but I really like what I see! I am looking to use it primarily as a task runner.

But the tasks we want to run will be primarily provided via pip (python packages). Therefore, to ensure we have a consistent python environment, I need tasks to run in a virtual environment.

I would like to do this in a way that there is a task that creates the virtual environment with the required pip dependencies and then subsequent tasks operate in this environment (or can be specified to)

Describe the solution you'd like

I would like one of the following:

  • The ability to use envFile in tasks that are generated during the run of a previous task.
  • An option inVirtualEnv that points to a path of a virtual environment to be activated.
  • Any alternative solution that allows me to do this that makes more sense in the context of moon.

Describe alternatives you've considered

My experiments so far, suggest this is not possible, without some kind of wrapper around my commands. E.g. a cmd script that first activates the virtual environment before running the actual command.

I have played with generating a .env file and using that in the envFile option of tasks, but the issue is that the envFile seems to be read before the file is generated by the task that generates it. So, I would have to run the setup task first and then run the other tasks, but it would be nice to be able to do it all in one step, i.e via a dep.

Additional context

Note that the virtual environment I am creating is created in the workspace (usually /.venv).

I am guessing something like this may be needed for the Python language support as well. But I am not talking about a Python project here, just a project wanting to use commands installed via pip.

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

No branches or pull requests

1 participant