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

Pin versions for transient dependencies, test in CI #421

Merged
merged 13 commits into from
Mar 14, 2023
13 changes: 13 additions & 0 deletions .github/upgrade-pip-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

base="$(dirname "$0")"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

36% of developers fix this issue

SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


ℹ️ Expand to see all @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Help us improve LIFT! (Sonatype LiftBot external survey)

Was this a good recommendation for you? Answering this survey will not impact your Lift settings.

[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]


pip install --upgrade --upgrade-strategy eager -r "$base/../python/requirements-direct.txt" -c "$base/../python/constraints.txt"

pip install pipdeptree
grep -e "^#" -e ";" "$base/../python/requirements-direct.txt" > "$base/../python/requirements.txt"
pipdeptree --packages="$(grep -v "^#" "$base/../python/requirements-direct.txt" | sed -e "s/;.*//" -e "s/=.*//g" | paste -s -d ,)" --freeze >> "$base/../python/requirements.txt"

git diff "$base/../python/requirements.txt"

16 changes: 16 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ on:
permissions: {}

jobs:
dependencies:
name: Test python/requirements.txt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check requirements.txt against requirements-direct.txt
run: |
(diff -w python/requirements-direct.txt python/requirements.txt || true) | (! grep -e "^<")
shell: bash
- name: Check for dependency updates
continue-on-error: true
run:
.github/upgrade-pip-packages.sh
shell: bash

test:
name: Test (python-${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 2 additions & 0 deletions python/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# latest version for PyJWT on Windows and macOS and Python 3.6
PyJWT==2.4.0
9 changes: 9 additions & 0 deletions python/requirements-direct.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# dataclasses does not exist before Python3.7, needed as dependency
dataclasses;python_version<"3.7"
humanize==3.14.0
junitparser==2.8.0
lxml==4.9.1
psutil==5.9.4
PyGithub==1.56
requests==2.27.1
urllib3==1.26.13
14 changes: 12 additions & 2 deletions python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
dataclasses;python_version<"3.7"
humanize==3.14.0
junitparser==2.8.0
future==0.18.3
lxml==4.9.1
psutil==5.9.4
PyGithub==1.56
requests==2.27.1
urllib3==1.26.13
Deprecated==1.2.13
wrapt==1.15.0
PyJWT==2.4.0
PyNaCl==1.5.0
cffi==1.15.1
pycparser==2.21
requests==2.27.1
certifi==2022.12.7
charset-normalizer==2.0.12
idna==3.4
urllib3==1.26.13