diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index a8200bd..cd3d885 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -13,30 +13,25 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Extract Python version - id: py - run: | - echo "version=$(grep -oP 'target-version\s*=\s*"py\K[0-9]+' pyproject.toml)" >> "$GITHUB_OUTPUT" + - name: Set up Python + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: "3.13.2" - - name: Set up Python - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: "${{ steps.py.outputs.version }}" + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt - - name: Install dependencies - shell: bash - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - name: Run Ruff linting + shell: bash + run: ruff check . - - name: Run Ruff linting - shell: bash - run: ruff check . - - - name: Run tests with coverage - shell: bash - run: | - pytest --cov=aeonview --cov-report=term-missing + - name: Run tests with coverage + shell: bash + run: | + pytest --cov=aeonview --cov-report=term-missing diff --git a/.python-version b/.python-version index 3b564fa..3e388a4 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.11.12 +3.13.2 diff --git a/AGENTS.md b/AGENTS.md index ab7f7c1..4fd092f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## 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). - Use **pre-commit** for linting and testing: - `pre-commit run --files ` diff --git a/README.md b/README.md index ada3ef8..7bab427 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Low quality sample: [aeonview 2min preview/Tampere Jan. 2008][sample] ## Requirements -- Python 3.11+ +- Python 3.13+ - `ffmpeg` and `curl` (system tools) - lots of hard drive space - Optional: `pyenv` for managing Python versions diff --git a/aeonview_test.py b/aeonview_test.py index 8fe358d..300cd09 100644 --- a/aeonview_test.py +++ b/aeonview_test.py @@ -28,9 +28,9 @@ tmp_images = Path(tempfile.gettempdir(), "images") def test_build_path_resolves_correctly(): - base = Path("/tmp") + base = Path(tempfile.gettempdir()) 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(): @@ -62,7 +62,7 @@ def test_get_extension_invalid(): def test_generate_ffmpeg_command(): input_dir = tmp_images - output_file = Path("/tmp/output.mp4") + output_file = Path(tempfile.gettempdir(), "output.mp4") fps = 24 cmd = AeonViewHelpers.generate_ffmpeg_command(input_dir, output_file, fps) assert "ffmpeg" in cmd[0] @@ -73,10 +73,10 @@ def test_generate_ffmpeg_command(): def test_generate_ffmpeg_command_output_format(): 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) - assert "/tmp/images/*.{jpg,jpeg,png,gif,webp}" in cmd - assert "/tmp/video.mp4" in cmd + assert str(tmp_images / "*.{jpg,jpeg,png,gif,webp}") in cmd + assert str(output_file) in cmd assert "-c:v" in cmd assert "libx264" in cmd assert "-pix_fmt" in cmd @@ -86,7 +86,7 @@ def test_generate_ffmpeg_command_output_format(): @mock.patch("subprocess.run") def test_simulate_ffmpeg_call(mock_run): 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) subprocess.run(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) 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"): avi.download_image(destination) @@ -220,7 +220,7 @@ def test_generate_monthly_video_not_implemented(): ) avv = AeonViewVideos(default_test_path, args) with pytest.raises(NotImplementedError): - avv.generate_monthly_video(Path("/tmp")) + avv.generate_monthly_video(Path(tempfile.gettempdir())) def test_generate_yearly_video_not_implemented(): @@ -233,7 +233,7 @@ def test_generate_yearly_video_not_implemented(): ) avv = AeonViewVideos(default_test_path, args) 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", diff --git a/pyproject.toml b/pyproject.toml index cb7d2ba..85de343 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,9 @@ [tool.ruff] line-length = 80 -target-version = "py311" +target-version = "py313" + +[project] +requires-python = ">=3.13.2" [tool.ruff.lint] select = ["E", "F", "I", "B", "UP", "C4", "T20"]