diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9c0c182 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,48 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install build tool + run: python -m pip install --upgrade build + + - name: Build distributions + run: python -m build + + - name: Upload dist artifacts + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish: + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write + + environment: + name: pypi + + steps: + - name: Download dist artifacts + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.md b/README.md index 045c752..2466248 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ [![CI](https://github.com/aga87/python-photo-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/aga87/python-photo-tools/actions) -# Python Photo Tools +# Photo Tools CLI -A command-line tool for organising and processing photos using Python. +Command-line tools for organising photos by date, managing RAW/JPG pairs, and optimising images. ## Supported formats @@ -28,20 +28,21 @@ Install (macOS) brew install exiftool ``` -The application will fail if it is not installed. - -If running in a Docker container, include: - -```Dockerfile -RUN apt-get update && apt-get install -y exiftool -``` +On Linux, install via your package manager (e.g. `apt install exiftool`). ## Installation ### Using pipx (recommended) ```shell -pipx install git+https://github.com/aga87/python-photo-tools.git +pipx install photo-tools-cli +``` +Installs the CLI in an isolated environment and makes `photo-tools` available globally, avoiding dependency conflicts. + +### Using pip (if pipx not available) + +```shell +pip install photo-tools-cli ``` ### Local development @@ -49,7 +50,8 @@ pipx install git+https://github.com/aga87/python-photo-tools.git Clone the repository and install: ```shell -pip install . +pip install -e . +pip install --group dev -e . ``` ## Usage @@ -80,7 +82,7 @@ Flags can be combined: photo-tools ... --dry-run --verbose ``` -### `by-date` +### Organise by date (`by-date`) - Organise images into date-based folders (`YYYY-MM-DD`, optional suffix) - Files are moved (not copied) into the output directory @@ -94,7 +96,7 @@ photo-tools by-date --suffix ``` -### `raws` +### Separate RAW files (`raws`) - Move RAW images into a `raws/` subfolder within the input directory - Non-RAW files are left unchanged @@ -105,7 +107,7 @@ photo-tools by-date --suffix photo-tools raws ``` -### `clean-raws` +### Clean unpaired RAW files (`clean-raws`) - Move RAW files to `raws-to-delete/` if no matching JPG (same prefix) exists - Matching is based on filename prefix (e.g. `abcd.RAF` matches `abcd_edit.jpg`) @@ -115,11 +117,11 @@ photo-tools raws photo-tools clean-raws ``` -### `optimise` +### Optimise images (`optimise`) - Resize images to a maximum width of `2500px` - Choose the highest quality that results in a file size ≤ `500 KB` (never below `70%`) -- Saves optimised images with prefix `lq_` in the same directory (existing files are overwritten) +- Saves optimised images with prefix `lq_` in the same directory (overwrites existing files) ```shell @@ -148,7 +150,7 @@ data/input/ You can run the CLI module directly for testing: ```shell -python -m photo_tools.cli organise-by-date ./data/input ./data/output +python -m photo_tools.cli by-date ./data/input ./data/output ``` ### Running tests diff --git a/pyproject.toml b/pyproject.toml index c77d5b9..11f33a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,9 +3,10 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] -name = "photo-tools" -version = "0.1.0" +name = "photo-tools-cli" +version = "0.1.1" description = "Python CLI tools for photography workflows" +readme = "README.md" requires-python = ">=3.13" dependencies = [ "typer>=0.24,<1.0", @@ -14,7 +15,13 @@ dependencies = [ ] [dependency-groups] -dev = ["pytest>=9,<10", "ruff>=0.15,<1.0", "mypy>=1.19,<2.0", "build>=1.4,<2.0"] +dev = [ + "pytest>=9,<10", + "ruff>=0.15,<1.0", + "mypy>=1.19,<2.0", + "build>=1.4,<2.0", + "twine>=6.2,<7.0", +] [project.scripts] photo-tools = "photo_tools.cli:app"