Skip to content

Commit 117ed52

Browse files
committed
switched to poetry
1 parent 8b6ea89 commit 117ed52

22 files changed

+1435
-476
lines changed

.codecov.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ coverage:
66
threshold: 1.0%
77
base: auto
88
branches:
9-
- main
10-
- dev
9+
- main
10+
- dev

.devcontainer/Dockerfile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
88
ARG NODE_VERSION="none"
99
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
1010

11+
# Poetry
12+
ARG POETRY_VERSION="none"
13+
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
14+
RUN if [ "${POETRY_VERSION}" != "none" ]; then su vscode -c "umask 0002 && pip3 install poetry==${POETRY_VERSION}"; fi
15+
1116
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
12-
COPY requirements.txt /tmp/pip-tmp/
13-
COPY requirements-build.txt /tmp/pip-tmp/
14-
COPY requirements-dev.txt /tmp/pip-tmp/
17+
# COPY requirements.txt /tmp/pip-tmp/
1518

16-
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements-dev.txt \
17-
&& rm -rf /tmp/pip-tmp
19+
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
20+
# && rm -rf /tmp/pip-tmp
1821

1922
# [Optional] Uncomment this section to install additional OS packages.
2023
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

.devcontainer/devcontainer.json

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,32 @@
99
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
1010
// Append -bullseye or -buster to pin to an OS version.
1111
// Use -bullseye variants on local on arm64/Apple Silicon.
12-
"VARIANT": "3.10"
12+
"VARIANT": "3.10",
1313
// Options
14-
// "NODE_VERSION": "lts/*"
14+
// "NODE_VERSION": "lts/*",
15+
"POETRY_VERSION": "1.5.1"
1516
}
1617
},
17-
// "runArgs": [
18-
// "--env-file",
19-
// ".env"
20-
// ],
2118
// Set *default* container specific settings.json values on container create.
2219
"customizations": {
2320
"vscode": {
2421
"settings": {
25-
"python.defaultInterpreterPath": "/usr/local/bin/python",
26-
"python.linting.enabled": true,
27-
"python.linting.flake8Enabled": true,
28-
"python.linting.flake8Args": [
29-
"--max-line-length=79"
30-
],
31-
"python.linting.pylintEnabled": false,
32-
"python.formatting.provider": "autopep8",
33-
"python.formatting.autopep8Args": [
34-
"--in-place",
35-
"--max-line-length=79"
36-
],
37-
"python.testing.pytestEnabled": true,
38-
"python.testing.pytestArgs": [
39-
"tests"
40-
],
41-
"isort.check": true
22+
"python.defaultInterpreterPath": "./.venv/bin/python",
23+
"python.terminal.activateEnvironment": true,
24+
"python.terminal.activateEnvInCurrentTerminal": true
4225
},
4326
// Add the IDs of extensions you want installed when the container is created.
4427
"extensions": [
45-
"ms-python.python",
46-
"njpwerner.autodocstring"
28+
"ms-python.python"
4729
]
4830
}
4931
},
5032
// Use 'forwardPorts' to make a list of ports inside the container available locally.
51-
// "forwardPorts": [],
33+
"forwardPorts": [
34+
8000
35+
],
5236
// Use 'postCreateCommand' to run commands after the container is created.
53-
"postCreateCommand": "pre-commit install --install-hooks",
37+
"postCreateCommand": "poetry install && poetry run pre-commit install --install-hooks",
5438
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
5539
"remoteUser": "vscode",
5640
"features": {

.dockerignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
__pycache__
2-
*/.env
3-
*/config.ini
4-
*/scanner.log
1+
**/__pycache__/
2+
**/config.ini
3+
**/scanner.log

.github/dependabot.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "pip" # See documentation for possible values
9-
directory: "/" # Location of package manifests
10-
schedule:
11-
interval: "daily"
12-
target-branch: "dev"
13-
assignees:
14-
- "Der-Henning"
8+
- package-ecosystem: pip # See documentation for possible values
9+
directory: / # Location of package manifests
10+
schedule:
11+
interval: daily
12+
target-branch: dev
13+
assignees:
14+
- Der-Henning

.github/workflows/codeql.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
pull_request:
66
schedule:
7-
- cron: "0 1 * * *"
7+
- cron: 0 1 * * *
88

99
jobs:
1010
code-ql:
@@ -15,8 +15,8 @@ jobs:
1515
contents: read
1616
security-events: write
1717
steps:
18-
- uses: actions/checkout@v3
19-
- uses: github/codeql-action/init@v2
20-
with:
21-
languages: "python"
22-
- uses: github/codeql-action/analyze@v2
18+
- uses: actions/checkout@v3
19+
- uses: github/codeql-action/init@v2
20+
with:
21+
languages: python
22+
- uses: github/codeql-action/analyze@v2

.github/workflows/release.yml

Lines changed: 85 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,104 @@ name: Releases
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
tags:
8-
- v*
8+
- v*
99
jobs:
1010
docker-images:
1111
name: Build Docker Images
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
1515
include:
16-
- base: slim
17-
tag: ""
18-
file: ./Dockerfile
19-
context: ./
20-
- base: alpine
21-
tag: -alpine
22-
file: ./Dockerfile.alpine
23-
context: ./
16+
- base: slim
17+
tag: ''
18+
file: ./Dockerfile
19+
context: ./
20+
- base: alpine
21+
tag: -alpine
22+
file: ./Dockerfile.alpine
23+
context: ./
2424
steps:
25-
- uses: actions/checkout@v3
26-
- uses: docker/metadata-action@v4
27-
id: meta
28-
with:
29-
images: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
30-
flavor: |
31-
suffix=${{ matrix.tag }},onlatest=true
32-
tags: |
33-
type=edge,branch=main,suffix=${{ matrix.tag }}
34-
type=semver,pattern=v{{version}}
35-
type=semver,pattern=v{{major}}.{{minor}}
36-
type=semver,pattern=v{{major}}
37-
- uses: docker/login-action@v2
38-
with:
39-
username: ${{ secrets.DOCKER_USERNAME }}
40-
password: ${{ secrets.DOCKER_PASSWORD }}
41-
- uses: docker/setup-qemu-action@v2
42-
- uses: docker/setup-buildx-action@v2
43-
id: buildx
44-
- uses: docker/build-push-action@v3
45-
with:
46-
context: ${{ matrix.context }}
47-
file: ${{ matrix.file }}
48-
platforms: linux/arm64, linux/amd64, linux/arm/v7, linux/386, linux/arm/v6
49-
push: true
50-
tags: ${{ steps.meta.outputs.tags }}
51-
labels: ${{ steps.meta.outputs.labels }}
52-
- uses: peter-evans/dockerhub-description@v3
53-
with:
54-
username: ${{ secrets.DOCKER_USERNAME }}
55-
password: ${{ secrets.DOCKER_PASSWORD }}
56-
repository: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
57-
short-description: ${{ github.event.repository.description }}
58-
readme-filepath: ./DOCKER_README.md
25+
- uses: actions/checkout@v3
26+
- uses: docker/metadata-action@v4
27+
id: meta
28+
with:
29+
images: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
30+
flavor: |
31+
suffix=${{ matrix.tag }},onlatest=true
32+
tags: |
33+
type=edge,branch=main,suffix=${{ matrix.tag }}
34+
type=semver,pattern=v{{version}}
35+
type=semver,pattern=v{{major}}.{{minor}}
36+
type=semver,pattern=v{{major}}
37+
- uses: docker/login-action@v2
38+
with:
39+
username: ${{ secrets.DOCKER_USERNAME }}
40+
password: ${{ secrets.DOCKER_PASSWORD }}
41+
- uses: docker/setup-qemu-action@v2
42+
- uses: docker/setup-buildx-action@v2
43+
id: buildx
44+
- uses: docker/build-push-action@v3
45+
with:
46+
context: ${{ matrix.context }}
47+
file: ${{ matrix.file }}
48+
platforms: linux/arm64, linux/amd64, linux/arm/v7, linux/386, linux/arm/v6
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
- uses: peter-evans/dockerhub-description@v3
53+
with:
54+
username: ${{ secrets.DOCKER_USERNAME }}
55+
password: ${{ secrets.DOCKER_PASSWORD }}
56+
repository: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}
57+
short-description: ${{ github.event.repository.description }}
58+
readme-filepath: ./DOCKER_README.md
5959
releases:
6060
name: Build Release Files
6161
runs-on: ${{ matrix.os }}
6262
strategy:
6363
matrix:
6464
include:
65-
- os: ubuntu-latest
66-
tag: linux
67-
- os: windows-latest
68-
tag: win
69-
- os: macos-latest
70-
tag: macos
65+
- os: ubuntu-latest
66+
tag: linux
67+
- os: windows-latest
68+
tag: win
69+
- os: macos-latest
70+
tag: macos
7171
steps:
72-
- uses: actions/checkout@v3
73-
- uses: actions/setup-python@v4
74-
with:
75-
python-version: "3.10"
76-
- name: Install dependencies
77-
run: pip install -r requirements-build.txt
78-
- name: Run PyInstaller
79-
run: |
80-
pyinstaller scanner.spec
81-
cp ./src/config.sample.ini ./dist/config.ini
82-
cp ./README.md ./dist/README.md
83-
cp ./LICENSE ./dist/LICENSE
84-
- name: Make filename for archive
85-
id: filename
86-
shell: bash
87-
run: echo "FILENAME=scanner-${{ github.ref_name }}-${{ matrix.tag }}.zip" >> $GITHUB_OUTPUT
88-
- name: Zip files (linux/macos)
89-
if: matrix.tag == 'linux' || matrix.tag == 'macos'
90-
run: zip -j ./${{ steps.filename.outputs.FILENAME }} ./dist/*
91-
- name: Zip files (win)
92-
if: matrix.tag == 'win'
93-
run: Compress-Archive ./dist/* ./${{ steps.filename.outputs.FILENAME }}
94-
- name: Upload archive
95-
uses: actions/upload-artifact@v3
96-
with:
97-
name: releases
98-
path: ./${{ steps.filename.outputs.FILENAME }}
99-
- name: Add archive to release
100-
uses: softprops/action-gh-release@v1
101-
if: github.ref_type == 'tag'
102-
with:
103-
files: ./${{ steps.filename.outputs.FILENAME }}
72+
- uses: actions/checkout@v3
73+
- uses: actions/setup-python@v4
74+
with:
75+
python-version: '3.10'
76+
- uses: abatilo/actions-poetry@v2
77+
with:
78+
poetry-version: 1.5.1
79+
- name: Install dependencies
80+
run: poetry install --without test
81+
- name: Run PyInstaller
82+
run: |
83+
poetry run pyinstaller scanner.spec
84+
cp ./src/config.sample.ini ./dist/config.ini
85+
cp ./README.md ./dist/README.md
86+
cp ./LICENSE ./dist/LICENSE
87+
- name: Make filename for archive
88+
id: filename
89+
shell: bash
90+
run: echo "FILENAME=scanner-${{ github.ref_name }}-${{ matrix.tag }}.zip" >> $GITHUB_OUTPUT
91+
- name: Zip files (linux/macos)
92+
if: matrix.tag == 'linux' || matrix.tag == 'macos'
93+
run: zip -j ./${{ steps.filename.outputs.FILENAME }} ./dist/*
94+
- name: Zip files (win)
95+
if: matrix.tag == 'win'
96+
run: Compress-Archive ./dist/* ./${{ steps.filename.outputs.FILENAME }}
97+
- name: Upload archive
98+
uses: actions/upload-artifact@v3
99+
with:
100+
name: releases
101+
path: ./${{ steps.filename.outputs.FILENAME }}
102+
- name: Add archive to release
103+
uses: softprops/action-gh-release@v1
104+
if: github.ref_type == 'tag'
105+
with:
106+
files: ./${{ steps.filename.outputs.FILENAME }}

.github/workflows/tests.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
13-
python: ["3.9", "3.10", "3.11"]
12+
os: [ubuntu-latest, windows-latest, macos-latest]
13+
python: ['3.9', '3.10', '3.11']
1414
steps:
15-
- uses: actions/checkout@v3
16-
- uses: actions/setup-python@v4
17-
with:
18-
python-version: ${{ matrix.python }}
19-
- name: Install dependencies
20-
run: |
21-
pip install -r requirements.txt
22-
pip install pytest-cov pytest-mock responses pre-commit
23-
- name: Run linting
24-
run: pre-commit run -a
25-
- name: Run tests
26-
run: python -m pytest -v -m "not tgtg_api" --cov src/ --cov-report=xml
27-
- uses: codecov/codecov-action@v3
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: ${{ matrix.python }}
19+
- uses: abatilo/actions-poetry@v2
20+
with:
21+
poetry-version: 1.5.1
22+
- name: Install dependencies
23+
run: poetry install --without build
24+
- name: Run linting
25+
run: poetry run pre-commit run -a
26+
- name: Run tests
27+
run: poetry run pytest -v -m "not tgtg_api" --cov src/ --cov-report=xml
28+
- uses: codecov/codecov-action@v3

0 commit comments

Comments
 (0)