Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pythonic-emacs/pyenv-mode
Integrate pyenv with python-mode.
https://github.com/pythonic-emacs/pyenv-mode
Last synced: 3 months ago
JSON representation
Integrate pyenv with python-mode.
- Host: GitHub
- URL: https://github.com/pythonic-emacs/pyenv-mode
- Owner: pythonic-emacs
- Created: 2014-03-06T17:31:59.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-07-21T10:59:01.000Z (7 months ago)
- Last Synced: 2024-08-02T01:26:13.833Z (6 months ago)
- Language: Emacs Lisp
- Homepage:
- Size: 28.3 KB
- Stars: 121
- Watchers: 5
- Forks: 13
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
.. |melpa| image:: https://melpa.org/packages/pyenv-mode-badge.svg
:target: https://melpa.org/#/pyenv-mode
:alt: Melpa
.. |melpa-stable| image:: https://stable.melpa.org/packages/pyenv-mode-badge.svg
:target: https://stable.melpa.org/#/pyenv-mode
:alt: Melpa-Stable
.. |ci| image:: https://github.com/pythonic-emacs/pyenv-mode/actions/workflows/test.yml/badge.svg
:target: https://github.com/pythonic-emacs/pyenv-mode/actions/workflows/test.yml
:alt: CI==========
Pyenv mode
==========|melpa| |melpa-stable| |ci|
Pyenv mode integrates Fabián E. Gallina's `python.el`_ with the pyenv_ tool.
This gives packages which already use python.el (like python-django_)
pyenv virtual environment support out-of-the-box.Pyenv mode does...
~~~~~~~~~~~~~~~~~~* Setup the ``PYENV_VERSION`` environment variable and
``python-shell-virtualenv-path`` custom variable based on user inputPyenv mode doesn't...
~~~~~~~~~~~~~~~~~~~~~* Override your ``exec-path``
* Run external shell scripts
* Manage your pyenv installation
* Deal with virtualenvwrapperInstallation
------------You can simply install the package from Melpa_::
M-x package-install RET pyenv-mode
Usage
-----Add following block to your Emacs configuration:
.. code:: lisp
(pyenv-mode)
Now you can specify the pyenv Python version::
M-x pyenv-mode-set
So now when you run inferior Python with::
M-x run-python
The process will start inside the specified Python installation. You can
unset the current version with::M-x pyenv-mode-unset
Goodies
-------When you set the Python version with ``pyenv-mode``, the following changes
happen automatically:* compile commands use proper Python version and environment
* flycheck_ performs syntax checking according to Python version you use
* anaconda-mode_ search completions, definitions and references respect the chosen environmentProjectile integration
``````````````````````You can switch Python versions together with your current project. Drop
the following lines into your Emacs init file. When you use projectile switch
project with the ``C-c p p`` key binding ``pyenv-mode`` will activate the
environment matched to the project's name... code:: lisp
(require 'pyenv-mode)
(defun projectile-pyenv-mode-set ()
"Set pyenv version matching project name."
(let ((project (projectile-project-name)))
(if (member project (pyenv-mode-versions))
(pyenv-mode-set project)
(pyenv-mode-unset))))(add-hook 'projectile-after-switch-project-hook 'projectile-pyenv-mode-set)
.. _python.el: http://repo.or.cz/w/emacs.git/blob_plain/master:/lisp/progmodes/python.el
.. _pyenv: https://github.com/yyuu/pyenv
.. _python-django: https://github.com/fgallina/python-django.el
.. _Melpa: https://melpa.org
.. _flycheck: https://github.com/flycheck/flycheck
.. _anaconda-mode: https://github.com/proofit404/anaconda-mode
.. _projectile: https://github.com/bbatsov/projectile