Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(language): integrate Python linters #178

Merged
merged 6 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/build-language.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ on:
- "language/**"
tags:
- 'v*'
pull_request:
branches:
- main
paths:
- "language/**"

jobs:
build_and_push:
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/lint-language.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,20 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Lint using Golanci lint
uses: golangci/golangci-lint-action@v6
- name: Setup Python
uses: actions/setup-python@v5
with:
working-directory: language
python-version: 3.12

- name: Lint using flake8
uses: py-actions/flake8@v2
with:
path: language
ignore: "E203"
max-line-length: "88"
exclude: ".git,.venv,.dockerignore,.pdm-python,Dockerfile"
plugins: "flake8-black"

permissions:
contents: read
pull-requests: read
Expand Down
11 changes: 11 additions & 0 deletions language/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,14 @@ flask run --host=0.0.0.0 --port=8084 --debug
```

You can omit the `--debug` flag when not developing.

Lint code:

```shell
flake8 .
```

Format code:
```shell
black .
```
51 changes: 50 additions & 1 deletion language/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion language/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ requires-python = "==3.12.*"
dependencies = ["flask==3.0.3", "spacy==3.7.4", "requests==2.32.2"]

[tool.pdm.dev-dependencies]
dev = ["black==24.4.2"]
dev = [
"black==24.4.2",
"flake8==7.1.0",
]

[tool.pdm]
distribution = false