Skip to content

Commit 3799499

Browse files
authored
Update development toolchain (#439)
1 parent 7ea7005 commit 3799499

24 files changed

+1157
-1537
lines changed

.deepsource.toml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.devcontainer/devcontainer.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"containerEnv": {
3+
"POETRY_VIRTUALENVS_IN_PROJECT": "true"
4+
},
5+
"customizations": {
6+
"codespaces": {
7+
"openFiles": ["README.md"]
8+
},
9+
"vscode": {
10+
"extensions": [
11+
"ms-python.python",
12+
"redhat.vscode-yaml",
13+
"esbenp.prettier-vscode",
14+
"GitHub.vscode-pull-request-github",
15+
"charliermarsh.ruff",
16+
"GitHub.vscode-github-actions",
17+
"ryanluker.vscode-coverage-gutters"
18+
],
19+
"settings": {
20+
"[python]": {
21+
"editor.codeActionsOnSave": {
22+
"source.fixAll": true,
23+
"source.organizeImports": true
24+
}
25+
},
26+
"coverage-gutters.customizable.context-menu": true,
27+
"coverage-gutters.customizable.status-bar-toggler-watchCoverageAndVisibleEditors-enabled": true,
28+
"coverage-gutters.showGutterCoverage": false,
29+
"coverage-gutters.showLineCoverage": true,
30+
"coverage-gutters.xmlname": "coverage.xml",
31+
"python.analysis.extraPaths": ["${workspaceFolder}/src"],
32+
"python.defaultInterpreterPath": ".venv/bin/python",
33+
"python.formatting.provider": "black",
34+
"python.linting.enabled": true,
35+
"python.linting.mypyEnabled": true,
36+
"python.linting.pylintEnabled": true,
37+
"python.testing.cwd": "${workspaceFolder}",
38+
"python.testing.pytestArgs": ["--cov-report=xml"],
39+
"python.testing.pytestEnabled": true,
40+
"ruff.importStrategy": "fromEnvironment",
41+
"ruff.interpreter": [".venv/bin/python"],
42+
"terminal.integrated.defaultProfile.linux": "zsh"
43+
}
44+
}
45+
},
46+
"features": {
47+
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
48+
"ghcr.io/devcontainers/features/github-cli:1": {},
49+
"ghcr.io/devcontainers/features/node:1": {},
50+
"ghcr.io/devcontainers/features/python:1": {
51+
"installTools": false
52+
}
53+
},
54+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
55+
"name": "Asynchronous client for the Tailscale API",
56+
"updateContentCommand": ". ${NVM_DIR}/nvm.sh && nvm install && nvm use && npm install && poetry install && poetry run pre-commit install"
57+
}

.flake8

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/codeql.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: ⤵️ Check out code from GitHub
20-
uses: actions/checkout@v4
20+
uses: actions/checkout@v4.1.1
2121
- name: 🏗 Initialize CodeQL
22-
uses: github/codeql-action/init@v2
22+
uses: github/codeql-action/init@v2.22.5
2323
- name: 🚀 Perform CodeQL Analysis
24-
uses: github/codeql-action/analyze@v2
24+
uses: github/codeql-action/analyze@v2.22.5

.github/workflows/linting.yaml

Lines changed: 156 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -7,125 +7,179 @@ on:
77
pull_request:
88
workflow_dispatch:
99

10+
env:
11+
DEFAULT_PYTHON: "3.11"
12+
1013
jobs:
11-
precommit:
12-
name: ${{ matrix.name }}
14+
codespell:
15+
name: codespell
1316
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
include:
17-
- id: bandit
18-
name: Check with bandit
19-
- id: black
20-
name: Check code style
21-
- id: blacken-docs
22-
name: Check code style in documentation
23-
- id: check-ast
24-
name: Check Python AST
25-
- id: check-case-conflict
26-
name: Check for case conflicts
27-
- id: check-docstring-first
28-
name: Check docstring is first
29-
- id: check-executables-have-shebangs
30-
name: Check that executables have shebangs
31-
- id: check-json
32-
name: Check JSON files
33-
- id: check-merge-conflict
34-
name: Check for merge conflicts
35-
- id: check-symlinks
36-
name: Check for broken symlinks
37-
- id: check-toml
38-
name: Check TOML files
39-
- id: check-xml
40-
name: Check XML files
41-
- id: check-yaml
42-
name: Check YAML files
43-
- id: codespell
44-
name: Check code for common misspellings
45-
- id: debug-statements
46-
name: Debug Statements and imports (Python)
47-
- id: detect-private-key
48-
name: Detect Private Keys
49-
- id: end-of-file-fixer
50-
name: Check End of Files
51-
- id: fix-byte-order-marker
52-
name: Check UTF-8 byte order marker
53-
- id: flake8
54-
name: Enforcing style guide with flake8
55-
- id: isort
56-
name: Check imports are sorted
57-
- id: poetry
58-
name: Check pyproject file
59-
- id: prettier
60-
name: Check if code is prettier
61-
- id: pylint
62-
name: Check with pylint
63-
- id: pyupgrade
64-
name: Check for upgradable syntax
65-
- id: trailing-whitespace
66-
name: Trim Trailing Whitespace
67-
- id: vulture
68-
name: Check for unused Python code
69-
- id: yamllint
70-
name: Check YAML style
7117
steps:
7218
- name: ⤵️ Check out code from GitHub
73-
uses: actions/checkout@v4
74-
- name: 🏗 Set up Python 3.9
19+
uses: actions/checkout@v4.1.1
20+
- name: 🏗 Set up Poetry
21+
run: pipx install poetry
22+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
7523
id: python
76-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v4.7.1
7725
with:
78-
python-version: 3.9
79-
- name: 🏗 Read .nvmrc
80-
if: ${{ matrix.id == 'prettier' }}
81-
id: nvm
82-
run: echo "##[set-output name=nvmrc;]$(cat .nvmrc)"
83-
- name: 🏗 Set up Node.js ${{ steps.nvm.outputs.nvmrc }}
84-
if: ${{ matrix.id == 'prettier' }}
85-
uses: actions/setup-node@v4.0.0
26+
python-version: ${{ env.DEFAULT_PYTHON }}
27+
cache: "poetry"
28+
- name: 🏗 Install workflow dependencies
29+
run: |
30+
poetry config virtualenvs.create true
31+
poetry config virtualenvs.in-project true
32+
- name: 🏗 Install Python dependencies
33+
run: poetry install --no-interaction
34+
- name: 🚀 Check code for common misspellings
35+
run: poetry run pre-commit run codespell --all-files
36+
37+
ruff:
38+
name: Ruff
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: ⤵️ Check out code from GitHub
42+
uses: actions/checkout@v4.1.1
43+
- name: 🏗 Set up Poetry
44+
run: pipx install poetry
45+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
46+
id: python
47+
uses: actions/setup-python@v4.7.1
8648
with:
87-
node-version: "${{ steps.nvm.outputs.nvmrc }}"
88-
- name: 🏗 Get pip cache dir
89-
id: pip-cache
49+
python-version: ${{ env.DEFAULT_PYTHON }}
50+
cache: "poetry"
51+
- name: 🏗 Install workflow dependencies
9052
run: |
91-
echo "::set-output name=dir::$(pip cache dir)"
92-
- name: ⤵️ Restore cached Python PIP packages
93-
uses: actions/cache@v3
53+
poetry config virtualenvs.create true
54+
poetry config virtualenvs.in-project true
55+
- name: 🏗 Install Python dependencies
56+
run: poetry install --no-interaction
57+
- name: 🚀 Run ruff linter
58+
run: poetry run ruff check --output-format=github .
59+
- name: 🚀 Run ruff formatter
60+
run: poetry run ruff format --check .
61+
62+
pre-commit-hooks:
63+
name: pre-commit-hooks
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: ⤵️ Check out code from GitHub
67+
uses: actions/checkout@v4.1.1
68+
- name: 🏗 Set up Poetry
69+
run: pipx install poetry
70+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
71+
id: python
72+
uses: actions/setup-python@v4.7.1
73+
with:
74+
python-version: ${{ env.DEFAULT_PYTHON }}
75+
cache: "poetry"
76+
- name: 🏗 Install workflow dependencies
77+
run: |
78+
poetry config virtualenvs.create true
79+
poetry config virtualenvs.in-project true
80+
- name: 🏗 Install Python dependencies
81+
run: poetry install --no-interaction
82+
- name: 🚀 Check Python AST
83+
run: poetry run pre-commit run check-ast --all-files
84+
- name: 🚀 Check for case conflicts
85+
run: poetry run pre-commit run check-case-conflict --all-files
86+
- name: 🚀 Check docstring is first
87+
run: poetry run pre-commit run check-docstring-first --all-files
88+
- name: 🚀 Check that executables have shebangs
89+
run: poetry run pre-commit run check-executables-have-shebangs --all-files
90+
- name: 🚀 Check JSON files
91+
run: poetry run pre-commit run check-json --all-files
92+
- name: 🚀 Check for merge conflicts
93+
run: poetry run pre-commit run check-merge-conflict --all-files
94+
- name: 🚀 Check for broken symlinks
95+
run: poetry run pre-commit run check-symlinks --all-files
96+
- name: 🚀 Check TOML files
97+
run: poetry run pre-commit run check-toml --all-files
98+
- name: 🚀 Check XML files
99+
run: poetry run pre-commit run check-xml --all-files
100+
- name: 🚀 Check YAML files
101+
run: poetry run pre-commit run check-yaml --all-files
102+
- name: 🚀 Check YAML files
103+
run: poetry run pre-commit run check-yaml --all-files
104+
- name: 🚀 Detect Private Keys
105+
run: poetry run pre-commit run detect-private-key --all-files
106+
- name: 🚀 Check End of Files
107+
run: poetry run pre-commit run end-of-file-fixer --all-files
108+
- name: 🚀 Trim Trailing Whitespace
109+
run: poetry run pre-commit run trailing-whitespace --all-files
110+
111+
pylint:
112+
name: pylint
113+
runs-on: ubuntu-latest
114+
steps:
115+
- name: ⤵️ Check out code from GitHub
116+
uses: actions/checkout@v4.1.1
117+
- name: 🏗 Set up Poetry
118+
run: pipx install poetry
119+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
120+
id: python
121+
uses: actions/setup-python@v4.7.1
94122
with:
95-
path: ${{ steps.pip-cache.outputs.dir }}
96-
key: pip-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('.github/workflows/requirements.txt') }}
97-
restore-keys: |
98-
pip-${{ runner.os }}-${{ steps.python.outputs.python-version }}-
123+
python-version: ${{ env.DEFAULT_PYTHON }}
124+
cache: "poetry"
99125
- name: 🏗 Install workflow dependencies
100126
run: |
101-
pip install -r .github/workflows/requirements.txt
102127
poetry config virtualenvs.create true
103128
poetry config virtualenvs.in-project true
104-
- name: ⤵️ Restore cached Python virtual environment
105-
id: cached-poetry-dependencies
106-
uses: actions/cache@v3
129+
- name: 🏗 Install Python dependencies
130+
run: poetry install --no-interaction
131+
- name: 🚀 Run pylint
132+
run: poetry run pre-commit run pylint --all-files
133+
134+
yamllint:
135+
name: yamllint
136+
runs-on: ubuntu-latest
137+
steps:
138+
- name: ⤵️ Check out code from GitHub
139+
uses: actions/checkout@v4.1.1
140+
- name: 🏗 Set up Poetry
141+
run: pipx install poetry
142+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
143+
id: python
144+
uses: actions/setup-python@v4.7.1
107145
with:
108-
path: .venv
109-
key: >-
110-
venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
111-
venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-
146+
python-version: ${{ env.DEFAULT_PYTHON }}
147+
cache: "poetry"
148+
- name: 🏗 Install workflow dependencies
149+
run: |
150+
poetry config virtualenvs.create true
151+
poetry config virtualenvs.in-project true
112152
- name: 🏗 Install Python dependencies
113153
run: poetry install --no-interaction
114-
- name: 🏗 Get npm cache directory
115-
if: ${{ matrix.id == 'prettier' }}
116-
id: npm-cache
154+
- name: 🚀 Run yamllint
155+
run: poetry run yamllint .
156+
157+
prettier:
158+
name: Prettier
159+
runs-on: ubuntu-latest
160+
steps:
161+
- name: ⤵️ Check out code from GitHub
162+
uses: actions/checkout@v4.1.1
163+
- name: 🏗 Set up Poetry
164+
run: pipx install poetry
165+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
166+
id: python
167+
uses: actions/setup-python@v4.7.1
168+
with:
169+
python-version: ${{ env.DEFAULT_PYTHON }}
170+
cache: "poetry"
171+
- name: 🏗 Install workflow dependencies
117172
run: |
118-
echo "::set-output name=dir::$(npm config get cache)"
119-
- name: ⤵️ Restore cached node modules
120-
if: ${{ matrix.id == 'prettier' }}
121-
uses: actions/cache@v3
173+
poetry config virtualenvs.create true
174+
poetry config virtualenvs.in-project true
175+
- name: 🏗 Install Python dependencies
176+
run: poetry install --no-interaction
177+
- name: 🏗 Set up Node.js
178+
uses: actions/setup-node@v4.0.0
122179
with:
123-
path: ${{ steps.npm-cache.outputs.dir }}
124-
key: node-${{ runner.os }}-${{ steps.nvm.outputs.nvmrc }}-${{ hashFiles('.github/workflows/requirements.txt') }}
125-
restore-keys: |
126-
node-${{ runner.os }}-${{ steps.nvm.outputs.nvmrc }}-
180+
node-version-file: ".nvmrc"
181+
cache: "npm"
127182
- name: 🏗 Install NPM dependencies
128-
if: ${{ matrix.id == 'prettier' }}
129183
run: npm install
130-
- name: 🚀 Run pre-commit for ${{ matrix.id }}
131-
run: poetry run pre-commit run ${{ matrix.id }} --all-files
184+
- name: 🚀 Run prettier
185+
run: poetry run pre-commit run prettier --all-files

0 commit comments

Comments
 (0)