fix: update python version and improve cross-platform paths (#6)

This commit is contained in:
2025-07-15 16:53:44 +03:00
committed by GitHub
parent 2ca1e69e35
commit e8c4f458b8
6 changed files with 35 additions and 37 deletions

View File

@@ -13,30 +13,25 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Extract Python version - name: Set up Python
id: py uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
run: | with:
echo "version=$(grep -oP 'target-version\s*=\s*"py\K[0-9]+' pyproject.toml)" >> "$GITHUB_OUTPUT" python-version: "3.13.2"
- name: Set up Python - name: Install dependencies
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 shell: bash
with: run: |
python-version: "${{ steps.py.outputs.version }}" python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install dependencies - name: Run Ruff linting
shell: bash shell: bash
run: | run: ruff check .
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Ruff linting - name: Run tests with coverage
shell: bash shell: bash
run: ruff check . run: |
pytest --cov=aeonview --cov-report=term-missing
- name: Run tests with coverage
shell: bash
run: |
pytest --cov=aeonview --cov-report=term-missing

View File

@@ -1 +1 @@
3.11.12 3.13.2

View File

@@ -2,7 +2,7 @@
## Development Workflow ## Development Workflow
- Use **Python 3.11** as defined in `.python-version`. - Use **Python 3.13** as defined in `.python-version`.
- Install dependencies from `requirements.txt` (virtualenv recommended). - Install dependencies from `requirements.txt` (virtualenv recommended).
- Use **pre-commit** for linting and testing: - Use **pre-commit** for linting and testing:
- `pre-commit run --files <changed files>` - `pre-commit run --files <changed files>`

View File

@@ -26,7 +26,7 @@ Low quality sample: [aeonview 2min preview/Tampere Jan. 2008][sample]
## Requirements ## Requirements
- Python 3.11+ - Python 3.13+
- `ffmpeg` and `curl` (system tools) - `ffmpeg` and `curl` (system tools)
- lots of hard drive space - lots of hard drive space
- Optional: `pyenv` for managing Python versions - Optional: `pyenv` for managing Python versions

View File

@@ -28,9 +28,9 @@ tmp_images = Path(tempfile.gettempdir(), "images")
def test_build_path_resolves_correctly(): def test_build_path_resolves_correctly():
base = Path("/tmp") base = Path(tempfile.gettempdir())
result = AeonViewHelpers.build_path(base, "a", "b", "c") result = AeonViewHelpers.build_path(base, "a", "b", "c")
assert result == Path("/tmp/a/b/c").resolve() assert result == Path(base, "a", "b", "c").resolve()
def test_check_date_valid(): def test_check_date_valid():
@@ -62,7 +62,7 @@ def test_get_extension_invalid():
def test_generate_ffmpeg_command(): def test_generate_ffmpeg_command():
input_dir = tmp_images input_dir = tmp_images
output_file = Path("/tmp/output.mp4") output_file = Path(tempfile.gettempdir(), "output.mp4")
fps = 24 fps = 24
cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, fps) cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, fps)
assert "ffmpeg" in cmd[0] assert "ffmpeg" in cmd[0]
@@ -73,10 +73,10 @@ def test_generate_ffmpeg_command():
def test_generate_ffmpeg_command_output_format(): def test_generate_ffmpeg_command_output_format():
input_dir = tmp_images input_dir = tmp_images
output_file = Path("/tmp/video.mp4") output_file = Path(tempfile.gettempdir(), "video.mp4")
cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, 30) cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, 30)
assert "/tmp/images/*.{jpg,jpeg,png,gif,webp}" in cmd assert str(tmp_images / "*.{jpg,jpeg,png,gif,webp}") in cmd
assert "/tmp/video.mp4" in cmd assert str(output_file) in cmd
assert "-c:v" in cmd assert "-c:v" in cmd
assert "libx264" in cmd assert "libx264" in cmd
assert "-pix_fmt" in cmd assert "-pix_fmt" in cmd
@@ -86,7 +86,7 @@ def test_generate_ffmpeg_command_output_format():
@mock.patch("subprocess.run") @mock.patch("subprocess.run")
def test_simulate_ffmpeg_call(mock_run): def test_simulate_ffmpeg_call(mock_run):
input_dir = tmp_images input_dir = tmp_images
output_file = Path("/tmp/out.mp4") output_file = Path(tempfile.gettempdir(), "out.mp4")
cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, 10) cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, 10)
subprocess.run(cmd, check=True) subprocess.run(cmd, check=True)
mock_run.assert_called_once_with(cmd, check=True) mock_run.assert_called_once_with(cmd, check=True)
@@ -168,7 +168,7 @@ def test_download_image_failure(mock_get):
args = argparse.Namespace(simulate=False) args = argparse.Namespace(simulate=False)
avi = AeonViewImages(default_test_path, f"{default_image_domain}.jpg", args) avi = AeonViewImages(default_test_path, f"{default_image_domain}.jpg", args)
destination = Path("/tmp/image.jpg") destination = Path(tempfile.gettempdir(), "image.jpg")
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error"): with pytest.raises(SystemExit), mock.patch("aeonview.logging.error"):
avi.download_image(destination) avi.download_image(destination)
@@ -220,7 +220,7 @@ def test_generate_monthly_video_not_implemented():
) )
avv = AeonViewVideos(default_test_path, args) avv = AeonViewVideos(default_test_path, args)
with pytest.raises(NotImplementedError): with pytest.raises(NotImplementedError):
avv.generate_monthly_video(Path("/tmp")) avv.generate_monthly_video(Path(tempfile.gettempdir()))
def test_generate_yearly_video_not_implemented(): def test_generate_yearly_video_not_implemented():
@@ -233,7 +233,7 @@ def test_generate_yearly_video_not_implemented():
) )
avv = AeonViewVideos(default_test_path, args) avv = AeonViewVideos(default_test_path, args)
with pytest.raises(NotImplementedError): with pytest.raises(NotImplementedError):
avv.generate_yearly_video(Path("/tmp")) avv.generate_yearly_video(Path(tempfile.gettempdir()))
@mock.patch("sys.argv", ["aeonview.py", "--mode", "image", "--url", @mock.patch("sys.argv", ["aeonview.py", "--mode", "image", "--url",

View File

@@ -1,6 +1,9 @@
[tool.ruff] [tool.ruff]
line-length = 80 line-length = 80
target-version = "py311" target-version = "py313"
[project]
requires-python = ">=3.13.2"
[tool.ruff.lint] [tool.ruff.lint]
select = ["E", "F", "I", "B", "UP", "C4", "T20"] select = ["E", "F", "I", "B", "UP", "C4", "T20"]