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 request: activate hatch environment for current directory #127

Open
dhdaines opened this issue Jun 18, 2024 · 0 comments
Open

Feature request: activate hatch environment for current directory #127

dhdaines opened this issue Jun 18, 2024 · 0 comments

Comments

@dhdaines
Copy link

There are now a few different tools that manage virtual environments automatically based on the pyproject.toml for a project. I do happen to like hatch, so I made a hack to enable its default environment (one could of course add an option to query which environment to use) for the project in a given directory:

(require 'subr-x)
(require 'pyvenv)
(defun hatch-activate (directory)
  "Activate the default hatch virtual environment for DIRECTORY"
  (interactive (list (read-directory-name "Activate for project: ")))
  (let ((expdir (expand-file-name directory))
        (default-directory directory))
    (let ((hatch-env
           (string-trim
            (shell-command-to-string "hatch env find"))))
      (pyvenv-activate hatch-env)
    )))

This would be a nide feature to have in pyvenv.el. But perhaps there already exists a package for this elsewhere?

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

No branches or pull requests

1 participant