Skip to content

Commit 46f7389

Browse files
committed
Merge branch 'main' into speakeasy-sdk-regen-1748257524
2 parents 607b835 + 69374e8 commit 46f7389

File tree

6 files changed

+168
-54
lines changed

6 files changed

+168
-54
lines changed

.github/workflows/lint_custom_code.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ jobs:
2121
with:
2222
python-version: '3.12'
2323

24-
- name: Install ruff
25-
run: pip install ruff
24+
- name: Install Poetry
25+
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1.4.1
2626

27-
- name: Lint with ruff
28-
# No need to lint the automatically generated Speakeasy code
27+
- name: Install dependencies
2928
run: |
30-
ruff check examples/
31-
ruff check src/mistralai/_hooks/ --exclude __init__.py --exclude sdkhooks.py --exclude types.py
32-
ruff check src/mistralai/extra/
29+
touch README-PYPI.md
30+
poetry install
31+
32+
# The init, sdkhooks.py and types.py files in the _hooks folders are generated by Speakeasy hence the exclusion
33+
- name: Run all linters
34+
run: scripts/lint_custom_code.sh

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.11.10
4+
hooks:
5+
- id: ruff
6+
args: [--fix]
7+
files: ^(example/|src/mistralai/).*\.py$
8+
exclude: ^src/mistralai/(__init__|sdkhooks|types)\.py$
9+
- repo: https://github.com/RobertCraigie/pyright-python
10+
rev: v1.1.401
11+
hooks:
12+
- id: pyright
13+
files: ^(example/|src/mistralai/).*\.py$
14+
exclude: ^src/mistralai/(__init__|sdkhooks|types)\.py$
15+
- repo: https://github.com/pre-commit/mirrors-mypy
16+
rev: v1.15.0
17+
hooks:
18+
- id: mypy
19+
files: ^(example/|src/mistralai/).*\.py$
20+
exclude: ^src/mistralai/(__init__|sdkhooks|types)\.py$

poetry.lock

Lines changed: 100 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ include = ["py.typed", "src/mistralai/py.typed"]
2929
in-project = true
3030

3131
[tool.poetry.group.dev.dependencies]
32-
mypy = "==1.14.1"
32+
mypy = "==1.15.0"
3333
pylint = "==3.2.3"
3434
pytest = "^8.2.2"
3535
pytest-asyncio = "^0.23.7"
3636
types-python-dateutil = "^2.9.0.20240316"
3737

38+
[tool.poetry.group.lint.dependencies]
39+
ruff = "^0.11.10"
40+
pyright = "^1.1.401"
41+
mypy = "==1.15.0"
42+
43+
3844
[project.optional-dependencies]
3945
gcp = [
4046
"google-auth >=2.27.0",

scripts/lint_custom_code.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
ERRORS=0
6+
7+
echo "Running mypy..."
8+
# TODO: Uncomment once the examples are fixed
9+
# poetry run mypy examples/ || ERRORS=1
10+
poetry run mypy src/mistralai/extra/ || ERRORS=1
11+
poetry run mypy src/mistralai/_hooks/ \
12+
--exclude __init__.py --exclude sdkhooks.py --exclude types.py || ERRORS=1
13+
14+
echo "Running pyright..."
15+
# TODO: Uncomment once the examples are fixed
16+
# poetry run pyright examples/ || ERRORS=1
17+
poetry run pyright src/mistralai/extra/ || ERRORS=1
18+
poetry run pyright src/mistralai/_hooks/ || ERRORS=1
19+
20+
echo "Running ruff..."
21+
poetry run ruff check examples/ || ERRORS=1
22+
poetry run ruff check src/mistralai/extra/ || ERRORS=1
23+
poetry run ruff check src/mistralai/_hooks/ \
24+
--exclude __init__.py --exclude sdkhooks.py --exclude types.py || ERRORS=1
25+
26+
if [ "$ERRORS" -ne 0 ]; then
27+
echo "❌ One or more linters failed"
28+
exit 1
29+
else
30+
echo "✅ All linters passed"
31+
fi

0 commit comments

Comments
 (0)