3

I have a development directory in which a python package is kept as a sub-directory. The package itself does not ship a setup.cfg, however, I like to have some development related settings which I do not want to push to the package, therefore I keep a setup.cfg file in the development directory.

E.g.

|- devdir/  # remote container -> /workspaces/devdir
   |- .devcontainer/
   |- setup.cfg
   |- package/
      |- package/
         |- __init__.py
         |- ...

My goal is to use the remote development within a docker container available for VS-Code.

Problem

VS-Code however, does not see the setup.cfg file and keeps showing errors for linters etc which would generally be handled by settings within setup.cfg.

Question

Is there a way to tell VS-Code where to look for the setup.cfg and provide that information to the python and remote plugins?

Gama11
  • 31,714
  • 9
  • 78
  • 100
E.Eisbrenner
  • 143
  • 1
  • 10

1 Answers1

3

Add the entry python.linting.pylintArgs: ["--rcfile=setup.cfg"] to your .vscode/settings.json file in your project folder.

Nandeesh
  • 2,683
  • 2
  • 30
  • 42
  • Just make sure that you've enabled the configuration for the right plugin. Multiple plugins may use the same setup.cfg, but will need to be configured separately. For me, this was: ```"python.linting.flake8Args": ["--rcfile=setup.cfg"]``` in my .vscode > settings.json file. – ADataGMan Aug 26 '22 at 10:25
  • Related to @ADataGMan's comment, if you're using the flake8 vs code extension, you need to use `"flake8.args": [ "--config", "" ]` – Dan Nov 09 '22 at 07:50