@@ -8,36 +8,31 @@ dependencies they use:
88* to ensure reproducibility
99* to reduce the risk for rogue dependency updates to compromise software
1010
11- It's important to note that this requires any changes to dependencies are properly review , and
11+ It's important to note that this requires any changes to dependencies are properly reviewed , and
1212these changes, by design, should not be automatic in themselves, though automated tools may provide recommendations.
1313
1414### Python dependencies
1515
16- Python dependencies used in the build process should be pinned to a specific version to ensure reproducibility.
16+ Python dependencies used in the build process such as within ` .github/workflows ` should be pinned to a specific version to ensure reproducibility.
1717
18- This is done by:
19- * Using the ` --require-hashes ` option on any ` pip install ` command line
20- * Adding the required hash in the ` requirements.txt `
18+ This is achieved by:
2119
22- Currently this is used within ` .github/workflows ` but the same principle applies elsewhere.
20+ * Ensuring the required hash is in the ` requirements.txt ` .
21+ * Using the ` --require-hashes ` option on any ` pip install ` command line which causes pip to require hashes for all dependencies.
2322
24- To make this easier, a version of the ` requirements.txt ` without hashes has been saved as ` requirements.in ` . This is
25- to make maintenance easier, but it is not used at script execution time.
23+ To add a new, or changed dependency:
2624
27- The ` pip-compile ` tool must be installed via the [ pip-tools] ( https://pypi.org/project/pip-tools/ ) package.
28-
29- To add a new, or changed dependency:
30- ```
31- pip-compile --generate-hashes --output-file=requirements.txt requirements.in
32- ```
25+ * Ensure the ` pip-compile ` tool is installed via the [ pip-tools] ( https://pypi.org/project/pip-tools/ ) package.
26+ * Update ` requirements.in ` with added, modified, or deleted dependencies.
27+ * Update requirements.txt using ` pip-compile --generate-hashes --output-file=requirements.txt requirements.in ` .
28+ * Verify correct functionality.
29+ * Check in both ` requirements.txt ` and ` requirements.in ` .
3330
34- This will update requirements.txt with the correct hashes.
35-
36- Correct functionality should be verified, and then both ` requirements.txt ` and ` requirements.in ` checked in.
31+ Note: ` requirements.in ` acts purely as a template in this process. It is not used during the installation of a dependency.
3732
3833### Github Actions
3934
40- All actions used in `.github/worfklows' should pin the exact version of the action they are using, for
35+ All actions used in ` .github/worfklows ` should pin the exact version of the action they are using, for
4136example a step such as:
4237
4338``` yaml
@@ -54,10 +49,12 @@ by, for example, running:
5449pin-github-action unix.yml
5550` ` `
5651
57- This will add the appropriate hash if not present, and also update each hash in accordance with the comment.
52+ This will add the appropriate hash if not present, along with a comment, and also update each hash in accordance with any existing comment.
5853
5954For major updates, update the comment ie `pin@v4` to `pin@v5` and the tool will attempt to find the new hash.
6055
56+ The comment should not be removed, and should exclusively be used for updating the version.
57+
6158A full explanation of how the tool operates can be found in the [documentation](https://github.com/mheap/pin-github-action).
6259
6360To help in explanation here's an example of a similar code fragment between tool executions :
0 commit comments