microsoft / microsoft/vscode-black-formatter

Feature request: Support for extrapaths field

Open
#553 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request needs community feedback
Dominant language
Python
Stars
196
Forks
49
Avg merge
1d 5h
Merged PRs (30d)
7

Description

We set few additional paths to PYTHONPATH and run the black formatter command. For example, env PYTHONPATH="/pathA:/pathB:/black-binary-path" /usr/bin/python3.11 -m black <file_name>. Those multiple packages are in primary location. In my understanding, black formatter extensions take the dependency and black packages from user defined python interpreter set at the interpreter setting.

The functionality that I think is to have the "extrapaths" field in black formatter where it allows to point the packages that are in different location. Then extension can read the package paths from "extrapaths" and insert it into sys.path. In this way, those location package paths are referenced first, and we'll be able to run the above command without setting PYTHONPATH.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the formatter settings and interpreter configuration, then trace how the extension launches Black and handles PYTHONPATH. Done means an extrapaths setting can supply additional package locations so the formatter command works without manually setting PYTHONPATH; add or update tests for that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.