Skip to content

Commit 1c7361a

Browse files
committed
Move linter to Hatch
1 parent f1f05e7 commit 1c7361a

File tree

2 files changed

+55
-7
lines changed

2 files changed

+55
-7
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ jobs:
1313
with:
1414
python-version: 3.x
1515
- name: Install dependencies
16-
run: |
17-
python3 -m pip install nox
16+
run: python3 -m pip install hatch
1817
- name: Lint code
19-
run: nox -s lint
18+
run: hatch run lint:lint
2019

2120
docs:
2221
runs-on: ubuntu-latest
@@ -28,8 +27,7 @@ jobs:
2827
with:
2928
python-version: 3.x
3029
- name: Install dependencies
31-
run: |
32-
python3 -m pip install nox
30+
run: python3 -m pip install nox
3331
- name: Build docs
3432
run: nox -s docs
3533

@@ -52,8 +50,7 @@ jobs:
5250
with:
5351
python-version: ${{ matrix.python-version }}
5452
- name: Install dependencies
55-
run: |
56-
python -m pip install hatch
53+
run: python -m pip install hatch
5754
- name: Run tests
5855
shell: bash
5956
run: "hatch run test.py${{ matrix.python-version }}:test"

pyproject.toml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,54 @@ test = [
121121

122122
[[tool.hatch.envs.test.matrix]]
123123
python = ["3.7", "3.8", "3.9", "3.10", "3.11"]
124+
125+
[tool.hatch.envs.lint]
126+
extra-dependencies = [
127+
"black",
128+
"flake8",
129+
"flynt",
130+
"isort",
131+
"mypy",
132+
"types-requests",
133+
"unasync",
134+
]
135+
136+
[tool.hatch.envs.lint.scripts]
137+
lint = [
138+
"isort --check .",
139+
"python utils/run-black.py --check .",
140+
"flake8 .",
141+
"""
142+
python utils/license-headers.py check \
143+
docs/sphinx/conf.py \
144+
noxfile.py \
145+
elasticsearch_serverless \
146+
test_elasticsearch_serverless \
147+
utils
148+
""",
149+
# Workaround to make '-r' to still work despite uninstalling aiohttp below.
150+
"python -m pip install .[async,requests]",
151+
"mypy --strict --show-error-codes elasticsearch_serverless/",
152+
"""
153+
mypy \
154+
--strict \
155+
--show-error-codes \
156+
test_elasticsearch_serverless/test_types/sync_types.py
157+
""",
158+
"""
159+
mypy \
160+
--strict \
161+
--show-error-codes \
162+
test_elasticsearch_serverless/test_types/async_types.py
163+
""",
164+
# Make sure we don't require aiohttp to be installed for users to
165+
# receive type hint information from mypy.
166+
"python -m pip uninstall --yes aiohttp",
167+
"mypy --strict --show-error-codes elasticsearch_serverless/",
168+
"""
169+
mypy \
170+
--strict \
171+
--show-error-codes \
172+
test_elasticsearch_serverless/test_types/sync_types.py
173+
"""
174+
]

0 commit comments

Comments
 (0)