Skip to content

Commit 18a51af

Browse files
authored
Replace safety with pip audit (#645)
* chore: 🤖 ensure poetry uses the local python version * feat: 🎸 upgrade the dependencies of the libs also: use poetry 1.2.2, and replace safety with pip-audit * fix: 🐛 remove dependency to old pymongo[srv] version it's now included in mongoengine. we had to use this dependency to use mongo URL with "+srv" * feat: 🎸 upgrade all the other projects replacing safety with pip-audit, upgrading the dependencies, after rewriting poetry.lock with poetry 1.2 * feat: 🎸 upgrade docker images * chore: 🤖 upgrade poetry in dockerfiles * chore: 🤖 fix dependencies issues in workers * ci: 🎡 try to fix pip-audit see pypa/pip-audit#84 (comment) in particular * feat: 🎸 update docker images
1 parent 38070c7 commit 18a51af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+9341
-2193
lines changed

.github/workflows/_e2e_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
type: string
1111
env:
1212
python-version: 3.9.6
13-
poetry-version: 1.1.13
13+
poetry-version: 1.2.2
1414
# required to get access to use a cached poetry venv in "/home/runner/.cache/pypoetry/virtualenvs"
1515
POETRY_VIRTUALENVS_IN_PROJECT: false
1616
working-directory: e2e

.github/workflows/_quality-python.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ on:
88
working-directory:
99
required: true
1010
type: string
11-
safety-exceptions:
12-
required: false
13-
type: string
1411
is-datasets-worker:
1512
required: false
1613
type: boolean
1714
env:
1815
# required to get access to use a cached poetry venv in "/home/runner/.cache/pypoetry/virtualenvs"
1916
POETRY_VIRTUALENVS_IN_PROJECT: false
2017
python-version: "3.9.6"
21-
poetry-version: "1.1.13"
18+
poetry-version: "1.2.2"
2219
jobs:
2320
code-quality:
2421
defaults:
@@ -55,5 +52,9 @@ jobs:
5552
run: poetry run mypy tests src
5653
- name: Run bandit
5754
run: poetry run bandit -r src
58-
- name: Run safety
59-
run: poetry run safety check ${{ inputs.safety-exceptions }}
55+
- name: Run pip-audit (datasets worker)
56+
if: ${{ inputs.is-datasets-worker == true }}
57+
run: bash -c "poetry run pip-audit -r <(poetry export -f requirements.txt --with dev | sed '/^requests==2.28.1 ;/,+2 d' | sed '/^kenlm @/d' | sed '/^trec-car-tools @/d')"
58+
- name: Run pip-audit
59+
if: ${{ inputs.is-datasets-worker == false }}
60+
run: bash -c 'poetry run pip-audit -r <(poetry export -f requirements.txt --with dev)'

.github/workflows/_unit-tests-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
POETRY_VIRTUALENVS_IN_PROJECT: false
1717
mongo-port: "27017"
1818
python-version: "3.9.6"
19-
poetry-version: "1.1.13"
19+
poetry-version: "1.2.2"
2020
jobs:
2121
unit-tests:
2222
defaults:

.github/workflows/w-first_rows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
uses: ./.github/workflows/_quality-python.yml
1818
with:
1919
working-directory: workers/first_rows
20-
safety-exceptions: ""
2120
is-datasets-worker: true
2221
unit-tests:
2322
uses: ./.github/workflows/_unit-tests-python.yml

.github/workflows/w-splits.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
uses: ./.github/workflows/_quality-python.yml
1818
with:
1919
working-directory: workers/splits
20-
safety-exceptions: ""
2120
is-datasets-worker: true
2221
unit-tests:
2322
uses: ./.github/workflows/_unit-tests-python.yml

chart/docker-images.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"dockerImage": {
33
"reverseProxy": "docker.io/nginx:1.20",
44
"jobs": {
5-
"mongodbMigration": "huggingface/datasets-server-jobs-mongodb_migration:sha-dfa89b1"
5+
"mongodbMigration": "huggingface/datasets-server-jobs-mongodb_migration:sha-b6d4c8a"
66
},
77
"services": {
8-
"admin": "huggingface/datasets-server-services-admin:sha-dfa89b1",
9-
"api": "huggingface/datasets-server-services-api:sha-dfa89b1"
8+
"admin": "huggingface/datasets-server-services-admin:sha-b6d4c8a",
9+
"api": "huggingface/datasets-server-services-api:sha-b6d4c8a"
1010
},
1111
"workers": {
12-
"splits": "huggingface/datasets-server-workers-splits:sha-a0d80a3",
13-
"firstRows": "huggingface/datasets-server-workers-first_rows:sha-319bbb8"
12+
"splits": "huggingface/datasets-server-workers-splits:sha-4a48536",
13+
"firstRows": "huggingface/datasets-server-workers-first_rows:sha-4a48536"
1414
}
1515
}
1616
}

e2e/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ DOCKER_COMPOSE := ../tools/docker-compose-datasets-server-from-remote-images.yml
1717
DOCKER_IMAGES := ../chart/docker-images.yaml
1818

1919
include ../tools/Python.mk
20+
include ../tools/PythonAudit.mk
2021
include ../tools/PythonTest.mk
2122
include ../tools/DockerRemoteImages.mk
2223
include ../tools/Docker.mk

0 commit comments

Comments
 (0)