[Python] Have different Black settings for submodules in main repo

Discussão em 'Python' iniciado por Stack, Março 26, 2025.

  1. Stack

    Stack Membro Participativo

    I'm cloning a repo which contains 2 submodules cloned in the subs/ folder, so the structure is like:

    main_repo/
    -- subs/
    ---- sub_01
    ---- sub_02


    I would want each of them to have different settings, for example line length for the Black formatter and flake8, so I created 3 .vscode/settings.json file (main repo, and in each of the submodules' folders), each containing:

    "[python]": {
    "editor.formatOnType": false,
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "ms-python.black-formatter",
    },
    "black-formatter.args": [
    "--line-length=xxx".
    ]


    I set the line length to 150 in the main repo and sub_01, and 100 in sub_02, but it seems the 150 setting is being used everywhere when I save.

    Continue reading...

Compartilhe esta Página