An open API service indexing awesome lists of open source software.

https://github.com/brandonwillard/pyvenv-extras

An Emacs package that adds projectile-based Python virtual environment tracking to pyvenv, and more
https://github.com/brandonwillard/pyvenv-extras

emacs persp-mode projectile python pyvenv

Last synced: 29 days ago
JSON representation

An Emacs package that adds projectile-based Python virtual environment tracking to pyvenv, and more

Awesome Lists containing this project

README

          

#+TITLE: =pyvenv-extras=
#+AUTHOR: Brandon T. Willard

[[Testing Workflow][file:https://github.com/brandonwillard/pyvenv-extras/workflows/Testing%20Workflow/badge.svg]]

An Emacs package that adds =projectile= and/or =persp-mode=-based Python virtual
environment tracking to =pyvenv=, and more.

* Features

** =pyvenv-extras-mode=
- Initialize terminals so that they automatically enable the local
venv (implemented for =term= and =vterm=)
- Add =CONDA_PREFIX= and =CONDA_DEFAULT_ENV= variables to the environment
- Activate =comint= buffers within the =projectile=-determined project root
directory
- Start and restart Python inferior processes in a way that preserves the
=pyvenv= venv settings and prevents the cursor from jumping
- Make interactive Python sessions project-specific by adding =projectile=
project names to =python-mode= process names
- Make =flycheck= use the =projectile= project directory

** =pyvenv-projectile-tracking-mode=

This mode augments =pyvenv-tracking-mode= by only changing the virtual
environment when the =projectile= project changes (and has a different
virtual environment).

Currently, the approach used relies on the availability of =pyvenv-workon=
values within in each projects' =.dir-locals.el=, so each project must have
those set.

** =pyvenv-persp-tracking-mode=

This mode sets the virtual environment when a =persp-mode= perspective is
activated.

When =projectile= is set to use =persp-mode=-scoped projects via
[[https://github.com/brandonwillard/proj-persp-extras][=proj-persp-extras=]] and =pyvenv-projectile-tracking-mode= is enabled, this
mode effectively enables =persp-mode=-based virtual environment scopes. In
other words, your current =persp-mode= perspective determines which virtual
environment is activate.

* Usage

Just enable the minor modes:
#+BEGIN_SRC elisp :eval never :exports code :results none
(pyvenv-extras-mode +1)
(pyvenv-projectile-tracking-mode +1)
(pyvenv-persp-tracking-mode +1)
#+END_SRC

* Installation

Use your favorite approach to installing Emacs packages from GitHub.

Here's an example of one:
#+BEGIN_SRC elisp :eval never :exports code :results none
(quelpa
'(pyvenv-extras
:fetcher git
:url "https://github.com/brandonwillard/pyvenv-extras.git"))
#+END_SRC

* Development
To use as a Cask dependency:
#+BEGIN_SRC elisp :eval never :exports code :results none
(depends-on "pyvenv-extras"
:git "https://github.com/brandonwillard/pyvenv-extras.git"
:branch "master")
#+END_SRC