Skip to content

Commit fc46791

Browse files
committed
chore: unify dependency pinning setup
1 parent c2e5544 commit fc46791

6 files changed

Lines changed: 355 additions & 310 deletions

File tree

.envrc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
ls venv &> /dev/null || python3 -mvenv venv || exit 1
22
source venv/bin/activate || exit 1
3-
pip install -r requirements.txt || exit 1
3+
4+
pip install pip-tools pip-audit|| exit 1
5+
6+
if [ ! -f "requirements.txt" ]; then
7+
echo "requirements.txt not found. Compiling from pyproject.toml..."
8+
pip-compile -v --all-extras --generate-hashes --allow-unsafe --output-file=requirements.txt pyproject.toml || exit 1
9+
# --allow-unsafe / --no-allow-unsafe
10+
# Pin packages considered unsafe: distribute,
11+
# pip, setuptools.
12+
#
13+
# WARNING: Future versions of pip-tools will
14+
# enable this behavior by default. Use --no-
15+
# allow-unsafe to keep the old behavior. It is
16+
# recommended to pass the --allow-unsafe now
17+
# to adapt to the upcoming change.
18+
fi
19+
20+
echo "Auditing locked dependencies..."
21+
# not using --strict because no vulnerability info can be found for http-request-recorder
22+
pip-audit --require-hashes -r requirements.txt || exit 1
23+
24+
echo "Installing with strict hash verification..."
25+
pip install --require-hashes --only-binary :all: -r requirements.txt || exit 1
26+
427
pre-commit install

.github/workflows/slack-notification.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Post to a Slack channel
2222
id: slack
23-
uses: slackapi/slack-github-action@v1.23.0
23+
uses: slackapi/slack-github-action@fcfb566f8b0aab22203f066d80ca1d7e4b5d05b3 #v1.27.1
2424
with:
2525
channel-id: ${{ inputs.channel }}
2626
payload: |

.github/workflows/verify.yaml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,43 +10,37 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-python@v4
13+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
14+
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c #v4.9.1
1515
with:
1616
python-version: '3.12'
1717
- name: Install dependencies
18-
run: |
19-
python -m pip install --upgrade pip
20-
pip install ruff
18+
run: pip install ruff
2119
- name: Lint with Ruff
2220
run: ruff check --output-format=github .
2321
continue-on-error: false
2422

2523
test:
2624
runs-on: ubuntu-latest
2725
steps:
28-
- uses: actions/checkout@v4
29-
- uses: actions/setup-python@v4
26+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
27+
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c #v4.9.1
3028
with:
3129
python-version: '3.12'
3230
- name: Install dependencies
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install -r requirements.txt
31+
run: pip install --require-hashes -r requirements.txt
3632
- name: Run tests
3733
run: python -m unittest
3834

3935
build:
4036
runs-on: ubuntu-latest
4137
steps:
42-
- uses: actions/checkout@v4
43-
- uses: actions/setup-python@v4
38+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1
39+
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c #v4.9.1
4440
with:
4541
python-version: '3.12'
4642
- name: Install dependencies
47-
run: |
48-
python -m pip install --upgrade pip
49-
pip install build
43+
run: pip install build
5044
- name: Build package
5145
run: python -m build
5246

.pre-commit-config.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
# pre-commit autoupdate --freeze
12
repos:
2-
- repo: https://github.com/charliermarsh/ruff-pre-commit
3-
rev: 'v0.12.10'
3+
- repo: https://github.com/astral-sh/ruff-pre-commit
4+
rev: '5e2fb545eba1ea9dc051f6f962d52fe8f76a9794' # frozen: v0.15.13
45
hooks:
56
- id: ruff
67
args: ['--fix']
78

89
- repo: https://github.com/hhatto/autopep8
9-
rev: 'v2.3.2'
10+
rev: '4046ad49e25b7fa1db275bf66b1b7d60600ac391' # frozen: v2.3.2
1011
hooks:
1112
- id: autopep8

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ dependencies = []
2020

2121
[project.optional-dependencies]
2222
jobd = [
23-
"http_request_recorder @ https://github.com/sipgate/http-request-recorder/archive/96a89cef0b71faab11121af5b28a60aeb887af5a.zip"
23+
"http_request_recorder @ https://github.com/sipgate/http-request-recorder/archive/bf99fe64fd67db9df845be0e8da7e2601d9c8eef.zip"
2424
]
2525
rpc_matchers = [
26-
"http_request_recorder @ https://github.com/sipgate/http-request-recorder/archive/96a89cef0b71faab11121af5b28a60aeb887af5a.zip"
26+
"http_request_recorder @ https://github.com/sipgate/http-request-recorder/archive/bf99fe64fd67db9df845be0e8da7e2601d9c8eef.zip"
2727
]
2828
db = [
2929
"SQLAlchemy~=2.0.43"

0 commit comments

Comments
 (0)