A tool to verify your Python projects requirements.txt for updates using pur.
This tool has been tested against the following:
- GitHub Actions
- Travis CI
- CircleCI
- BitBucket pipelines
- Local command line
Because it is a plain Bash script, it should work on most CI platforms where you can run arbitrary commands.
on: [push, pull_request]
jobs:
build:
name: Pur
runs-on: ubuntu-latest
steps:
- name: Checkout the Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run Pur
run: bash <(curl -s https://raw.githubusercontent.com/lupaxa-cicd-toolbox/pur/master/src/pipeline.sh)./src/pipeline.shOr without cloning:
bash <(curl -s https://raw.githubusercontent.com/lupaxa-cicd-toolbox/pur/master/src/pipeline.sh)The following environment variables customise the script:
| Variable | Default | Purpose |
|---|---|---|
INCLUDE_FILES |
(empty) |
Comma-separated path regexes to force-include |
EXCLUDE_FILES |
(empty) |
Comma-separated path regexes to skip |
NO_COLOR |
false |
Disable colour output |
REPORT_ONLY |
false |
Report results but always exit 0 |
SHOW_ERRORS |
true |
Show detailed errors for failed files |
SHOW_FILTERED |
false |
Show files skipped by exclude rules |
SHOW_UNMATCHED |
false |
Show files that matched neither pattern |
SCAN_ROOT |
script default | Override scan directory without editing the script |
If you set
INCLUDE_FILES, only matching paths are scanned (everything else is skipped, including paths that would matchEXCLUDE_FILES).
You can combine any of the settings above:
on: [push, pull_request]
jobs:
build:
name: Pur
runs-on: ubuntu-latest
steps:
- name: Checkout the Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run Pur
env:
REPORT_ONLY: true
SHOW_ERRORS: true
run: bash <(curl -s https://raw.githubusercontent.com/lupaxa-cicd-toolbox/pur/master/src/pipeline.sh)This is an example of the output report generated by this tool (from the legacy tool run against itself; the new template uses a similar pass/fail report).
--------------------------------------------------------------------- Stage 1: Parameters --
No parameters given
---------------------------------------------------------- Stage 2: Install Prerequisites --
[ OK ] pur is already installed
--------------------------------------------------------------- Stage 3: Run pur (v7.3.1) --
[ OK ] tests/requirements.txt
------------------------------------------------------------------------- Stage 4: Report --
Total: 1, OK: 1, Failed: 0, Skipped: 0
----------------------------------------------------------------------- Stage 5: Complete --
Target files are identified using the following code:
[[ ${filename} =~ \requirements.txt$ ]]
There is not magic type for requirements.txt files so file -b is of not use for identifying the files.