View all files | ||||
This project needs contributors.
Documentation:
Important notes:
From 2017-11-19 onwards python-mode uses submodules instead of hard coding 3rd party libraries into its codebase. Please issue the command: git submodule update --init --recursive inside your python-mode folder.
From 2019-12-14 onwards python-mode dropped python2 support. If you still need to use it with python2 you should look for the last-py2-support branch and/or tag.
From version 0.15.0 onwards, python-mode uses Ruff for linting and formatting, replacing 7 legacy submodules (pyflakes, pycodestyle, mccabe, pylint, pydocstyle, pylama, autopep8). This reduces the repository size significantly (from 13 to 3 submodules) and improves performance. See MIGRATION_GUIDE.md for migration details.
If you are a new user please clone the repos using the recursive flag:
git clone --recurse-submodules https://github.com/python-mode/python-mode
Repository size: The repository now includes only 3 essential submodules (rope, pytoolconfig, tomli), down from 13 previously. This reduces clone size and improves maintenance. Ruff is installed separately via pip install ruff.
Python-mode is a Vim plugin that magically converts Vim into a Python IDE.
Why Python-mode?
The plugin contains all you need to develop python applications in Vim.
See a screencast here: http://www.youtube.com/watch?v=67OZNp9Z0CQ.
Another old presentation here: http://www.youtube.com/watch?v=YhqsjUUHj6g.
To read python-mode documentation in Vim, use :help pymode.
Vim >= 7.3 (most features needed +python3 support) (also --with-features=big if you want g:pymode_lint_signs).
Python dependencies:
As of vim8 there is an officially supported way of adding plugins. See :tab help packages in vim for details.
Note. Windows OS users need to add -c core.symlinks=true. See below.
Enable pathogen in your ~/.vimrc:
Include the following in the vim-plug section of your ~/.vimrc:
Add the following:
Then rebuild helptags in vim:
filetype-plugin (:help filetype-plugin-on) and filetype-indent (:help filetype-indent-on) must be enabled to use python-mode.
For consistent testing across different Python versions, python-mode provides a Docker-based testing environment. This is especially useful for contributors and developers who want to test the plugin with different Python versions.
The Docker environment supports the following Python versions:
For detailed information about the Docker testing environment, see README-Docker.md.
First read our short FAQ or using :help pymode-faq. If your question is not described there then you already know what to do (because you read the first item of our FAQ :) ).
Nevertheless just a refresher on how to submit bugs:
(From the FAQ)
Clear all python cache/compiled files (*.pyc files and __pycache__ directory and everything under it) from your python-mode install directory.
In Linux/Unix/MacOS you can run:
find <path_to_pymode> -type f -iname '*.pyc' -o -iname '*.pyo' -delete && find . -type d -name '__pycache__' -delete
Then start python mode with:
vim -i NONE -u <path_to_pymode>/debugvimrc.vim
Reproduce the error and submit your python mode debug file. You can check its location with :messages for something like:
pymode debug msg 1: Starting debug on: 2017-11-18 16:44:13 with file /tmp/pymode_debug_file.txt
Please submit the entire content of the file along with a reasoning of why the plugin seems broken.
Do check for sensitive information in the file before submitting.
Please, also provide more contextual information such as:
If you're using the Docker testing environment, also provide:
Read this section before opening an issue on the tracker.
Vim has issues to work with both python2 and python3 at the same time, so if your VIM is compiled with support to both version you may find problems. The best way to handle it is to build your vim again with only python3 support. Here is a good reference on how to build vim from source.
python-mode supports only python3, so, if you are using python2 we cannot help you that much. Look for our branch with python2-support (old version, not maintained anymore) (last-py2-support).
python-mode supports only Python 3. The project has completely removed Python 2 support since version 0.11.0. Currently supported Python versions are: 3.10.13, 3.11.9, 3.12.4, and 3.13.0.
If you need Python 2 support, you can use the legacy last-py2-support branch, but it is no longer maintained.
Vim has issues when compiled with both Python 2 and Python 3 support. For best compatibility with python-mode, build Vim with only Python 3 support. See this guide for building Vim from source.
Users on Windows OS might need to add -c core.symlinks=true switch to correctly clone / pull repository. Example: git clone --recurse-submodules https://github.com/python-mode/python-mode -c core.symlinks=true
If you encounter issues with the Docker testing environment:
Build Failures: Ensure Docker and Docker Compose are properly installed and up to date. The Dockerfile requires Ubuntu 24.04 packages.
Python Version Issues: Verify that the requested Python version is supported (3.10.13, 3.11.9, 3.12.4, 3.13.0). Use the major.minor format (e.g., 3.11) when specifying versions.
Vim Build Issues: The Docker environment builds Vim from source with Python support for each version. Ensure sufficient disk space and memory for the build process.
Test Failures: If tests fail in Docker but pass locally, check that all git submodules are properly initialized and the correct Python version is active.
For detailed troubleshooting, see README-Docker.md.
If you are trying to update the plugin (using a plugin manager or manually) and you are seeing an error such as:
Server does not allow request for unadvertised object
Then we probably changed some repo reference or some of our dependencies had a git push --force in its git history. So the best way for you to handle it is to run, inside the python-mode directory:
Documentation is available in your vim :help pymode.
If you have any suggestions, bug reports or annoyances please report them to the issue tracker at: https://github.com/python-mode/python-mode/issues
The contributing guidelines for this plugin are outlined at :help pymode-development.
Before contributing, please:
Test with Docker: Use the Docker testing environment to ensure your changes work across all supported Python versions (3.10.13, 3.11.9, 3.12.4, 3.13.0)
Run Full Test Suite: Use ./scripts/user/test-all-python-versions.sh to test with all supported Python versions
Check CI: Ensure the GitHub Actions CI passes for your changes
Follow Development Guidelines: See :help pymode-development for detailed development guidelines
Also see the AUTHORS file.
Development of python-mode happens at github: https://github.com/python-mode/python-mode
Please make a pull request to development branch and add yourself to AUTHORS.
Vendored Python modules are located mostly in pymode/libs/.
Copyright © 2013-2015 Kirill Klenov (https://github.com/klen).
Licensed under a GNU lesser general public license.
If you like this plugin, I would very appreciated if you kindly send me a postcard :) My address is here: "Russia, 143500, MO, Istra, pos. Severny 8-3" to "Kirill Klenov". Thanks for support!