From 3f4b30c23bd586dadb3c6d9974c63307a67f02af Mon Sep 17 00:00:00 2001 From: Yurij Mikhalevich Date: Wed, 2 Aug 2023 12:32:03 +0400 Subject: [PATCH] feat: add `--version` (#52) --- README.md | 10 +++++++++- appimage-builder.yml | 2 +- appimage_after_bundle.sh | 4 ++-- pyproject.toml | 2 +- rclip/utils.py | 3 +++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 56df9c79..4ecc5137 100644 --- a/README.md +++ b/README.md @@ -29,13 +29,21 @@
- macOS/Windows/Linux (using pip) + macOS or Windows (using pip) ```bash pip install rclip ```
+
+ Linux (using pip) + + ```bash + pip install --extra-index-url https://download.pytorch.org/whl/cpu rclip + ``` +
+ ## Usage ```bash diff --git a/appimage-builder.yml b/appimage-builder.yml index 46587cd4..5a27748f 100644 --- a/appimage-builder.yml +++ b/appimage-builder.yml @@ -22,7 +22,7 @@ AppDir: # Set the python executable as entry point exec: usr/bin/python3.8 # Set the application main script path as argument. Use '$@' to forward CLI parameters - exec_args: "${APPDIR}/usr/src/rclip/main.py $@" + exec_args: "${APPDIR}/usr/bin/rclip $@" apt: arch: amd64 diff --git a/appimage_after_bundle.sh b/appimage_after_bundle.sh index f6a47a58..67c6a460 100755 --- a/appimage_after_bundle.sh +++ b/appimage_after_bundle.sh @@ -6,6 +6,6 @@ PYTHONHOME=$APPDIR/usr \ PYTHONPATH=$APPDIR/usr/lib/python3.8/site-packages:$APPDIR/usr/lib/python3.8 \ LD_LIBRARY_PATH=$APPDIR/usr/lib/x86_64-linux-gnu \ python3.8 -m pip install poetry==1.5.1 && -python3.8 -m poetry export --without-hashes --without dev -f requirements.txt --output requirements.txt && python3.8 -m pip install --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" certifi setuptools wheel && -python3.8 -m pip install --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" -r ./requirements.txt +python3.8 -m poetry build && +python3.8 -m pip install --extra-index-url https://download.pytorch.org/whl/cpu --upgrade --isolated --no-input --ignore-installed --prefix="$APPDIR/usr" dist/*.whl diff --git a/pyproject.toml b/pyproject.toml index b9fb4a20..c435277b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "rclip" -version = "1.4.6" +version = "1.4.7a11" description = "AI-Powered Command-Line Photo Search Tool" authors = ["Yurij Mikhalevich "] license = "MIT" diff --git a/rclip/utils.py b/rclip/utils.py index 8276d639..bdfb489a 100644 --- a/rclip/utils.py +++ b/rclip/utils.py @@ -5,6 +5,7 @@ import re import requests import sys +from importlib.metadata import version MAX_DOWNLOAD_SIZE_BYTES = 50_000_000 @@ -61,6 +62,8 @@ def init_arg_parser() -> argparse.ArgumentParser: ' adding a multiplier is especially useful when combining image and text queries because' ' image queries are usually weighted more than text ones\n', ) + version_str = f'rclip {version("rclip")}' + parser.add_argument('--version', '-v', action='version', version=version_str, help=f'prints "{version_str}"') parser.add_argument('query', help='a text query or a path/URL to an image file') parser.add_argument('--add', '-a', '+', metavar='QUERY', action='append', default=[], help='a text query or a path/URL to an image file to add to the "original" query,'