Giter VIP home page Giter VIP logo

poet-v's People

Contributors

leoluyi avatar paretje avatar petobens avatar purefunctor avatar slacksystem avatar tamago324 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

poet-v's Issues

Error: pipenv executable not found

I use poetry and do not have pipenv installed.

Tried adding this plugin - I use NeoVim 0.7 on macOS - I can be more specific if needed.

I use packer and installed by adding:

  use "petobens/poet-v"

When opening neovim I now get this error message:

Error detected while processing /Users/xxxx/.local/share/nvim/site/pack/packer/start/poet-v/plugin/poetv.vim:                                                                   
line   19:                                                                                                                                                                      
pipenv executable not found.

`PoetvActivate` fails on paths with space

When calling PoetvActivate, paths that include spaces such as C:\Users\User Name\... get truncated to C:\Users\User before they're passed to poetvenv.activate causing the following error involving activator_dir.

Traceback

Error detected while processing function poetv#activate:
line   50:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\User Name\vimfiles\plugged\poet-v\autoload\poetvenv.py", line 24, in activate
    shutil.copy((Path(__file__).resolve().parent / activator_file).as_posix(), activator_dir.as_posix())
  File "D:\Python\Python38\Lib\shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "D:\Python\Python38\Lib\shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/User/Scripts'

gVim on Windows reporting Pattern not found when starting

I have gVim 8.2 running on Windows 10. I have poetry installed and am able to run it from the terminal within Vim and also from Cmder. I then have the plugin cloned into the following folder

  • $env:HOME\vimfiles\pack\vendor\start\peot-v

I can start up gVim and see from running :scriptnames that it's loading. I then put in $MYVIMRC the following snippet to have it automatically load the virtualenv so pylint stops complaining that it can't find diagrams in the load path

" poet-v
try
  g:poetv_auto_activate = 1
endtry

However, when I start gVim, it says that: Pattern not found: poetv_auto_activate = 1.

2020-08-28 19_05_47-Window

The same thing happens when using command-line vim.

Poetry Version

> poetry --version
Poetry version 1.0.10

Status Line symbol

I'm so sorry,

Where does the poetv_statusline_symbol show? The plugin works ($ where python after :PoetvActivate shows exactly what I expect), but no visual trace in the status line. Curiously, the zsh console looks just like the system one, minus (venv).

BTW, I can't see the statusline symbol on your screenshot.

[Windows] The result of poetry cmd could not be parsed correctly.

The following command was executed when main.py was the current buffer.

.venv/
bottle_sample/
  main.py           (* current buffer)
  __init__.py
tests/
README.rst
poetry.lock
pyproject.toml

Executed command:

:echo split(trim(system('poetry env list --full-path')), '\n')
['C:\Users\user1\ghq\github.com\tamago324\snippets\python\bottle_sample\.venv (Activated)']

If not on Windows, will the result be returned as follows?

:echo split(trim(system('poetry env list --full-path')), '\n')
['C:/Users/user1/ghq/github.com/tamago324/snippets/python/bottle_sample/.venv']

If not, you may need to fix the following:

diff --git a/autoload/poetv.vim b/autoload/poetv.vim
index 3039843..a177247 100644
--- a/autoload/poetv.vim
+++ b/autoload/poetv.vim
@@ -52,18 +52,15 @@ function! poetv#activate() abort
             let virtual_env_cmd = s:get_venv_cmd(binary)
             let poetv_out_list = split(trim(system(virtual_env_cmd)), '\n')
             if v:shell_error == 0 && !empty(poetv_out_list)
-                if len(poetv_out_list) == 1
-                    let poetv_out = poetv_out_list[0]
-                endif
                 for i in poetv_out_list
                     " Only poetry allows for multiple envs and signals the active
                     " env with an `Activated` keyword
-                    if match (i, '/\S*\s\+\zs(Activated)\ze') != -1
+                    if match (i, '\S*\s\+\zs(Activated)\ze') != -1
                         let poetv_out =  i
                         break
                     endif
                 endfor
-                let poetv_out = matchstr(poetv_out, '\zs/\S*')
+                let poetv_out = matchstr(poetv_out, '^\S*')
                 call setbufvar(curr_buffer_name, 'poetv_dir', poetv_out)
                 break
             else

poet-v on Windows

Tried installing poet-v on Windows but I'm getting this error
obrazek
I have Python 3.11 installed but I'm using it as just "python"
Alias is not helping either

Any idea?

`PoetvActivate` fails when Poetry has two python versions

Steps to replicate

  1. Add two Python versions to Poetry:
$ poetry env use python3.6
$ poetry env use python3.7

poetry env list output:

dial-gui-2yUC4xZS-py3.6
dial-gui-2yUC4xZS-py3.7 (Activated)
  1. Open vim or nvim.
  2. Run the PoetvActivate command.

ERROR OUTPUT:

Error detected while processing function poetv#activate[39]..provider#python3#Call:                                                                                 
line   18:
Error invoking 'python_execute' on channel 4 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/davafons/.vim/plugged/poet-v/autoload/poetvenv.py", line 21, in activate
    shutil.copy(Path(__file__).resolve().parent / activator_file, activator_dir)
  File "/usr/lib/python3.8/shutil.py", line 409, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.8/shutil.py", line 259, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/davafons/.cache/pypoetry/virtualenvs/dial-gui-2yUC4xZS-py3.6\n/home/davafons/.cache/pypoetry/virtualenvs/dial-
gui-2yUC4xZS-py3.7/bin'

In the output error you can see how the file path is actually the two venv paths joined by a \n

poetv + pyright compability

I'm having some issues using this plugin as well as Coc.nvim's coc-pyright plugin/extension.

More technically, I'm having some issues with :PoetvActivate. AFAIK, :PoetvActivate and poetry shell should do the same behaviour?

$ vim

  • :PoetvActivate
  • :e src/<file>.py
    Result:
    image

As you can see per my statusline, the venv has been loaded. which python resolves to the venv. However, pyright complains that it can't find my modules. In the original thread, :!pip list shows these packages in the vim environment.

$ poetry shell
(backend-dmp__8h8-py3.8) bash-3.2 $ vim

  • :e src/<file>.py

Result:
image

It works! All the packages are resolved! But why?

Do you have any idea what is happening here? Is this something on coc-pyright's end or should I expect something else to happen?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.