From ede8bd38af0c47c122d61f53eaae240913e461d8 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Thu, 6 Jun 2024 12:19:13 +0200 Subject: [PATCH 01/11] OPS-0 Remove obsolete python versions. Add python 3.10-12 --- .github/workflows/building.yml | 5 +++-- .github/workflows/testing.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/building.yml b/.github/workflows/building.yml index 31a4713..b72b768 100644 --- a/.github/workflows/building.yml +++ b/.github/workflows/building.yml @@ -19,10 +19,11 @@ jobs: fail-fast: False matrix: version: - - '3.6' - - '3.7' - '3.8' - '3.9' + - '3.10' + - '3.11' + - '3.12' name: "[${{ matrix.version }}]" steps: diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0c7e4c1..390ebf9 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -19,10 +19,11 @@ jobs: fail-fast: False matrix: version: - - '3.6' - - '3.7' - '3.8' - '3.9' + - '3.10' + - '3.11' + - '3.12' name: "[${{ matrix.version }}]" steps: From e1ccb7c561581f23dab9b11b7c9522c650fcc036 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Thu, 6 Jun 2024 12:23:02 +0200 Subject: [PATCH 02/11] OPS-0 Use python3.12 for pypi actions --- .github/workflows/pypi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 35e1099..8b96ba0 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up Python 3.8 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install build dependencies run: python -m pip install build wheel From c4db1f8848a2e172b3f38b683bf6c9acd3e54ee2 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Thu, 6 Jun 2024 12:24:51 +0200 Subject: [PATCH 03/11] OPS-0 Update docs --- README.md | 4 ++-- setup.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 44e1d99..c36352b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ pip install pagey ``` -> :exclamation: Requires Python >= 3.6 +> :exclamation: Requires Python >= 3.8 ## :computer: Usage @@ -72,4 +72,4 @@ See [doc/](doc/) directory for how to configure Slack **[MIT License](LICENSE.txt)** -Copyright (c) 2021 **[Flaconi](https://github.com/Flaconi)** +Copyright (c) 2021-2024 **[Flaconi](https://github.com/Flaconi)** diff --git a/setup.py b/setup.py index 3839730..15d420b 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ "Source Code": "https://github.com/Flaconi/slackbot-pagey", "Bug Tracker": "https://github.com/Flaconi/slackbot-pagey", }, - python_requires=">=3.6", + python_requires=">=3.8", classifiers=[ # https://pypi.org/classifiers/ # @@ -55,10 +55,11 @@ # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", # Project topics From b942f32975b6e20b24c146f91740ac9c3fb07647 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 13:34:38 +0200 Subject: [PATCH 04/11] OPS-0 Add missing package --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index aab50f2..6a70deb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ python-dateutil requests +setuptools slackclient==1.3.2 From 9cc7c9655e6621ff610cee6b3a57e9671460610c Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 13:34:56 +0200 Subject: [PATCH 05/11] OPS-0 Update base image --- Dockerfile | 6 +++--- Makefile | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 532d66b..e8cbbf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-alpine3.13 as builder +FROM python:3.12-alpine3.20 as builder COPY ./ /data RUN set -eux \ @@ -11,8 +11,8 @@ RUN set -eux \ && find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -rf -# 3.14 uses Python 3.9 as default -FROM alpine:3.14 as production +# 3.20 uses Python 3.12 as default +FROM alpine:3.20 as production # https://github.com/opencontainers/image-spec/blob/master/annotations.md #LABEL "org.opencontainers.image.created"="" #LABEL "org.opencontainers.image.version"="" diff --git a/Makefile b/Makefile index 0a03ee6..7464c2b 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,9 @@ endif # Can be changed # ------------------------------------------------------------------------------------------------- # This can be adjusted -PYTHON_VERSION = 3.8 -PYLINT_VERSION = latest-0.6 -MYPY_VERSION = latest-0.4 +PYTHON_VERSION = 3.12 +PYLINT_VERSION = latest-0.8 +MYPY_VERSION = latest-py3.10 # ------------------------------------------------------------------------------------------------- # Default configuration @@ -27,7 +27,7 @@ IMAGE = flaconi/slackbot-pagey TAG = latest -FL_VERSION = 0.4 +FL_VERSION = latest-0.8 FL_IGNORES = .git/,.github/,$(NAME).egg-info,.mypy_cache/,$(ENV) From 55b914e4945dbfbc31e196d26fc76791812832b2 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 13:38:46 +0200 Subject: [PATCH 06/11] OPS-0 Add missing package --- .github/workflows/pypi.yml | 2 +- requirements.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 8b96ba0..2b7454f 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -23,7 +23,7 @@ jobs: python-version: 3.12 - name: Install build dependencies - run: python -m pip install build wheel + run: python -m pip install build setuptools wheel - name: Build distributions shell: bash -l {0} diff --git a/requirements.txt b/requirements.txt index 6a70deb..aab50f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ python-dateutil requests -setuptools slackclient==1.3.2 From e2b046cbc29ae48aed9c9b57f28a14901263a7c8 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 15:45:53 +0200 Subject: [PATCH 07/11] OPS-0 Fix obsolete field --- setup.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 3e8f14c..d63c7ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -description-file = README.md +description_file = README.md [bdist_wheel] universal=1 @@ -58,7 +58,6 @@ show_traceback = True # Mode strict_optional = True -show_none_errors = True # Allow disallow_any_expr = False From 32d2bc09faa87da4fbb26f6302a42ab3a798223f Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 16:19:52 +0200 Subject: [PATCH 08/11] OPS-0 mypy dependencies --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7464c2b..2ee85f0 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ _code-mypy: --entrypoint=sh \ cytopia/mypy:$(MYPY_VERSION) -c ' \ python -m pip install -r requirements.txt \ - && yes | mypy --config-file setup.cfg --install-types $(SRC)/ 2>&1 >/dev/null \ + && python -m pip install types-python-dateutil types-requests \ && mypy --config-file setup.cfg $(SRC)/ \ ' From 13cb636bd25927d0043282009a04be0592931708 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 16:23:49 +0200 Subject: [PATCH 09/11] OPS-0 fix path for docker --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e8cbbf9..ce06bec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ RUN set -eux \ && find /usr/lib/ -name '*.pyc' -print0 | xargs -0 -n1 rm -f \ && find /usr/lib/ -name '__pycache__' -print0 | xargs -0 -n1 rm -rf -COPY --from=builder /usr/local/lib/python3.9/site-packages/ /usr/lib/python3.9/site-packages/ +COPY --from=builder /usr/local/lib/python3.12/site-packages/ /usr/lib/python3.12/site-packages/ COPY --from=builder /usr/local/bin/pagey /usr/bin/pagey USER pagey From a8fa34f61ddc11fcc22ceb66d2ce16a6801e6b3a Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 16:55:47 +0200 Subject: [PATCH 10/11] OPS-0 fix lint --- Makefile | 4 +++- pagey/args.py | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2ee85f0..656630c 100644 --- a/Makefile +++ b/Makefile @@ -182,7 +182,8 @@ _code-pylint: -v $(PWD):/data \ --entrypoint=sh \ cytopia/pylint:$(PYLINT_VERSION) -c '\ - pip3 install -r requirements.txt \ + apk add py3-pip \ + && pip3 install -r requirements.txt \ && pylint --rcfile=setup.cfg $(SRC)/' .PHONY: _code-black @@ -223,6 +224,7 @@ test: @echo "Check Python package" docker run \ --rm \ + --network=host \ $$(tty -s && echo "-it" || echo) \ -v $(PWD):/data \ -w /data \ diff --git a/pagey/args.py b/pagey/args.py index b3fd676..56b9d81 100644 --- a/pagey/args.py +++ b/pagey/args.py @@ -18,10 +18,11 @@ def get_args() -> argparse.Namespace: parser = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter, add_help=False, - usage="""%(prog)s - %(prog)s -v, --version - %(prog)s -h, --help""" - % ({"prog": DEF_NAME}), + usage=( + f"{DEF_NAME}\n" + f"{DEF_NAME} -v, --version\n" + f"{DEF_NAME} -h, --help\n" + ), description=DEF_DESC + """ From 25ae1b1715eb71652359afe6b463e7b48eab1727 Mon Sep 17 00:00:00 2001 From: Sergey Novikov Date: Mon, 17 Jun 2024 17:01:36 +0200 Subject: [PATCH 11/11] OPS-0 fix formatting --- pagey/args.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pagey/args.py b/pagey/args.py index 56b9d81..9995d89 100644 --- a/pagey/args.py +++ b/pagey/args.py @@ -18,11 +18,7 @@ def get_args() -> argparse.Namespace: parser = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter, add_help=False, - usage=( - f"{DEF_NAME}\n" - f"{DEF_NAME} -v, --version\n" - f"{DEF_NAME} -h, --help\n" - ), + usage=(f"{DEF_NAME} [option]\n" f"{DEF_NAME} -v, --version\n" f"{DEF_NAME} -h, --help\n"), description=DEF_DESC + """