Skip to content

Commit

Permalink
BREAKING CHANGE: drop Python 3.9 support because some libraries, like…
Browse files Browse the repository at this point in the history
… the latest numpy don't support it anymore (#151)
  • Loading branch information
yurijmikhalevich authored Nov 30, 2024
1 parent b4e6ebf commit eaee07c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -52,7 +52,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
echo "${{ secrets.LAUNCHPAD_CREDENTIALS }}" > ~/.local/share/snapcraft/provider/launchpad/credentials
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: '3.10'
- name: Set up Node.js for pyright
uses: actions/setup-node@v4
with:
Expand All @@ -31,15 +31,11 @@ jobs:
test:
strategy:
matrix:
python: ['3.9', '3.10', '3.11', '3.12']
python: ['3.10', '3.11', '3.12']
# macos-13 is amd64, macos-14 is arm64
# skipping macos-13 here because newer versions of torch aren't being built for amd64 macOS anymore
# the brew builds for amd64 macOS are being validated during brew release
os: [ubuntu-22.04, macos-14, windows-2022]
exclude:
# github's setup-python action can't install Python 3.9 on macos-14
- python: '3.9'
os: macos-14
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down
21 changes: 11 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.9 <3.13"
python = ">=3.10 <3.13"
numpy = "^1.26.4"
open_clip_torch = "^2.24.0"
pillow = "^10.3.0"
Expand Down
10 changes: 1 addition & 9 deletions rclip/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,6 @@ def is_mps_available() -> bool:
return False


def remove_prefix(string: str, prefix: str) -> str:
'''
Removes prefix from a string (if present) and returns a new string without a prefix
TODO(yurij): replace with str.removeprefix once updated to Python 3.9+
'''
return string[len(prefix):] if string.startswith(prefix) else string


# See: https://meta.wikimedia.org/wiki/User-Agent_policy
def download_image(url: str) -> Image.Image:
headers = {'User-agent': 'rclip - (https://github.com/yurijmikhalevich/rclip)'}
Expand All @@ -205,7 +197,7 @@ def read_raw_image_file(path: str):


def read_image(query: str) -> Image.Image:
path = remove_prefix(query, 'file://')
path = str.removeprefix(query, 'file://')
try:
file_ext = get_file_extension(path)
if file_ext in IMAGE_RAW_EXT:
Expand Down
16 changes: 8 additions & 8 deletions release-utils/appimage/appimage-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AppDir:
icon: rclip
version: !ENV ${APP_VERSION}
# Set the python executable as entry point
exec: usr/bin/python3.9
exec: usr/bin/python3.10
# Set the application main script path as argument. Use '$@' to forward CLI parameters
exec_args: "${APPDIR}/usr/bin/rclip $@"

Expand All @@ -36,11 +36,11 @@ AppDir:

include:
- libffi7
- libpython3.9-minimal
- libpython3.9-stdlib
- python3.9
- python3.9-distutils
- python3.9-minimal
- libpython3.10-minimal
- libpython3.10-stdlib
- python3.10
- python3.10-distutils
- python3.10-minimal
- python3-pip
exclude: []

Expand All @@ -54,9 +54,9 @@ AppDir:
PYTHONHOME: '${APPDIR}/usr'
# Path to the site-packages dir or other modules dirs
# See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH
PYTHONPATH: '${APPDIR}/usr/src:${APPDIR}/usr/lib/python3.9/site-packages'
PYTHONPATH: '${APPDIR}/usr/src:${APPDIR}/usr/lib/python3.10/site-packages'
# SSL Certificates are placed in a different location for every system therefore we ship our own copy
SSL_CERT_FILE: '${APPDIR}/usr/lib/python3.9/site-packages/certifi/cacert.pem'
SSL_CERT_FILE: '${APPDIR}/usr/lib/python3.10/site-packages/certifi/cacert.pem'

test:
fedora:
Expand Down
14 changes: 7 additions & 7 deletions release-utils/appimage/appimage_after_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -e

PYTHONHOME=$APPDIR/usr \
PYTHONPATH=$APPDIR/usr/lib/python3.9/site-packages:$APPDIR/usr/lib/python3.9 \
PYTHONPATH=$APPDIR/usr/lib/python3.10/site-packages:$APPDIR/usr/lib/python3.10 \
LD_LIBRARY_PATH=$APPDIR/usr/lib/x86_64-linux-gnu \
python3.9 -m pip install poetry==1.8.2 &&
python3.9 -m pip install --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" certifi setuptools wheel &&
python3.9 -m poetry build &&
python3.9 -m poetry export --output requirements.txt &&
python3.9 -m pip install --extra-index-url https://download.pytorch.org/whl/cpu --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" -r requirements.txt &&
python3.9 -m pip install --no-dependencies --isolated --no-input --prefix="$APPDIR/usr" dist/*.whl
python3.10 -m pip install poetry==1.8.4 &&
python3.10 -m pip install --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" certifi setuptools wheel &&
python3.10 -m poetry build &&
python3.10 -m poetry export --output requirements.txt &&
python3.10 -m pip install --extra-index-url https://download.pytorch.org/whl/cpu --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" -r requirements.txt &&
python3.10 -m pip install --no-dependencies --isolated --no-input --prefix="$APPDIR/usr" dist/*.whl

0 comments on commit eaee07c

Please sign in to comment.