Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit b9fe2bf

Browse files
committed
Merge branch 'review-nov22' of github.com:DiamondLightSource/python3-pip-skeleton into review-nov22
2 parents 4067036 + edfc428 commit b9fe2bf

File tree

6 files changed

+24
-33
lines changed

6 files changed

+24
-33
lines changed

Dockerfile renamed to .devcontainer/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# The devcontainer should use the build target and run as root with podman
44
# or docker with user namespaces.
55
#
6-
FROM python:3.11 as base
7-
FROM base as build
6+
FROM python:3.11 as build
87

98
ARG PIP_OPTIONS
109

@@ -18,9 +17,9 @@ ARG PIP_OPTIONS
1817
RUN python -m venv /venv
1918
ENV PATH=/venv/bin:$PATH
2019

21-
# Copy the project over
22-
COPY . /project
23-
WORKDIR /project
20+
# Copy any required context for the pip install over
21+
COPY . /context
22+
WORKDIR /context
2423

2524
# install python package into /venv
2625
RUN pip install ${PIP_OPTIONS}
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
"build": {
55
"dockerfile": "Dockerfile",
66
"target": "build",
7-
"context": ".",
7+
// Only upgrade pip, we will install the project below
88
"args": {
9-
"PIP_OPTIONS": "-e .[dev]"
9+
"PIP_OPTIONS": "--upgrade pip"
1010
}
1111
},
1212
"remoteEnv": {
1313
"DISPLAY": "${localEnv:DISPLAY}"
1414
},
1515
// Set *default* container specific settings.json values on container create.
1616
"settings": {
17-
"python.defaultInterpreterPath": "/venv/bin/python",
18-
"python.linting.enabled": true
17+
"python.defaultInterpreterPath": "/venv/bin/python"
1918
},
2019
// Add the IDs of extensions you want installed when the container is created.
2120
"extensions": [
@@ -36,5 +35,7 @@
3635
],
3736
// make the workspace folder the same inside and outside of the container
3837
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
39-
"workspaceFolder": "${localWorkspaceFolder}"
38+
"workspaceFolder": "${localWorkspaceFolder}",
39+
// After the container is created, install the python project in editable form
40+
"postCreateCommand": "pip install -e .[dev]"
4041
}

.dockerignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/actions/install_requirements/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
run: |
3232
mkdir -p lockfiles
3333
pip freeze --exclude-editable > lockfiles/${{ inputs.requirements_file }}
34-
# delete the self referencing line
34+
# delete the self referencing line and make sure it isn't blank
3535
sed -i '/file:/d' lockfiles/${{ inputs.requirements_file }}
3636
shell: bash
3737

.github/workflows/code.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
# Run every Monday at 8am to check latest versions of dependencies
7+
# Run weekly to check latest versions of dependencies
88
- cron: "0 8 * * WED"
99
env:
1010
# The target python version, which must match the Dockerfile version
@@ -130,6 +130,8 @@ jobs:
130130

131131
- name: Download wheel and lockfiles
132132
uses: actions/download-artifact@v3
133+
with:
134+
path: .devcontainer
133135

134136
- name: Log in to GitHub Docker Registry
135137
if: github.event_name != 'pull_request'
@@ -160,9 +162,11 @@ jobs:
160162
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
161163
load: ${{ ! (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }}
162164
tags: ${{ steps.meta.outputs.tags }}
163-
context: .
164-
cache-from: type=gha
165-
cache-to: type=gha,mode=max
165+
context: .devcontainer
166+
# If you have a long docker build, uncomment the following to turn on caching
167+
# For short build times this makes it a little slower
168+
#cache-from: type=gha
169+
#cache-to: type=gha,mode=max
166170

167171
- name: Test cli works in runtime image
168172
run: docker run ${{ env.IMAGE_REPOSITORY }} --version

.github/workflows/linkcheck.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Link Check
33
on:
44
workflow_dispatch:
55
schedule:
6-
# Run every Monday at 8am to check URL links still resolve
6+
# Run weekly to check URL links still resolve
77
- cron: "0 8 * * WED"
88

99
jobs:
@@ -18,18 +18,12 @@ jobs:
1818
steps:
1919
- name: Checkout
2020
uses: actions/checkout@v3
21-
with:
22-
fetch-depth: 0
2321

24-
- name: Install python version
25-
uses: actions/setup-python@v4
22+
- name: Install python packages
23+
uses: ./.github/actions/install_requirements
2624
with:
27-
python-version: ${{ matrix.python }}
28-
29-
- name: Install dependencies
30-
run: |
31-
touch requirements_dev.txt
32-
pip install -r requirements_dev.txt -e .[dev]
25+
requirements_file: requirements-dev-3.x.txt
26+
install_options: -e .[dev]
3327

3428
- name: Check links
3529
run: tox -e docs build -- -b linkcheck

0 commit comments

Comments
 (0)