Vim python-mode. PyLint, Rope, Pydoc, breakpoints from box.

Overview

Testing python-mode

Python-mode, a Python IDE for Vim


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.

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


Python-mode is a Vim plugin that magically converts Vim into a Python IDE.

Why Python-mode?

  1. Be more productive: Pymode saves time by bringing all the tools necessary for professional developers so that you can focus on bigger things. It has been finely tuned based on decades of experience working with Vim and is constantly kept up to date.
  2. Get smart assistance: Pymode knows all about your code. We use the best-in-class intellisense code completion, on-the-fly error checking and quick-fixes; easy project navigation and much more.
  3. Use the full power and capabilities of Vim: Unlike traditional IDEs which can only provide a small subset of Vim functionalities, you can do everything and anything that you can in Vim.
  4. Modular structure: We attempt to create Python-mode with the same principles of python: i.e. have a modular structure, so that as and when better libraries evolve, we can provide you the best experience, while abstracting the details so that you can get back to what you do best.
  5. Written mostly in Python: 96.1% written in Python. Well, we love Python :)

The plugin contains all you need to develop python applications in Vim.

  • Support Python and 3.6+
  • Syntax highlighting
  • Virtualenv support
  • Run python code (<leader>r)
  • Add/remove breakpoints (<leader>b)
  • Improved Python indentation
  • Python motions and operators (]], 3[[, ]]M, vaC, viM, daC, ciM, ...)
  • Improved Python folding
  • Run multiple code checkers simultaneously (:PymodeLint)
  • Autofix PEP8 errors (:PymodeLintAuto)
  • Search in python documentation (<leader>K)
  • Code refactoring
  • Intellisense code-completion
  • Go to definition (<C-c>g)
  • And more, more ...

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.

Requirements

Vim >= 7.3 (most features needed +python3 support) (also --with-features=big if you want g:pymode_lint_signs).

How to install

Manually (according to vim's package structure)

As of vim8 there is an officially supported way of adding plugins. See :tab help packages in vim for details.

cd ~/.vim/pack/python-mode/start
git clone --recurse-submodules https://github.com/python-mode/python-mode.git
cd python-mode

Note. Windows OS users need to add -c core.symlinks=true. See below.

pathogen

cd ~/.vim
mkdir -p bundle && cd bundle
git clone --recurse-submodules https://github.com/python-mode/python-mode.git

Enable pathogen in your ~/.vimrc:

" Pathogen load
filetype off

call pathogen#infect()
call pathogen#helptags()

filetype plugin indent on
syntax on

vim-plug

Include the following in the vim-plug section of your ~/.vimrc:

Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }

NeoBundle

Add the following:

" python-mode: PyLint, Rope, Pydoc, breakpoints from box.
" https://github.com/python-mode/python-mode
NeoBundleLazy 'python-mode/python-mode', { 'on_ft': 'python' }

Manually

% git clone --recurse-submodules https://github.com/python-mode/python-mode.git
% cd python-mode
% cp -R * ~/.vim

Then rebuild helptags in vim:

:helptags ~/.vim/doc/

filetype-plugin (:help filetype-plugin-on) and filetype-indent (:help filetype-indent-on) must be enabled to use python-mode.

Troubleshooting/Debugging

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:

  • your Operational System (Linux, WIndows, Mac) and which version
  • the vim --version output
  • which is your default python (python --version)
  • the python version that vim has loaded in your tests:
    • :PymodePython import sys; print(sys.version_info) output.
  • and if you are using virtualenvs and/or conda, also state that, please.
  • It would be good also to provide the output of the two following commands:
  • git status (under your python-mode directory)
  • tree <python-mode-directory> or something similar (such as ls -lR)

Frequent problems

Read this section before opening an issue on the tracker.

Python 2/3 vim support

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 3 syntax

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).

Symlinks on Windows

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

Error updating the plugin

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:

  • git submodule update --recursive --init --force
  • git submodule sync --recursive

Documentation

Documentation is available in your vim :help pymode.

Bugtracker

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

Contributing

The contributing guidelines for this plugin are outlined at :help pymode-development.

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.

Python libraries

Vendored Python modules are located mostly in pymode/libs/.

Copyright

Copyright © 2013-2015 Kirill Klenov (https://github.com/klen).

License

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!

Comments
  • freezes when autocompletion enabled

    freezes when autocompletion enabled

    Tracking down an issue between 0.6.19 and 0.7.0b and subsequent versions, where MacVim freezes when the autocompletion is initiated.

    Debugging suggestions appreciated - I tried following the directions in the README but nothing jumped out at me when I tried the -u flag to the debug.vim file.

    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    waiting 
    opened by sc68cal 78
  • vim hangs on write with [Pymode] Regenerate autoimport cache when I edit .py files in ~

    vim hangs on write with [Pymode] Regenerate autoimport cache when I edit .py files in ~

    So, I have a lot of stuff in my home directory (as I think many do) but I also occasionally write small Python scripts in ~ (as many, I think, do).

    Is there any way to stop rope from regenerating the autoimport cache for a specific target directory?

    opened by dwf 63
  • vim segfaults on write

    vim segfaults on write

    Edit: Also happens on simple :w

    Two colleagues of mine have told me that thei vim segfaults regularly. But only on save/quit (:wq). I tried to find out why, but could not find the culprit. We all have pretty much the same plugins installed. In any case, we have rules out plugins for a while. After all I have all those installed as well, and have no seg-faults.

    Recently I upgraded python-mode. Since then I get the same problem.

    I cannot tell you much more other than it seems to happen only on write+quit.

    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    inactive 
    opened by exhuma 41
  • Importlib, imp, find_module, find_spec issue

    Importlib, imp, find_module, find_spec issue

    Hi All!

    I'm creating this issue in order to concentrate all issues that we are facing in python-mode that are caused by the import machinery.

    This includes imp module deprecation (replaced by importlib), "wrong" usage of find_spec and find_module, different compatibilities among python versions and so on.

    Currently, I'm with very restricted free time to dedicate to the project, so any help is very welcome!

    We have plenty of python modules that are used in python-mode that are not from standard python. Because of that, in the past, these modules source code were copied into python-mode repo. As time passed, they became old, and we started to update them as "git submodules". This resulted in lot's of improvements, but also resulted in new problems, that we still need to fix.

    Our current official branch is the develop from this repository, the master branch is unmaintained.

    Before going on with the attempt of solving our current problems, I would like to kindly ask everyone that want to help me, by testing new versions of the code, to do some simple steps in order to make sure your environment is "renewed":

    • Clear all python cache (__pycache__) directories and compiled files (*.pyc and *.pyo). Do it by running, in Linux-like systems and from python-mode root dir:
      • find . -type f -name '*.pyc' -delete
      • find . -type d -name '__pycache__' -delete
    • Update all submodules with the latest version from the branch you want to test:
      • git submodule sync --recursive
      • git submodule update --init --recursive

    Back to our current issue, it looks like we have several combinations that work and another bunch that does not work correctly, depending on python version and also vim version, so I'll ask you all some patience! Some times I cannot reproduce the errors that you are presenting, so your help will be fundamental for us to find the best fix.

    One of the modules that were not updated is the pkg_resources, it is still a copy from some point in the past, and it may be one of the most impacted for this specific issue.

    So, I'll try to update it to see if a newer version of pkg_resources fix most of the problems. Then we can go ahead and try to work on other "modules/packages/files".

    I'll try to keep the test code for this issue under the branch issue_971_import_machinery from this repo ok?

    Thank you all for your patience!

    need contributors bug 
    opened by diraol 37
  • python-mode with python 3.7 `imp`/`importlib` incompatibility

    python-mode with python 3.7 `imp`/`importlib` incompatibility

    When I use vim to open test.py , the Python-mode doesn't work. I have no idea about how to solve the problem(>_<) Here are my python mode debug file:

    Error detected while processing function pymode#init: line 2: /must>not&exist/foo:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

    pymode debug msg 1: Starting debug on: 2018-07-03 18:57:46 with file /var/folders/zg/q4yfxyj93nxbrd7f0sygsdmh0000gn/T/pymode_debug_file.txt

    pymode debug msg 2: Operating system: Darwin

    pymode debug msg 3: Scriptnames:

    pymode debug msg 4: Pymode variables: pymode #1 pymode_breakpoint #1 pymode_breakpoint_bind b pymode_breakpoint_cmd import pdb; pdb.set_trace() # XXX BREAKPOINT pymode_debug #1 pymode_debug_counter #3 pymode_debug_tempfile /var/folders/zg/q4yfxyj93nxbrd7f0sygsdmh0000gn/T/pymode_debug_file.txt pymode_doc #1 pymode_doc_bind K pymode_doc_vertical #0 pymode_folding #0 pymode_folding_nest_limit #1000 pymode_folding_regex ^\s*%(class|def|async\s+def) .+(:\s+\w)@! pymode_indent #1 pymode_init #1 pymode_lint #1 pymode_lint_async #1 pymode_lint_async_updatetime #1000 pymode_lint_checkers ['pyflakes', 'pep8', 'mccabe'] pymode_lint_comment_symbol CC pymode_lint_cwindow #1 pymode_lint_docs_symbol DD pymode_lint_error_symbol EE pymode_lint_ignore [] pymode_lint_info_symbol II

    opened by byebaibai 36
  • Editing long folds makes VIM really slow

    Editing long folds makes VIM really slow

    While editing inside a long fold (in my case an init function composed of ~150 LOC) VIM freezes and becomes really sloppy. Command mode works fine as usual instead. After profiling it I managed to discover that setting g:pymode_folding = 0 solves my problem. Any way I can solve this while keeping the folding functionality?

    This is the output of PymodeTroubleshooting:

    Pymode diagnostic
    ===================
    VIM:704, OS: Darwin, multi_byte:1, pymode: 0.8.1, pymode-python: python
    
    
    +python: 1
    +python3: 0
    
    VIM python paths:
    -----------------
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/waitress
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/requests
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/frozendict
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/argparse
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/ycmd
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/retries
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/requests-futures
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/requests
    /Users/aldur/.vim/bundle/YouCompleteMe/third_party/pythonfutures
    /Users/aldur/.vim/bundle/YouCompleteMe/autoload/../third_party/ycmd
    /Users/aldur/.vim/bundle/YouCompleteMe/autoload/../python
    /Users/aldur/.vim/bundle/python-mode/pymode/libs2
    /Users/aldur/.vim/bundle/python-mode/pymode/libs
    /Users/aldur/.vim/bundle/python-mode
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-8.0-py2.7.egg
    /Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg
    /usr/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
    /usr/local/lib/python2.7/site-packages/setuptools-8.0-py2.7.egg
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
    /Library/Python/2.7/site-packages
    /usr/local/lib/python2.7/site-packages
    _vim_path_
    
    Pymode variables:
    -------------------
    let pymode = 1
    let pymode_breakpoint = 0
    let pymode_breakpoint_bind = '<leader>b'
    let pymode_doc = 1
    let pymode_doc_bind = 'K'
    let pymode_folding = 0
    let pymode_indent = 1
    let pymode_lint = 1
    let pymode_lint_checkers = ['pyflakes', 'pep8', 'mccabe']
    let pymode_lint_cwindow = 1
    let pymode_lint_ignore = ''
    let pymode_lint_message = 0
    let pymode_lint_on_fly = 0
    let pymode_lint_on_write = 0
    let pymode_lint_select = ''
    let pymode_lint_signs = 1
    let pymode_motion = 1
    let pymode_options = 1
    let pymode_paths = []
    let pymode_quickfix_maxheight = 6
    let pymode_quickfix_minheight = 3
    let pymode_rope = 1
    let pymode_run = 1
    let pymode_run_bind = '<leader>r'
    let pymode_trim_whitespaces = 1
    let pymode_virtualenv = 1
    let pymode_virtualenv_enabled = ''
    let pymode_virtualenv_path = ''
    

    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    opened by aldur 32
  • error when processing lint.vim

    error when processing lint.vim

    The issue in #600 still happens to me even if I am using the develop branch with python version 2.7.13:

    Stacktrace: Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: Traceback (most recent call last): Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: File "", line 1, in Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: File "/Users/lyuan/.vim/bundle/python-mode/pymode/lint.py", line 9, in Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: from pylama.lint.extensions import LINTERS Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: File "/Users/lyuan/.vim/bundle/python-mode/pymode/libs/pylama/lint/extensions.py", line 30, in Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: from pkg_resources import iter_entry_points Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: File "/Users/lyuan/.vim/bundle/python-mode/pymode/libs/pkg_resources/init.py", line 21, in Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: import io Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py ", line 51, in Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: import _io Error detected while processing /Users/lyuan/.vim/bundle/python-mode/autoload/pymode/lint.vim: line 1: ImportError: dlopen(/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/pyt hon2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder

    opened by apeforest 26
  • All pymode default mappings involving <C-c> fail in Vim 8

    All pymode default mappings involving fail in Vim 8

    Pythom-mode default mappings such as goto definition (<C-c>g) don't work in Vim 8. Every time you press <C-c>, Vim 8 will teach you the way to quit Vim: Type :qa! and press <Enter> to abandon all changes and exit Vim.

    But I can still somehow map <C-c> in Vim 8 using :map command. If I execute :map <C-c> :qa! <Enter> I'm able to map <C-c> to force quit Vim.

    Vim 7 seems to pop up that teaching only if I press <C-c> for successive two times so I can use python-mode default binding. This isn't the case in Vim 8.

    inactive 
    opened by ReeseWang 23
  • tb when using Python3 venv

    tb when using Python3 venv

    Using python-mode within a python 3 virtualenv has an issue:

    % vim Error detected while processing /Users/speno/.vimrc: line 224: Traceback (most recent call last): File "", line 8, in IOError: [Errno 2] No such file or directory: '/Users/speno/Documents/venvs/ pika/bin/activate_this.py'

    It's true. The virtualenvs created using python3's pyvenv command do not have a bin/activate_this.py file.

    Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

    inactive 
    opened by JohnSpeno 22
  • Dependency symlink failing in windows

    Dependency symlink failing in windows

    I am using windows 10 and Plug 'python-mode/python-mode', { 'branch': 'develop' }. I get the following error every time I open a python file.

    2019-01-01_13-23-25

    The folder looks like this:

    2019-01-01_13-27-22

    opened by blayz3r 21
  •  No module named 'six'

    No module named 'six'

    Hi

    I installed it on Win 10 X64 with python 3.7 support. It seems to work but with initial invokie I get this error below.

    I also have "six" installed not sure

    pip install six Requirement already satisfied: six in c:\app\python37\lib\site-packages (1.11.0)

    Error detected while processing function pymode#breakpoint#init: line 29: Traceback (most recent call last): File "", line 2, in ModuleNotFoundError: No module named 'six'

    opened by gerroon 21
  • how to remap K to antother key

    how to remap K to antother key

    I have mapped K to another action in my vimrc file and python-mode overrides my mapping and I don't want this, how to map K to another key for example L? let g:pymode_doc_bind = 'K' thanks.

    opened by FadeDreams 0
  • Experience trying pymode on Windows / GVim

    Experience trying pymode on Windows / GVim

    Here's a report from me trying to use pymode with GVim on Windows so far, and few problems I had to solve. I'm rather unexperienced with doing anything more advanced in Vim, so this is from a noobish perspective.

    First problem was during manual install - you have to give user rights to create symlinks. I've already made a separate PR to document how to solve that: https://github.com/python-mode/python-mode/compare/develop...vid512:python-mode:patch-1

    After that, I had to manually rebuild help tags with :helptags <path-to-pymode>/doc. In the README, this is only mentioned in section for old-style manual install, but not in the section "Manually (according to vim's package structure)". If doing this manually is intended, maybe it should be added there too?

    Then it took some time to figure out that my GVim couldn't find python310.dll in its path, so it had python3 functionality disabled. Until then any :Pymode*** command or advanced functionality I've tried didn't work. It wasn't enough to just run vim -i NONE -u <path_to_pymode>/debugvimrc.vim, as the README says. I had to actually open some .py file. This is not immediately obvious to someone who doesn't understand what goes on under the hood. I'd suggest changing the troubleshooting command to vim -i NONE -u <path_to_pymode>/debugvimrc.vim file.py.

    It would also be helpful to have something in Windows section of FAQ prompting me to try :py3 print('hello'). This makes sure python3 functionality is working in GVim, otherwise GVim will display a helpful error message with name of python DLL it is missing.

    opened by vid512 0
  • Error when opening .py files

    Error when opening .py files

    Dear all, thanks a lot for maintaining this very useful plugin.

    I recently started to experience problems (not sure if these depend on the fact that I recently moved to MacVim 9 on Mac OS 12.5.1. More specifically, my MacVim version is 9.0.65).

    When I open a python file I get this error: Error detected while processing CursorMoved Autocommands for "<buffer=1>"..script /Users/mpagani/.vim/plugged/python-mode/autoload/pymode/lint.vim Following the instructions in the Troubleshooting section, I created a debug file that you find below. Thanks for any suggestion you might be able to share for solving this problem.

    Messages maintainer: Bram Moolenaar <[email protected]>
    "~/Documents/2022/diary/09/08_cms/utils.py" 11L, 264B
    1662798522 let g:pymode_virtualenv_enabled = "/Users/mpagani/Repos/venv" []
    -------------------------------------------------------------------------------
    pymode debug msg 1: Starting debug on: 2022-09-10 10:28:42 with file /var/folders/j5/vpmn9x657d3gzwvrx2vryvc80000gn
    /T/pymode_debug_file.txt
    -------------------------------------------------------------------------------
    pymode debug msg 2: Operating system: Darwin
    -------------------------------------------------------------------------------
    pymode debug msg 3: Scriptnames:
    -------------------------------------------------------------------------------
    pymode debug msg 4: Pymode variables:
    pymode                #1
    pymode_breakpoint     #1
    pymode_breakpoint_bind  <leader>b
    pymode_breakpoint_cmd  breakpoint()
    pymode_debug          #1
    pymode_debug_counter  #3
    pymode_debug_tempfile  /var/folders/j5/vpmn9x657d3gzwvrx2vryvc80000gn/T/pymode_debug_file.txt
    pymode_doc            #1
    pymode_doc_bind        K
    pymode_doc_vertical   #0
    pymode_folding        #0
    pymode_folding_nest_limit #1000
    pymode_folding_regex   ^\s*\%(class\|def\|async\s\+def\) .\+\(:\s\+\w\)\@!
    pymode_indent         #1
    pymode_indent_hanging_width #-1
    pymode_init           #1
    pymode_lint           #1
    pymode_lint_async     #1
    pymode_lint_async_updatetime #1000
    pymode_lint_checkers  ['pyflakes', 'pep8', 'mccabe']
    pymode_lint_comment_symbol  CC
    pymode_lint_cwindow   #1
    pymode_lint_docs_symbol  DD
    pymode_lint_error_symbol  EE
    pymode_lint_ignore    []
    pymode_lint_info_symbol  II
    pymode_lint_message   #1
    pymode_lint_on_fly    #0
    pymode_lint_on_write  #1
    pymode_lint_options_mccabe {'complexity': 12}
    pymode_lint_options_pep257 {}
    pymode_lint_options_pep8 {'max_line_length': 79}
    pymode_lint_options_pyflakes {'builtins': '_'}
    pymode_lint_options_pylint {'max-line-length': 79}
    pymode_lint_pyflakes_symbol  FF
    pymode_lint_select    []
    pymode_lint_signs     #1
    pymode_lint_sort      []
    pymode_lint_todo_symbol  WW
    pymode_lint_unmodified #0
    pymode_lint_visual_symbol  RR
    pymode_motion         #1
    pymode_options        #1
    pymode_options_colorcolumn #1
    pymode_options_max_line_length #79
    pymode_paths          []
    pymode_preview_height #12
    pymode_preview_position  botright
    Error detected while processing BufRead Autocommands for "*.py"..FileType Autocommands for "*"..function <SNR>19_Lo
    adFTPlugin[18]..script /Users/mpagani/.vim/plugged/python-mode/ftplugin/python/pymode.vim:
    line  249:
    Interrupted
    
    opened by mmpagani 0
  • Adding directory to PymodeRope

    Adding directory to PymodeRope

    Using the python project scheme suggested by the pytest documentation, pymode does not include the tests/ directory into its ropeproject when the “include method” of the src/ directory is done via an editable install (pip install -e .).

    How do I add an additional source directory to PymodeRope, namely the tests/ directory?

    Minimal working example

    First create a venv virtual environment as well as a temporary directory. The abbreviation pmt stands for “pymode test”.

    $ mkdir -p /tmp/pmt/{.venv,src/pmt,tests}
    $ cd /tmp/pmt
    $ python -m venv /tmp/pmt/.venv/pmt
    $ source /tmp/pmt/.venv/pmt/bin/activate
    (pmt) $ python -m pip install -U pip
    (pmt) $ python -m pip install build pytest
    (pmt) $ touch pyproject.toml src/pmt/__init__.py
    

    Create the three source files with an editor of your choice, namely

    • # ––– file /tmp/pmt/src/pmt/spam.py
      def spamfunc() -> int:
          return 1
      
    • # ––– file /tmp/pmt/src/pmt/bacon.py
      from .spam import spamfunc
      
      
      def baconfunc() -> None:
          return 1 + spamfunc()
      
    • # ––– file /tmp/pmt/tests/test_pmt.py
      from pmt.bacon import baconfunc
      from pmt.spam import spamfunc
      
      
      def test_baconfunc() -> None:
          assert 2 == baconfunc()
      
      
      def test_spamfunc() -> None:
          assert 1 == spamfunc()
      

    The project directory will look like this:

    .
    ├── pyproject.toml
    ├── src
    │   └── pmt
    │       ├── bacon.py
    │       ├── __init__.py
    │       └── spam.py
    └── tests
        └── test_pmt.py
    

    As suggested by pytest, install the editable version of the package and invoke pytest:

    (pmt) $ python -m pip install -e .
    (pmt) $ python -m pytest
    ================================ test session starts =================================
    platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
    rootdir: /tmp/pmt
    collected 2 items                                                                    
    
    tests/test_pmt.py ..                                                           [100%]
    
    ================================= 2 passed in 0.01s ==================================
    

    To finally reproduce the behaviour:

    • open the source file with vim /tmp/pmt/src/pmt/spam.py
    • move the cursor to spamfunc
    • start function renaming by hitting <C-c>rr
    • insert a different name, for instance hamfunc and press <Enter>
    • perform the renaming by inserting 1<Enter>

    After that, the renaming was successfully done in /tmp/pmt/src/pmt/spam.py and /tmp/pmt/src/pmt/bacon.py but not in tmp/pmt/tests/test_pmt.py (as I expect).

    What I have tried

    I tried to add manually the tests directory to the .ropeproject/config.py file

    def set_prefs(prefs):
        # … more code of the default config.py file …
    
        # Custom source folders:  By default rope searches the project
        # for finding source folders (folders that should be searched
        # for finding modules).  You can add paths to that list.  Note
        # that rope guesses project source folders correctly most of the
        # time; use this if you have any problems.
        # The folders should be relative to project root and use '/' for
        # separating folders regardless of the platform rope is running on.
        # 'src/my_source_folder' for instance.
        prefs.add('source_folders', 'tests')
    
        # … more code of the default config.py file …
    

    with no success.

    When I change the import policy by

    • uninstalling the module again with (pmt) $ python -m pip uninstall pmt
    • change the imports of tmp/pmt/tests/test_pmt.py to
      from src.pmt.bacon import baconfunc
      from src.pmt.spam import spamfunc
      

    then the renaming as suggested above does work, but that project structure is not as I or the pytest guys, respectively, want it to be.

    Used versions

    (pmt) $ python --version
    Python 3.10.6
    (pmt) $ python -m pip freeze | grep 'build\|pytest'
    build==0.8.0
    pytest==7.1.3
    

    Pymode version: commit 85d2cd1a196ac1def79d4599b5be69395ed5b603 (HEAD → develop)

    opened by claudio-ebel 0
  • Cannot override linter options per project

    Cannot override linter options per project

    The following code prevents us from overriding the linter options per project.

    https://github.com/python-mode/python-mode/blob/85d2cd1a196ac1def79d4599b5be69395ed5b603/pymode/lint.py#L52-L57

    Here is what the pymode logs show (I have added some log line 53 to see what is set globally):

    pymode debug msg 9: check code
    1661433148 ['pyflakes', 'pep8'] []
    1661433148 Namespace(paths=['/tmp/bla'], verbose=False, format='pycodestyle', select=[], sort=[], linters=[('pyflakes', <pylama.lint.pylama_pyflakes.Linter object at 0x7f177ab71870>), ('pep8', <pylama.lint.pylama_pycodestyle.Linter object
    at 0x7f177ab71990>)], ignore=['W'], skip=[], report=None, hook=False, concurrent=False, options='/tmp/bla/pylama.ini', force=True, abspath=False, file_params={}, linters_params={'pep8': {'max_line_length': 101}}) []
    1661433148 g:pymode_lint_options_pyflakes -> {'builtins': '_'} []
    1661433148 g:pymode_lint_options_pep8 -> {'max_line_length': '79'} []
    1661433148 Start code check:  [wrong.py]
    Checking params: {'skip': False, 'ignore': {'W'}, 'select': set(), 'linters': []} - Namespace(paths=['/tmp/bla'], verbose=False, format='pycodestyle', select=[], sort=[], linters=[('pyflakes', <pylama.lint.pylama_pyflakes.Linter object at
    0x7f177ab71870>), ('pep8', <pylama.lint.pylama_pycodestyle.Linter object at 0x7f177ab71990>)], ignore=['W'], skip=[], report=None, hook=False, concurrent=False, options='/tmp/bla/pylama.ini', force=True, abspath=False, file_params={}, lint
    ers_params={'pep8': {'max_line_length': '79'}, 'pyflakes': {'builtins': '_'}})
    Run pyflakes {'builtins': '_'}
    Run pep8 {'max_line_length': '79'}
    

    As you can see, pylama finds its custom settings inside the pylama.ini file, but they are then overridden.

    I would have expected the pylama.ini settings to override the global ones but it's definitely not the case.

    I'd suggest the code above to be replaced with:

            for linter in linters:
                opts = env.var('g:pymode_lint_options_%s' % linter, silence=True)
                if opts:
                    opts_override = options.linters_params.get(linter, {})
                    options.linters_params[linter] = opts
                    options.linters_params[linter].update(opts_override)
    

    I can open a PR if needed

    opened by ziirish 0
Releases(0.7.0b)
  • 0.7.0b(Dec 1, 2013)

    * Update indentation support;
    * Python3 support;
    * Removed pymode modeline support;
    * Disabled async code checking support;
    * Options changes:
        'pymode_doc_key' -> 'pymode_doc_bind'
        'pymode_run_key' -> 'pymode_run_bind'
        'pymode_breakpoint_key' -> 'pymode_breakpoint_bind'
        'pymode_breakpoint_template' -> 'pymode_breakpoint_cmd'
        'pymode_lint_write' -> 'pymode_lint_on_write'
        'pymode_lint_onfly' -> 'pymode_lint_on_fly'
        'pymode_lint_checker' -> 'pymode_lint_checkers'
        'pymode_lint_minheight' -> 'pymode_quickfix_minheight'
        'pymode_lint_maxheight' -> 'pymode_quickfix_maxheight'
        'pymode_rope_autocomplete_map' -> 'pymode_rope_completion_bind'
        'pymode_rope_enable_autoimport' -> 'pymode_rope_autoimport'
    
    * Options removed:
        'pymode_lint_hold', 'pymode_lint_config', 'pymode_lint_jump',
        'pymode_lint_signs_always_visible', 'pymode_rope_extended_complete',
        'pymode_rope_auto_project', 'pymode_rope_autoimport_generate',
        'pymode_rope_autoimport_underlines', 'pymode_rope_codeassist_maxfixes',
        'pymode_rope_sorted_completions', 'pymode_rope_extended_complete',
        'pymode_rope_confirm_saving', 'pymode_rope_global_prefix',
        'pymode_rope_local_prefix', 'pymode_rope_vim_completion', 'pymode_rope_guess_project',
        'pymode_rope_goto_def_newwin', 'pymode_rope_always_show_complete_menu'
    
    * Options added:
        'pymode_rope_regenerate_on_write', 'pymode_rope_completion', 'pymode_rope_complete_on_dot',
        'pymode_lint_sort'
    
    * Commands added:
        'PymodeVirtualenv'
    
    * Commands changed:
        'PyDoc' -> 'PymodeDoc'
        'Pyrun' -> 'PymodeRun'
        'PyLintToggle' -> 'PymodeLintToggle'
        'PyLint' -> 'PymodeLint'
        'PyLintAuto' -> 'PymodeLintAuto'
        'RopeOpenProject' -> 'PymodeRopeNewProject'
        'RopeUndo' -> 'PymodeRopeUndo'
        'RopeRedo' -> 'PymodeRopeRedo'
        'RopeRenameCurrentModule' -> 'PymodeRopeRenameModule'
        'RopeModuleToPackage' -> 'PymodeRopeModuleToPackage'
        'RopeGenerateAutoimportCache' -> 'PymodeRopeRegenerate'
        'RopeOrgamizeImports' -> 'PymodeRopeAutoImport'
    
    * Commands removed:
        'PyLintCheckerToggle', 'RopeCloseProject', 'RopeProjectConfig',
        'RopeRename', 'RopeCreate<...>', 'RopeWriteProject', 'RopeRename',
        'RopeExtractVariable', 'RopeExtractMethod', 'RopeInline', 'RopeMove',
        'RopeRestructure', 'RopeUseFunction', 'RopeIntroduceFactory',
        'RopeChangeSignature', 'RopeMoveCurrentModule',
        'RopeGenerate<...>', 'RopeAnalizeModule', 'RopeAutoImport',
    
    Source code(tar.gz)
    Source code(zip)
Owner
The Python-Mode
The Python-Mode
Encriptificator is a text editor app developed by me as a personal project.

Encriptificator is a text editor app developed by me as a personal project. It provides all basic features of a text editor with the additional feature of encrypting your files. To know more about ho

1 May 09, 2022
Python Tools for Visual Studio

Python tools for Visual Studio Python support for Visual Studio is developed and managed here. Visit our product overview and downloads page, read our

Microsoft 2.4k Dec 30, 2022
Python IDE for beginners

Thonny Thonny is a Python IDE meant for learning programming. End users See https://thonny.org and wiki for more info. Contributors Contributions are

Thonny, Python IDE for beginners 2.1k Jan 02, 2023
Vim python-mode. PyLint, Rope, Pydoc, breakpoints from box.

Python-mode, a Python IDE for Vim This project needs contributors. Documentation: :help pymode https://github.com/python-mode/python-mode/wiki Importa

The Python-Mode 5.4k Jan 01, 2023
openBrowsser is a Sublime Text plug-in, which allows you to add a keyboard shortcut, to directly access a website from a selection.

openBrowsser is a Sublime Text plug-in, which allows you to add a keyboard shortcut, to directly access a website from a selection. Instal

Florian COLLIN 1 Dec 14, 2021
A free Python source code editor and Notepad replacement for Windows

Website Download Features Toolbar Wide array of view options Syntax highlighting support for Python Usable accelerator keys for each function (Ctrl+N,

Mohamed Ahmed 7 Feb 16, 2022
awesome Python autocompletion with SublimeText

SublimeJEDI SublimeJEDI is a Sublime Text 3 and Sublime Text 2 and plugin to the awesome autocomplete library Jedi Python Version Support Sublime Jedi

Serhii Ruskykh 933 Dec 08, 2022
A WYSIWYG layout editor for Jupyter widgets

Based on the React library FlexLayout, ipyflex allows you to compose the sophisticated dashboard layouts from existing Jupyter widgets without coding. It supports multiple tabs, resizable cards, drag

Duc Trung LE 93 Nov 24, 2022
ReText: Simple but powerful editor for Markdown and reStructuredText

Welcome to ReText! ReText is a simple but powerful editor for Markdown and reStructuredText markup languages. One can also add support for custom mark

ReText 1.6k Dec 23, 2022
Jupyter Interactive Notebook

Jupyter Notebook The Jupyter notebook is a web-based notebook environment for interactive computing. Notice Please note that this repository is curren

Project Jupyter 9.7k Jan 02, 2023
Leo is an Outliner, Editor, IDE and PIM written in 100% Python.

Leo 6.3, http://leoeditor.com, is now available on GitHub. Leo is an IDE, outliner and PIM. The highlights of Leo 6.3 leoAst.py: The unification of Py

Leo Editor 1.4k Dec 27, 2022
An experimental code editor for writing algorithms

Algojammer Algojammer is an experimental, proof-of-concept code editor for writing algorithms in Python. It was mainly written to assist with solving

Chris Knott 2.9k Dec 27, 2022
A simple Notepad-like editor written in Python

monkepad A simple Notepad-like editor written in Python Since MonkePad is written in one file, all your customization can be done without much trouble

5 Dec 28, 2021
Vim plugin for executing Python's optional static type checker MyPy

Vim plugin for executing Python's optional static type checker MyPy

Mark McDonnell 91 Dec 04, 2022
{Ninja-IDE Is Not Just Another IDE}

Ninja-IDE Is Not Just Another IDE Ninja-IDE is a cross-platform integrated development environment (IDE) that allows developers to create applications

ninja-ide 919 Dec 14, 2022
Using the jedi autocompletion library for VIM.

jedi-vim - awesome Python autocompletion with VIM jedi-vim is a VIM binding to the autocompletion library Jedi. Here are some pictures: Completion for

Dave Halter 5.1k Dec 31, 2022
Python-Text-editor: a simple text editor on Python and Tkinter

Python-Text-editor This is a simple text editor on Python and Tkinter. The proje

Innokentie 1 Jan 03, 2022
A powerful text editor for MATE

Pluma - The MATE text editor General Information Pluma (pluma) is a small and lightweight UTF-8 text editor for the MATE environment. It started as a

MATE Desktop 134 Dec 31, 2022
A small, simple editor for beginner Python programmers. Written in Python and Qt5.

Mu - A Simple Python Code Editor Mu is a simple code editor for beginner programmers based on extensive feedback from teachers and learners. Having sa

Mu 1.2k Jan 03, 2023