Skip to content

Commit

Permalink
Merge pull request #39 from pppontusw/refactoring-new-api-version
Browse files Browse the repository at this point in the history
Refactoring new api version
  • Loading branch information
pppontusw authored Apr 21, 2024
2 parents c895426 + 5e223fb commit f9a9a6f
Show file tree
Hide file tree
Showing 62 changed files with 590 additions and 22,472 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/build-and-publish-wheel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and publish wheel

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build package
run: |
python setup.py sdist bdist_wheel
- name: Upload package to GitHub Releases
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GH_TOKEN }}
files: dist/*
45 changes: 45 additions & 0 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and push docker image

on:
push:
tags:
- 'v*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
41 changes: 41 additions & 0 deletions .github/workflows/lint-and-test-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint and test python package

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.dev.txt
- name: Check format
run: |
make format-check
- name: Check typing
run: |
make type
- name: Lint with pylint
run: |
make lint
- name: Test with pytest
run: |
make test
41 changes: 0 additions & 41 deletions .github/workflows/pythonpackage.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ dumps/
coverage.xml
app.db
debug/
venv
media/
nhltv.egg-info
dist/
97 changes: 7 additions & 90 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,87 +60,12 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
missing-docstring,
invalid-name
disable=missing-module-docstring,
missing-function-docstring,
missing-class-docstring,
unspecified-encoding,
invalid-name,
fixme,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -328,13 +253,6 @@ max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down Expand Up @@ -568,5 +486,4 @@ min-public-methods=2

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.Exception
2 changes: 1 addition & 1 deletion Docker-compose.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3'
services:
nhltv:
restart: always
image: pontusw/nhltv:latest
image: ghcr.io/pppontusw/dl-nhltv:latest
environment:
- PYTHONUNBUFFERED=1
volumes:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.8-alpine3.10
FROM python:3.12-slim-bookworm

COPY requirements.txt requirements.txt
RUN apk add --update python3 python3-dev gcc aria2 ffmpeg openssl musl-dev
RUN apt-get update && apt-get install ffmpeg -y
RUN pip3 install -r requirements.txt

RUN adduser -D nhltv
RUN adduser --home /home/nhltv nhltv

WORKDIR /home/nhltv

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ test:
python -m pytest -v

lint:
- pylint nhltv_lib tests --disable=bad-continuation
- python -m flake8 nhltv_lib/ tests/ --exclude=alembic
- pylint nhltv_lib tests

format:
black nhltv_lib tests --config black.toml

format-check:
black nhltv_lib tests --config black.toml

coverage:
python -m pytest --cov=nhltv_lib --cov-report=term-missing --cov-report=html
Expand Down
Loading

0 comments on commit f9a9a6f

Please sign in to comment.