GeezerVison is showing github.com — Check formatting of Python code in AzDO pipelines (#9743) · ilexei/vscode-python@0a9a7b7
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: CONTRIBUTING.md +2Lines changed: 2 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 38 | 38 | python3 -m venv .venv | 39 | 39 | # Activate the virtual environment as appropriate for your shell, For example ... | 40 | 40 | source .venv/bin/activate | | 41 | +# The Python code in the extension is formatted using Black. | | 42 | +python3 -m pip install black | 41 | 43 | # Install Python dependencies using `python3`. | 42 | 44 | # If you want to use a different interpreter then specify it in the | 43 | 45 | # CI_PYTHON_PATH environment variable. | |
Collapse file Copy file name to clipboardExpand all lines: build/ci/templates/jobs/build_compile.yml +8-2Lines changed: 8 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 36 | 36 | workingDirectory: $(Build.SourcesDirectory) | 37 | 37 |
| 38 | 38 | - bash: npx prettier "src/**/*.ts*" --check | 39 | | - displayName: "Code Format" | | 39 | + displayName: "Code Format (TypeScript)" | 40 | 40 | workingDirectory: $(Build.SourcesDirectory) | 41 | 41 |
| 42 | 42 | - bash: npx prettier "build/**/*.js" --check | 43 | | - displayName: "Code Format" | | 43 | + displayName: "Code Format (JavaScript)" | 44 | 44 | workingDirectory: $(Build.SourcesDirectory) | | 45 | + | | 46 | + - bash: | | | 47 | + python -m pip install -U black | | 48 | + python -m black . --check | | 49 | + displayName: "Code Format (Python)" | | 50 | + workingDirectory: $(Build.SourcesDirectory)/pythonFiles |
Collapse file Copy file name to clipboardExpand all lines: build/ci/templates/steps/build.yml -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | compile: 'false' | 20 | 20 |
| 21 | 21 | - bash: | | 22 | | - python -m pip install -U pip | 23 | 22 | python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt | 24 | 23 | python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2' | 25 | 24 | python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/new_ptvsd/no_wheels --no-cache-dir --implementation py --no-deps --upgrade --pre ptvsd | |
Collapse file Copy file name to clipboardExpand all lines: build/ci/templates/steps/initialization.yml +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -120,6 +120,9 @@ steps: | 120 | 120 | displayName: 'Start Display Server (xvfb) to launch VS Code)' | 121 | 121 | condition: and(succeeded(), eq(variables['Agent.Os'], 'Linux')) | 122 | 122 |
| | 123 | + - bash: python -m pip install -U pip | | 124 | + displayName: 'Install pip' | | 125 | + | 123 | 126 | # # Show all versions installed/available on PATH if in verbose mode. | 124 | 127 | # # Example command line (windows pwsh): | 125 | 128 | # # > Write-Host Node ver: $(& node -v) NPM Ver: $(& npm -v) Python ver: $(& python --version)" | |
Collapse file Copy file name to clipboardExpand all lines: build/ci/templates/test_phases.yml -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 93 | 93 | # > python -m pip install --upgrade -r build/test-requirements.txt | 94 | 94 | # > python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt | 95 | 95 | - bash: | | 96 | | - python -m pip install -U pip | 97 | 96 | python -m pip install --upgrade -r build/test-requirements.txt | 98 | 97 | python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt | 99 | 98 | python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python/old_ptvsd --no-cache-dir --implementation py --no-deps --upgrade 'ptvsd==4.3.2' | @@ -119,7 +118,6 @@ steps: | 119 | 118 | # > python -m pip install --upgrade -r build/functional-test-requirements.txt | 120 | 119 | # > python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt | 121 | 120 | - bash: | | 122 | | - python -m pip install -U pip | 123 | 121 | python -m pip install numpy | 124 | 122 | python -m pip install --upgrade -r ./build/functional-test-requirements.txt | 125 | 123 | displayName: 'pip install functional requirements' | @@ -142,7 +140,6 @@ steps: | 142 | 140 | # > python -m pip install --upgrade -r build/ipython-test-requirements.txt | 143 | 141 | # > python -m pip --disable-pip-version-check install -t ./pythonFiles/lib/python --no-cache-dir --implementation py --no-deps --upgrade -r requirements.txt | 144 | 142 | - bash: | | 145 | | - python -m pip install -U pip | 146 | 143 | python -m pip install numpy | 147 | 144 | python -m pip install --upgrade -r ./build/ipython-test-requirements.txt | 148 | 145 | displayName: 'pip install ipython requirements' | |
Collapse file Copy file name to clipboard +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -Use [prettier](https://prettier.io/) as the formatter for `TypeScript` code within the extension. | | 1 | +Use [prettier](https://prettier.io/) as the `TypeScript` formatter and [Black](https://github.com/psf/black) as the `Python` formatter within the extension. |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/printEnvVariablesToFile.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | # Last argument is the target file into which we'll write the env variables as json. | 10 | 10 | json_file = sys.argv[-1] | 11 | 11 |
| 12 | | -with open(json_file, 'w') as outfile: | | 12 | +with open(json_file, "w") as outfile: | 13 | 13 | json.dump(dict(os.environ), outfile) |
Collapse file Copy file name to clipboard +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +[tool.black] | | 2 | +exclude = ''' | | 3 | +
| | 4 | +( | | 5 | + /( | | 6 | + .data | | 7 | + | .vscode | | 8 | + | lib | | 9 | + )/ | | 10 | +) | | 11 | +''' |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/shell_exec.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 37 | 37 | fp.flush() | 38 | 38 | try: | 39 | 39 | # ALso log the error for use from the other side. | 40 | | - with open(lock_file + '.error', 'w') as fpError: | | 40 | + with open(lock_file + ".error", "w") as fpError: | 41 | 41 | fpError.write(traceback.format_exc()) | 42 | 42 | except Exception: | 43 | 43 | pass |
|