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
7 changes: 4 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ ignore=tests, data, venv
ignore-paths=^(.*/)?tests?(/.*)?$

[MESSAGES CONTROL]
# Missing function or method docstring
# Missing class docstring
# Similar lines in 2 files
# Module 'cv2' has no 'rotate' member (no-member)
disable=C0116,C0115,R0801,E1101
disable=missing-function-docstring,
missing-class-docstring,
R0801,
E1101
25 changes: 16 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,15 @@ should be run in **Terminal** window on **macOS**.

#### One-time `uv` Setup

Install the [`uv`](https://github.com/astral-sh/uv) tool one-time to prepare for
**all** Python tools and packages installation. Install
Install the Astral's [`uv`](https://github.com/astral-sh/uv) tool once to prepare for
**all** Python tools and packages installation. Install the Astral's
[`uv`](https://github.com/astral-sh/uv) by its standalone installers:

```
# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
```

After `git clone ...` the repo to your local disk, go to the local project folder
and run the [`uv`](https://github.com/astral-sh/uv) command:

```
uv pip install -e '.[dev]'
```

This will create a hidden virtualenv dir in the local project folder - `.venv` and
install all dependencies defined in the `pyproject.toml` file in this virtualenv.

Expand All @@ -73,6 +66,20 @@ Run the command to activate the development virtualenv:
source .venv/bin/activate
```

#### Install Development Dependencies

Run the command to install all dependencies:

```
uv pip install -e '.[dev]'
```

Optionally, you can create the `requirements.txt` file by command:

```
uv pip compile pyproject.toml -o requirements.txt
```

#### Activate `pre-commit`

The [`pre-commit`](https://pre-commit.com/#installation) tool is installed as part
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Makefile to clean, lint and test with code coverage
# Copyright © 2025 John Liu
# Copyright © 2025 - Present John Liu

PYTHON_FILES = batch_img

Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ folder / directory. Tested working on **macOS** and **Windows**.

### Installation

The `Remove background (make background transparent)` feature depends on `onnxruntime`
library. It's yet to support `Python 3.14`.

#### Requirements

```
Expand All @@ -16,7 +19,7 @@ python: >=3.12, <3.14

#### One-time Setup

Install the Astral's [`uv`](https://github.com/astral-sh/uv) tool one-time to
Install the Astral's [`uv`](https://github.com/astral-sh/uv) tool once to
prepare for **all** Python tools and packages installation. Install the Astral's
[`uv`](https://github.com/astral-sh/uv) by its standalone installers:

Expand Down Expand Up @@ -63,7 +66,7 @@ uv pip install --upgrade batch_img

```
✗ batch_img --version
0.3.5
0.3.6


✗ batch_img auto ~/Documents
Expand All @@ -76,7 +79,8 @@ Auto processed 8/8 files
### Contribution

Contributions are welcome!
Please see the details in [Contribution Guidelines](https://github.com/john-liu2/batch_img/blob/main/CONTRIBUTING.md)
Please see the details
in [Contribution Guidelines](https://github.com/john-liu2/batch_img/blob/main/CONTRIBUTING.md)

### Help

Expand Down
2 changes: 1 addition & 1 deletion batch_img/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""const.py - define constants
Copyright © 2025 John Liu
Copyright © 2025 - Present John Liu
"""

from dataclasses import dataclass
Expand Down
12 changes: 3 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = ["setuptools>=80.0"]

[project]
name = "batch_img"
version = "0.3.5"
version = "0.3.6"
description = "Batch process (resize, rotate, remove background, remove GPS, add border, set transparency, auto do all) image files (HEIC, JPG, PNG)"
readme = "README.md"
authors = [{ name = "John Liu", email = "rim2rim@gmail.com" }]
Expand Down Expand Up @@ -33,7 +33,7 @@ dependencies = [
"piexif",
"pillow",
"pillow-heif",
"rembg",
"rembg", # `remove background` depends on onnxruntime
"tqdm",
]
[project.scripts]
Expand All @@ -46,11 +46,9 @@ Homepage = "https://github.com/john-liu2/batch_img"
[tool.setuptools.packages.find]
include = ["*"]

# Dev config
[project.optional-dependencies]
# uv pip compile pyproject.toml -o requirements.txt
# uv pip install -e '.[dev]'
dev = [
"build", # for python -m build
"pytest-cov", # also install pytest
"black>=25.1.0",
"ruff",
Expand All @@ -73,11 +71,7 @@ lint.select = [
]
lint.ignore = [
"RET504",
"PLR0913",
"PLR0917",
"PLR0904",
"PLR2004", # Magic value used in comparison, consider replacing `3` with a constant variable
"E266", # Too many leading `#` before block comment
]
lint.fixable = ["E", "F", "I", "UP"]
preview = true
Expand Down
8 changes: 4 additions & 4 deletions tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Test common.py
pytest -sv tests/test_common.py
Copyright © 2025 John Liu
Copyright © 2025 - Present John Liu
"""

import json
Expand All @@ -20,7 +20,7 @@
_dir = dirname(__file__)


@pytest.fixture(params=[(PKG_NAME, "0.3.5"), ("", "0.3.5")])
@pytest.fixture(params=[(PKG_NAME, "0.3.6"), ("", "0.3.6")])
def ver_data(request):
return request.param

Expand All @@ -36,7 +36,7 @@ def test_get_version(ver_data):
(
"0.9.9",
PKG_NAME,
f"🔔 Update available: 0.3.5 → 0.9.9\nRun '{PKG_NAME} --update'",
f"🔔 Update available: 0.3.6 → 0.9.9\nRun '{PKG_NAME} --update'",
),
]
)
Expand All @@ -54,7 +54,7 @@ def test_check_latest_version(mock_get_latest_pypi, data_check_latest_version):

@pytest.fixture(
params=[
(PKG_NAME, 0, "0.3.4"),
(PKG_NAME, 0, "0.3.6"),
("bad_bogus", 1, UNKNOWN),
]
)
Expand Down