Skip to content
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
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -28,28 +28,30 @@ 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

Clone the repository and install:

```shell
pip install .
pip install -e .
pip install --group dev -e .
```

## Usage
Expand Down Expand Up @@ -80,7 +82,7 @@ Flags can be combined:
photo-tools <command> ... --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
Expand All @@ -94,7 +96,7 @@ photo-tools by-date <INPUT_DIR> <OUTPUT_DIR> --suffix <SUFFIX>
```


### `raws`
### Separate RAW files (`raws`)

- Move RAW images into a `raws/` subfolder within the input directory
- Non-RAW files are left unchanged
Expand All @@ -105,7 +107,7 @@ photo-tools by-date <INPUT_DIR> <OUTPUT_DIR> --suffix <SUFFIX>
photo-tools raws <INPUT_DIR>
```

### `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`)
Expand All @@ -115,11 +117,11 @@ photo-tools raws <INPUT_DIR>
photo-tools clean-raws <RAW_DIR> <JPG_DIR>
```

### `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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
Loading