Skip to content

Commit 4da3983

Browse files
authored
create jupyter-quant meta package (#318)
* create jupyter-quant meta package - create meta-package - add pyproject.toml file - add optional dependencies - remove unnecessary compilation steps from Dockerfile * include latest updates
0 parents  commit 4da3983

15 files changed

+1104
-0
lines changed

.env-dist

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# shellcheck disable=SC2034,SC2148
2+
# https://docs.docker.com/compose/env-file/
3+
# format VAR=VAL
4+
# There is no special handling of quotation marks. This means that they are
5+
# part of the VAL. don't do VAR=''
6+
# build
7+
IMG_PYTHON_VERSION=3.12
8+
USER=gordon
9+
USER_ID=1000
10+
USER_GID=1000
11+
APT_PROXY=
12+
# runtime
13+
IMAGE_VERSION=2408.01
14+
LISTEN_PORT=8888
15+
#BYODF=/home/gordon/Notebooks/etc/dotfiles
16+
BYODF=
17+
#SSH_KEYDIR=/home/gordon/Notebooks/etc/ssh
18+
SSH_KEYDIR=
19+
PIP_REQUIRE_VIRTUALENV=
20+
QUANT_TZ=Europe/Zurich

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "docker" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "daily"
12+
time: "04:00"
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "daily"
17+
time: "04:10"
18+
- package-ecosystem: "pip" # See documentation for possible values
19+
directory: "/" # Location of package manifests
20+
schedule:
21+
interval: "daily"
22+
time: "04:20"
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Check docker image
2+
3+
on:
4+
schedule:
5+
- cron: '20 4 * * *' # every day at 420 am
6+
workflow_dispatch:
7+
8+
env:
9+
IMAGE_NAME: gnzsnz/jupyter-quant
10+
GH_IMAGE_NAME: ghcr.io/quantbelt/jupyter-quant
11+
BASE_IMAGE: python
12+
PLATFORMS: linux/amd64,linux/arm64
13+
14+
jobs:
15+
check_base:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
needs-updating: ${{ steps.check.outputs.needs-updating }}
19+
steps:
20+
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Get enviroment variables
25+
run: |
26+
grep -v '#' .env-dist | grep '=' > .env
27+
while IFS= read -r line; do
28+
echo $line >> $GITHUB_ENV ;
29+
done < .env
30+
31+
- name: Check if update available
32+
id: check
33+
uses: lucacome/docker-image-update-checker@v1
34+
with:
35+
base-image: ${{ env.BASE_IMAGE }}:${{ env.IMG_PYTHON_VERSION }}-slim
36+
image: ${{ env.IMAGE_NAME}}:${{ env.IMAGE_VERSION }}
37+
platforms: ${{ env.PLATFORMS }}
38+
39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
with:
42+
platforms: ${{ env.PLATFORMS }}
43+
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Docker metadata
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: |
52+
${{ env.IMAGE_NAME }}
53+
${{ env.GH_IMAGE_NAME }}
54+
flavor: |
55+
latest=true
56+
57+
- name: Build Docker image
58+
uses: docker/build-push-action@v6
59+
with:
60+
push: false
61+
load: false
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
context: .
65+
build-args: |
66+
USER=${{ env.USER }}
67+
USER_ID=${{ env.USER_ID }}
68+
USER_GID=${{ env.USER_GID }}
69+
IMG_PYTHON_VERSION=${{ env.IMG_PYTHON_VERSION}}
70+
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
71+
labels: ${{ steps.meta.outputs.labels }}
72+
73+
build:
74+
runs-on: ubuntu-latest
75+
needs: check_base
76+
if: needs.check_base.outputs.needs-updating == 'true'
77+
steps:
78+
79+
- name: Checkout
80+
uses: actions/checkout@v4
81+
82+
- name: Get enviroment variables
83+
run: |
84+
grep -v '#' .env-dist | grep '=' > .env
85+
while IFS= read -r line; do
86+
echo $line >> $GITHUB_ENV ;
87+
done < .env
88+
89+
- name: Create issue
90+
id: create_issue
91+
env:
92+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
run: |
94+
title="Base images updates found for ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}"
95+
body="A new build&publish might be needed."
96+
97+
exists=$(gh issue list -S "is:issue state:open in:title $title" | wc -l)
98+
99+
if [ -n "$exists" ] && [ "$exists" -gt 0 ]; then
100+
echo "dup_issue=yes" >> $GITHUB_OUTPUT
101+
else
102+
gh issue create -t "$title" -b "$body"
103+
echo "dup_issue=no" >> $GITHUB_OUTPUT
104+
fi
105+
106+
- name: Set up QEMU
107+
uses: docker/setup-qemu-action@v3
108+
if: ${{ steps.create_issue.outputs.dup_issue == 'no' }}
109+
with:
110+
platforms: ${{ env.PLATFORMS }}
111+
112+
- name: Set up Docker Buildx
113+
uses: docker/setup-buildx-action@v3
114+
if: ${{ steps.create_issue.outputs.dup_issue == 'no' }}
115+
116+
- name: Docker metadata
117+
id: meta
118+
if: ${{ steps.create_issue.outputs.dup_issue == 'no' }}
119+
uses: docker/metadata-action@v5
120+
with:
121+
images: |
122+
${{ env.IMAGE_NAME }}
123+
${{ env.GH_IMAGE_NAME }}
124+
flavor: |
125+
latest=true
126+
127+
- name: Build Docker image
128+
uses: docker/build-push-action@v6
129+
if: ${{ steps.create_issue.outputs.dup_issue == 'no' }}
130+
with:
131+
push: false
132+
load: false
133+
cache-from: type=gha
134+
cache-to: type=gha,mode=max
135+
context: .
136+
build-args: |
137+
USER=${{ env.USER }}
138+
USER_ID=${{ env.USER_ID }}
139+
USER_GID=${{ env.USER_GID }}
140+
IMG_PYTHON_VERSION=${{ env.IMG_PYTHON_VERSION}}
141+
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
142+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master", "dev" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
env:
9+
IMAGE_NAME: gnzsnz/jupyter-quant
10+
GH_IMAGE_NAME: ghcr.io/quantbelt/jupyter-quant
11+
PLATFORMS: linux/amd64,linux/arm64
12+
13+
jobs:
14+
buildntest:
15+
name: Build and test
16+
17+
runs-on: ubuntu-latest
18+
continue-on-error: true
19+
20+
steps:
21+
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Get enviroment variables
26+
run: |
27+
grep -v '#' .env-dist | grep '=' > .env
28+
while IFS= read -r line; do
29+
echo $line >> $GITHUB_ENV ;
30+
done < .env
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
with:
35+
platforms: ${{ env.PLATFORMS }}
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Docker metadata
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: |
45+
${{ env.IMAGE_NAME }}
46+
${{ env.GH_IMAGE_NAME }}
47+
flavor: |
48+
latest=true
49+
50+
- name: Build Docker image
51+
uses: docker/build-push-action@v6
52+
with:
53+
push: false
54+
load: false
55+
cache-from: type=gha
56+
cache-to: type=gha,mode=max
57+
context: .
58+
platforms: ${{ env.PLATFORMS }}
59+
build-args: |
60+
USER=${{ env.USER }}
61+
USER_ID=${{ env.USER_ID }}
62+
USER_GID=${{ env.USER_GID }}
63+
IMG_PYTHON_VERSION=${{ env.IMG_PYTHON_VERSION}}
64+
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
65+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Docker Image Publishing
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
IMAGE_NAME: gnzsnz/jupyter-quant
9+
GH_IMAGE_NAME: ghcr.io/quantbelt/jupyter-quant
10+
PLATFORMS: linux/amd64,linux/arm64
11+
12+
jobs:
13+
publish:
14+
name: Build and test Jupyter Quant
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Get enviroment variables
23+
run: |
24+
grep -v '#' .env-dist | grep '=' > .env
25+
while IFS= read -r line; do
26+
echo $line >> $GITHUB_ENV ;
27+
done < .env
28+
29+
- name: Set up QEMU
30+
uses: docker/setup-qemu-action@v3
31+
with:
32+
platforms: ${{ env.PLATFORMS }}
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
- name: Docker metadata
38+
id: meta
39+
uses: docker/metadata-action@v5
40+
with:
41+
images: |
42+
${{ env.IMAGE_NAME }}
43+
${{ env.GH_IMAGE_NAME }}
44+
flavor: |
45+
latest=true
46+
47+
- name: Login to Docker Hub
48+
uses: docker/login-action@v3
49+
with:
50+
username: ${{ secrets.DOCKERHUB_USERNAME }}
51+
password: ${{ secrets.DOCKERHUB_TOKEN }}
52+
53+
- name: Login to GitHub Container Registry
54+
uses: docker/login-action@v3
55+
with:
56+
registry: ghcr.io
57+
username: ${{ github.repository_owner }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Build and push
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: .
64+
push: true
65+
cache-from: type=gha
66+
cache-to: type=gha,mode=max
67+
build-args: |
68+
USER=${{ env.USER }}
69+
USER_ID=${{ env.USER_ID }}
70+
USER_GID=${{ env.USER_GID }}
71+
IMG_PYTHON_VERSION=${{ env.IMG_PYTHON_VERSION}}
72+
platforms: ${{ env.PLATFORMS }}
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.env
2+
Notebooks/
3+
docker-compose.yml
4+
.python-version
5+
.ipynb_checkpoints/
6+
.virtual_documents/
7+
.DS_Store
8+
*.egg-info
9+
wheels/
10+
build/
11+
dist/

.hadolint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ignored:
2+
- DL3008
3+
- SC2028
4+
- DL3003

.pre-commit-config.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.6.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: check-shebang-scripts-are-executable
12+
- id: check-executables-have-shebangs
13+
- id: requirements-txt-fixer
14+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
15+
rev: 3.0.0
16+
hooks:
17+
- id: shellcheck
18+
- id: shfmt
19+
- repo: https://github.com/hadolint/hadolint
20+
rev: v2.13.0-beta
21+
hooks:
22+
- id: hadolint
23+
- repo: https://github.com/igorshubovych/markdownlint-cli
24+
rev: v0.40.0
25+
hooks:
26+
- id: markdownlint
27+
- repo: https://github.com/python-jsonschema/check-jsonschema
28+
rev: 0.28.3
29+
hooks:
30+
- id: check-github-workflows
31+
- id: check-github-actions
32+
- repo: https://github.com/wemake-services/dotenv-linter
33+
rev: 0.5.0 # Use the ref you want to point at
34+
hooks:
35+
- id: dotenv-linter

0 commit comments

Comments
 (0)