Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPS-0 use latest python verions #12

Merged
merged 11 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/building.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ 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
run: python -m pip install build setuptools wheel

- name: Build distributions
shell: bash -l {0}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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"=""
Expand Down Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -210,7 +211,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)/ \
'

Expand All @@ -223,6 +224,7 @@ test:
@echo "Check Python package"
docker run \
--rm \
--network=host \
$$(tty -s && echo "-it" || echo) \
-v $(PWD):/data \
-w /data \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
pip install pagey
```

> :exclamation: Requires Python >= 3.6
> :exclamation: Requires Python >= 3.8


## :computer: Usage
Expand Down Expand Up @@ -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)**
5 changes: 1 addition & 4 deletions pagey/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ 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} [option]\n" f"{DEF_NAME} -v, --version\n" f"{DEF_NAME} -h, --help\n"),
description=DEF_DESC
+ """

Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
description-file = README.md
description_file = README.md

[bdist_wheel]
universal=1
Expand Down Expand Up @@ -58,7 +58,6 @@ show_traceback = True

# Mode
strict_optional = True
show_none_errors = True

# Allow
disallow_any_expr = False
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/
#
Expand All @@ -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
Expand Down