Skip to content

Installing black with poetry fails #5756

@kbakk

Description

@kbakk

Environment data

  • VS Code version: 1.34.0
  • Extension version (available under the Extensions sidebar): 2019.4.12954
  • OS and version: macOS 10.14.5
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv via Poetry
  • Relevant/affected Python packages and their versions: black

Expected behaviour

Use --allow-prereleases option from poetry when installing black (until black comes with a released version).

Actual behaviour

source /Users/kristofferb/Library/Caches/pypoetry/virtualenvs/my-project-py3.7/bin/activate
poetry add black

~/Code/my-project
% source /Users/kristofferb/Library/Caches/pypoetry/virtualenvs/my-project-py3.7/bin/activate

~/Code/my-project
my-project-py3.7 % poetry add black
                                                      
[ValueError]                           
Could not find a matching version of package black  
                                                      
add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

Steps to reproduce:

  1. Install poetry
  2. poetry new my-project && code my-project
  3. poetry install to have it set up venv
  4. update .vscode/settings.json python.pythonPath to the venv created by poetry
  5. update .vscode/settings.json python.poetryPath to the path to the poetry executable (which poetry)
  6. open my_project/init.py, run Format Document
  7. On prompt "Formatter autopep8 is not installed. Install?" select "Use Black"
  8. Notice that the extension runs a command in the terminal (as described under Actual behavior).

Logs

Not relevant, can be provided upon request though

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions