This repository was archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Code Review #79
Merged
Merged
Code Review #79
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # This file is for use as a devcontainer and a runtime container | ||
| # | ||
| # The devcontainer should use the build target and run as root with podman | ||
| # or docker with user namespaces. | ||
| # | ||
| FROM python:3.11 as build | ||
|
|
||
| ARG PIP_OPTIONS | ||
|
|
||
| # Add any system dependencies for the developer/build environment here e.g. | ||
| # RUN apt-get update && apt-get upgrade -y && \ | ||
| # apt-get install -y --no-install-recommends \ | ||
| # desired-packages \ | ||
| # && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # set up a virtual environment and put it in PATH | ||
| RUN python -m venv /venv | ||
| ENV PATH=/venv/bin:$PATH | ||
|
|
||
| # Copy any required context for the pip install over | ||
| COPY . /context | ||
| WORKDIR /context | ||
|
|
||
| # install python package into /venv | ||
| RUN pip install ${PIP_OPTIONS} | ||
|
|
||
| FROM python:3.11-slim as runtime | ||
|
|
||
| # Add apt-get system dependecies for runtime here if needed | ||
|
|
||
| # copy the virtual environment from the build stage and put it in PATH | ||
| COPY --from=build /venv/ /venv/ | ||
| ENV PATH=/venv/bin:$PATH | ||
|
|
||
| # change this entrypoint if it is not the same as the repo | ||
| ENTRYPOINT ["python3-pip-skeleton"] | ||
| CMD ["--version"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: Install requirements | ||
| description: Run pip install with requirements and upload resulting requirements | ||
| inputs: | ||
| requirements_file: | ||
| description: Name of requirements file to use and upload | ||
| required: true | ||
| install_options: | ||
| description: Parameters to pass to pip install | ||
| required: true | ||
| python_version: | ||
| description: Python version to install | ||
| default: "3.x" | ||
|
|
||
| runs: | ||
| using: composite | ||
|
|
||
| steps: | ||
| - name: Setup python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ inputs.python_version }} | ||
|
|
||
| - name: Pip install | ||
| run: | | ||
| touch ${{ inputs.requirements_file }} | ||
| # -c uses requirements.txt as constraints, see 'Validate requirements file' | ||
| pip install -c ${{ inputs.requirements_file }} ${{ inputs.install_options }} | ||
| shell: bash | ||
|
|
||
| - name: Create lockfile | ||
| run: | | ||
| mkdir -p lockfiles | ||
| pip freeze --exclude-editable > lockfiles/${{ inputs.requirements_file }} | ||
| # delete the self referencing line and make sure it isn't blank | ||
| sed -i '/file:/d' lockfiles/${{ inputs.requirements_file }} | ||
| shell: bash | ||
|
|
||
| - name: Upload lockfiles | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: lockfiles | ||
| path: lockfiles | ||
|
|
||
| # This eliminates the class of problems where the requirements being given no | ||
| # longer match what the packages themselves dictate. E.g. In the rare instance | ||
| # where I install some-package which used to depend on vulnerable-dependency | ||
| # but now uses good-dependency (despite being nominally the same version) | ||
| # pip will install both if given a requirements file with -r | ||
| - name: If requirements file exists, check it matches pip installed packages | ||
| run: | | ||
| if [ -s ${{ inputs.requirements_file }} ]; then | ||
| if ! diff -u ${{ inputs.requirements_file }} lockfiles/${{ inputs.requirements_file }}; then | ||
| echo "Error: ${{ inputs.requirements_file }} need the above changes to be exhaustive" | ||
| exit 1 | ||
| fi | ||
| fi | ||
| shell: bash | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.