Skip to content

Use Huak to manage virtual environments for projects #794

@cnpryer

Description

@cnpryer

Summary

Allow for users to use Huak to manage virtual environments for projects.

Motivation

Currently Huak will resolve a Python environment to use for each command. It does this by searching for a virutal environment to use or by creating a new one. This isn't exposed well to users. Adding features for more control over this process would help make Huak easier to use.

The goal is for Huak to manage things like project virtual environments without having to burden the user, but if the user ever needs to manage their project's virtual environment there should be a way to do it.

Requirements

  • Retain Huak's default Python environment resolution behavior
  • Allow in-project and out-of-project virutal environments
  • Allow for per-project + per-package venvs if needed
  • Allow a future without virtual environments
  • Allow for persisting multiple environments to select from
  • Help make freeing up install command easier (see Use Huak to install tools to a global *toolchain* #850)

Details

At the workspace level a project can be given a virtual environment to use .venv. Per-project users may want to change what virtual environment Huak uses. The python subcommand is meant to be reserved for managing and interacting with Python.

(WIP; see comment)

huak python use <version> # default resolution behavior
huak python use --path <path/to/python>
huak run python -m venv ../somewhere/else/venv
huak python use --path ../somewhere/else/venv
huak python env create --path ../somewhere/else/venv  # If Huak replaces current pip-managed venvs
huak python env create --requirements <requirements-file>
huak python env create --manifest <pyproject.toml/setup.py/etc.>
huak python use <version> <version>  # If Huak supports using more than one environment per-project

Entered to a environments.toml in Huak's home directory:

[scope.python]
"path/to/scope" = "path/to/py-env"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions