【问题标题】:Pyright can't see Poetry dependenciesPyright can\'t see Poetry dependencies
【发布时间】:2022-12-19 08:36:58
【问题描述】:

In a poetry project the local dependencies are installed in the ~/.cache/pypoetry/virtualenvs/ folder. Pyright in nvim is complaining that import package lines can't be resolved. What should I include into pyproject.toml? Or how to show pyright the path to the dependencies? Thanks

My pyrightconfig.json looks like this:

{
    "venvPath": ". /home/ajanb/.cache/pypoetry/virtualenvs/",
    "venv": "tools-configfactory-materialmodel-jnEEQvIP-py3.10"
}

I found that I need to add this to the config file of neovim, can you help me to write it in .lua?

  au FileType python let b:coc_root_patterns = ['.git', '.env', 'venv', '.venv', 'setup.cfg', 'setup.py', 'pyrightconfig.json']

【问题讨论】:

    标签: python python-venv python-poetry pyright


    【解决方案1】:

    I spent days troubleshooting this. In the end, the only thing that worked was including this in my pyproject.toml:

    [tool.pyright]
    venvPath = "/Users/user/Library/Caches/pypoetry/virtualenvs"
    venv = "venv-name"
    
    

    I'm also using this nvim plugin: poet-v

    【讨论】:

      猜你喜欢
      • 2021-12-30
      • 2022-08-14
      • 2022-12-19
      • 2022-12-26
      • 2013-08-14
      • 2014-05-13
      • 2022-11-20
      • 2022-08-10
      • 2022-12-26
      相关资源
      最近更新 更多