diff options
| author | Aeliton G. Silva | 2026-01-12 22:39:55 -0300 |
|---|---|---|
| committer | Aeliton G. Silva | 2026-01-13 04:22:25 -0300 |
| commit | f975144f25d34f97329b2d4e52891061573cea08 (patch) | |
| tree | 226fe223b31af6f217b1dd413629ab2cf26964d4 /src | |
| parent | b8703752ffc7768b0275897b3c2a869ff41504e5 (diff) | |
Use pyproject.toml + uv_build
This replaces setup.py by a modern pyproject.toml using uv_build
backend.
Dependencies are being also managed by uv, so to install dependencies
and run the project one can execute:
```
uv sync
uv run pytest # optional
python -m avp
```
To build the both source and binary (wheel) distribution package run:
```
uv build
```
Uv can be installed with `pip install uv`.
The directory structure has been changed to reflect best practices.
- src/* -> src/avp/
- src/tests -> ../tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/avp/__init__.py (renamed from src/__init__.py) | 0 | ||||
| -rw-r--r-- | src/avp/__main__.py | 8 | ||||
| -rw-r--r-- | src/avp/cli.py (renamed from src/__main__.py) | 2 | ||||
| -rw-r--r-- | src/avp/command.py (renamed from src/command.py) | 0 | ||||
| -rw-r--r-- | src/avp/component.py (renamed from src/component.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/__init__.py (renamed from src/components/__init__.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/__template__.ui (renamed from src/components/__template__.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/color.py (renamed from src/components/color.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/color.ui (renamed from src/components/color.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/image.py (renamed from src/components/image.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/image.ui (renamed from src/components/image.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/life.py (renamed from src/components/life.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/life.ui (renamed from src/components/life.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/original.py (renamed from src/components/original.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/original.ui (renamed from src/components/original.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/sound.py (renamed from src/components/sound.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/sound.ui (renamed from src/components/sound.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/spectrum.py (renamed from src/components/spectrum.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/spectrum.ui (renamed from src/components/spectrum.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/text.py (renamed from src/components/text.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/text.ui (renamed from src/components/text.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/video.py (renamed from src/components/video.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/video.ui (renamed from src/components/video.ui) | 0 | ||||
| -rw-r--r-- | src/avp/components/waveform.py (renamed from src/components/waveform.py) | 0 | ||||
| -rw-r--r-- | src/avp/components/waveform.ui (renamed from src/components/waveform.ui) | 0 | ||||
| -rw-r--r-- | src/avp/core.py (renamed from src/core.py) | 0 | ||||
| -rw-r--r-- | src/avp/encoder-options.json (renamed from src/encoder-options.json) | 0 | ||||
| -rw-r--r-- | src/avp/gui/__init__.py (renamed from src/gui/__init__.py) | 0 | ||||
| -rw-r--r-- | src/avp/gui/actions.py (renamed from src/gui/actions.py) | 0 | ||||
| -rw-r--r-- | src/avp/gui/background.png (renamed from src/gui/background.png) | bin | 45367 -> 45367 bytes | |||
| -rw-r--r-- | src/avp/gui/mainwindow.py (renamed from src/gui/mainwindow.py) | 0 | ||||
| -rw-r--r-- | src/avp/gui/mainwindow.ui (renamed from src/gui/mainwindow.ui) | 0 | ||||
| -rw-r--r-- | src/avp/gui/presetmanager.py (renamed from src/gui/presetmanager.py) | 0 | ||||
| -rw-r--r-- | src/avp/gui/presetmanager.ui (renamed from src/gui/presetmanager.ui) | 0 | ||||
| -rw-r--r-- | src/avp/gui/preview_thread.py (renamed from src/gui/preview_thread.py) | 0 | ||||
| -rw-r--r-- | src/avp/gui/preview_win.py (renamed from src/gui/preview_win.py) | 0 | ||||
| -rw-r--r-- | src/avp/toolkit/__init__.py (renamed from src/toolkit/__init__.py) | 0 | ||||
| -rw-r--r-- | src/avp/toolkit/common.py (renamed from src/toolkit/common.py) | 0 | ||||
| -rw-r--r-- | src/avp/toolkit/ffmpeg.py (renamed from src/toolkit/ffmpeg.py) | 0 | ||||
| -rw-r--r-- | src/avp/toolkit/frame.py (renamed from src/toolkit/frame.py) | 0 | ||||
| -rw-r--r-- | src/avp/video_thread.py (renamed from src/video_thread.py) | 0 | ||||
| -rw-r--r-- | src/tests/__init__.py | 27 | ||||
| -rw-r--r-- | src/tests/data/test.jpg | bin | 48766 -> 0 bytes | |||
| -rw-r--r-- | src/tests/data/test.ogg | bin | 30043 -> 0 bytes | |||
| -rw-r--r-- | src/tests/data/test.png | bin | 220 -> 0 bytes | |||
| -rw-r--r-- | src/tests/test_commandline_export.py | 39 | ||||
| -rw-r--r-- | src/tests/test_commandline_parser.py | 45 | ||||
| -rw-r--r-- | src/tests/test_core_init.py | 21 |
48 files changed, 9 insertions, 133 deletions
diff --git a/src/__init__.py b/src/avp/__init__.py index ee9bebb..ee9bebb 100644 --- a/src/__init__.py +++ b/src/avp/__init__.py diff --git a/src/avp/__main__.py b/src/avp/__main__.py new file mode 100644 index 0000000..a27bb88 --- /dev/null +++ b/src/avp/__main__.py @@ -0,0 +1,8 @@ +import sys +from avp.cli import main +if __name__ == "__main__": + if sys.argv[0].endswith("-script.pyw"): + sys.argv[0] = sys.argv[0][:-11] + elif sys.argv[0].endswith(".exe"): + sys.argv[0] = sys.argv[0][:-4] + sys.exit(main()) diff --git a/src/__main__.py b/src/avp/cli.py index db48788..02ceee6 100644 --- a/src/__main__.py +++ b/src/avp/cli.py @@ -51,7 +51,7 @@ def main() -> int: # Both branches here may occur in one execution: # Commandline parsing could change mode back to GUI if mode == "GUI": - from .gui.mainwindow import MainWindow + from avp.gui.mainwindow import MainWindow mainWindow = MainWindow(proj, dpi) log.debug("Finished creating MainWindow") diff --git a/src/command.py b/src/avp/command.py index 783ac26..783ac26 100644 --- a/src/command.py +++ b/src/avp/command.py diff --git a/src/component.py b/src/avp/component.py index 01d4e44..01d4e44 100644 --- a/src/component.py +++ b/src/avp/component.py diff --git a/src/components/__init__.py b/src/avp/components/__init__.py index 8b13789..8b13789 100644 --- a/src/components/__init__.py +++ b/src/avp/components/__init__.py diff --git a/src/components/__template__.ui b/src/avp/components/__template__.ui index 301a2b7..301a2b7 100644 --- a/src/components/__template__.ui +++ b/src/avp/components/__template__.ui diff --git a/src/components/color.py b/src/avp/components/color.py index 1f32c23..1f32c23 100644 --- a/src/components/color.py +++ b/src/avp/components/color.py diff --git a/src/components/color.ui b/src/avp/components/color.ui index c1713fb..c1713fb 100644 --- a/src/components/color.ui +++ b/src/avp/components/color.ui diff --git a/src/components/image.py b/src/avp/components/image.py index 2393611..2393611 100644 --- a/src/components/image.py +++ b/src/avp/components/image.py diff --git a/src/components/image.ui b/src/avp/components/image.ui index 2dad127..2dad127 100644 --- a/src/components/image.ui +++ b/src/avp/components/image.ui diff --git a/src/components/life.py b/src/avp/components/life.py index 5b719d1..5b719d1 100644 --- a/src/components/life.py +++ b/src/avp/components/life.py diff --git a/src/components/life.ui b/src/avp/components/life.ui index 30cf9d0..30cf9d0 100644 --- a/src/components/life.ui +++ b/src/avp/components/life.ui diff --git a/src/components/original.py b/src/avp/components/original.py index fad797b..fad797b 100644 --- a/src/components/original.py +++ b/src/avp/components/original.py diff --git a/src/components/original.ui b/src/avp/components/original.ui index c7b7e22..c7b7e22 100644 --- a/src/components/original.ui +++ b/src/avp/components/original.ui diff --git a/src/components/sound.py b/src/avp/components/sound.py index 2df8e38..2df8e38 100644 --- a/src/components/sound.py +++ b/src/avp/components/sound.py diff --git a/src/components/sound.ui b/src/avp/components/sound.ui index 4c11332..4c11332 100644 --- a/src/components/sound.ui +++ b/src/avp/components/sound.ui diff --git a/src/components/spectrum.py b/src/avp/components/spectrum.py index 062ebc7..062ebc7 100644 --- a/src/components/spectrum.py +++ b/src/avp/components/spectrum.py diff --git a/src/components/spectrum.ui b/src/avp/components/spectrum.ui index c6a8a15..c6a8a15 100644 --- a/src/components/spectrum.ui +++ b/src/avp/components/spectrum.ui diff --git a/src/components/text.py b/src/avp/components/text.py index 40c981a..40c981a 100644 --- a/src/components/text.py +++ b/src/avp/components/text.py diff --git a/src/components/text.ui b/src/avp/components/text.ui index b62e0ed..b62e0ed 100644 --- a/src/components/text.ui +++ b/src/avp/components/text.ui diff --git a/src/components/video.py b/src/avp/components/video.py index 65a05af..65a05af 100644 --- a/src/components/video.py +++ b/src/avp/components/video.py diff --git a/src/components/video.ui b/src/avp/components/video.ui index 08d15d3..08d15d3 100644 --- a/src/components/video.ui +++ b/src/avp/components/video.ui diff --git a/src/components/waveform.py b/src/avp/components/waveform.py index 7dc0b99..7dc0b99 100644 --- a/src/components/waveform.py +++ b/src/avp/components/waveform.py diff --git a/src/components/waveform.ui b/src/avp/components/waveform.ui index 5473f33..5473f33 100644 --- a/src/components/waveform.ui +++ b/src/avp/components/waveform.ui diff --git a/src/core.py b/src/avp/core.py index df6ff63..df6ff63 100644 --- a/src/core.py +++ b/src/avp/core.py diff --git a/src/encoder-options.json b/src/avp/encoder-options.json index 78bc940..78bc940 100644 --- a/src/encoder-options.json +++ b/src/avp/encoder-options.json diff --git a/src/gui/__init__.py b/src/avp/gui/__init__.py index e69de29..e69de29 100644 --- a/src/gui/__init__.py +++ b/src/avp/gui/__init__.py diff --git a/src/gui/actions.py b/src/avp/gui/actions.py index 654b2a0..654b2a0 100644 --- a/src/gui/actions.py +++ b/src/avp/gui/actions.py diff --git a/src/gui/background.png b/src/avp/gui/background.png Binary files differindex fb58593..fb58593 100644 --- a/src/gui/background.png +++ b/src/avp/gui/background.png diff --git a/src/gui/mainwindow.py b/src/avp/gui/mainwindow.py index b0a564b..b0a564b 100644 --- a/src/gui/mainwindow.py +++ b/src/avp/gui/mainwindow.py diff --git a/src/gui/mainwindow.ui b/src/avp/gui/mainwindow.ui index cd8454d..cd8454d 100644 --- a/src/gui/mainwindow.ui +++ b/src/avp/gui/mainwindow.ui diff --git a/src/gui/presetmanager.py b/src/avp/gui/presetmanager.py index 980a969..980a969 100644 --- a/src/gui/presetmanager.py +++ b/src/avp/gui/presetmanager.py diff --git a/src/gui/presetmanager.ui b/src/avp/gui/presetmanager.ui index 5257b1c..5257b1c 100644 --- a/src/gui/presetmanager.ui +++ b/src/avp/gui/presetmanager.ui diff --git a/src/gui/preview_thread.py b/src/avp/gui/preview_thread.py index 1d78516..1d78516 100644 --- a/src/gui/preview_thread.py +++ b/src/avp/gui/preview_thread.py diff --git a/src/gui/preview_win.py b/src/avp/gui/preview_win.py index f52f8a3..f52f8a3 100644 --- a/src/gui/preview_win.py +++ b/src/avp/gui/preview_win.py diff --git a/src/toolkit/__init__.py b/src/avp/toolkit/__init__.py index 55e5f84..55e5f84 100644 --- a/src/toolkit/__init__.py +++ b/src/avp/toolkit/__init__.py diff --git a/src/toolkit/common.py b/src/avp/toolkit/common.py index e35aba2..e35aba2 100644 --- a/src/toolkit/common.py +++ b/src/avp/toolkit/common.py diff --git a/src/toolkit/ffmpeg.py b/src/avp/toolkit/ffmpeg.py index 5aedff3..5aedff3 100644 --- a/src/toolkit/ffmpeg.py +++ b/src/avp/toolkit/ffmpeg.py diff --git a/src/toolkit/frame.py b/src/avp/toolkit/frame.py index 94537a6..94537a6 100644 --- a/src/toolkit/frame.py +++ b/src/avp/toolkit/frame.py diff --git a/src/video_thread.py b/src/avp/video_thread.py index 5d72409..5d72409 100644 --- a/src/video_thread.py +++ b/src/avp/video_thread.py diff --git a/src/tests/__init__.py b/src/tests/__init__.py deleted file mode 100644 index e2d83e7..0000000 --- a/src/tests/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -import pytest -import os -import sys -from ..core import Core - - -def getTestDataPath(filename): - return os.path.join(Core.wd, "tests", "data", filename) - - -def run(logFile): - """Run Pytest, which then imports and runs all tests in this module.""" - os.environ["PYTEST_QT_API"] = "PyQt6" - with open(logFile, "w") as f: - # temporarily redirect stdout to a text file so we capture pytest's output - sys.stdout = f - try: - val = pytest.main( - [ - os.path.dirname(__file__), - "-s", # disable pytest's internal capturing of stdout etc. - ] - ) - finally: - sys.stdout = sys.__stdout__ - - return val diff --git a/src/tests/data/test.jpg b/src/tests/data/test.jpg Binary files differdeleted file mode 100644 index 86266d9..0000000 --- a/src/tests/data/test.jpg +++ /dev/null diff --git a/src/tests/data/test.ogg b/src/tests/data/test.ogg Binary files differdeleted file mode 100644 index 46af76c..0000000 --- a/src/tests/data/test.ogg +++ /dev/null diff --git a/src/tests/data/test.png b/src/tests/data/test.png Binary files differdeleted file mode 100644 index f1ffd4a..0000000 --- a/src/tests/data/test.png +++ /dev/null diff --git a/src/tests/test_commandline_export.py b/src/tests/test_commandline_export.py deleted file mode 100644 index 6126da7..0000000 --- a/src/tests/test_commandline_export.py +++ /dev/null @@ -1,39 +0,0 @@ -import sys -import os -import tempfile -from ..command import Command -from . import getTestDataPath -from pytestqt import qtbot - - -def test_commandline_classic_export(qtbot): - """Run Qt event loop and create a video in the system /tmp or /temp""" - soundFile = getTestDataPath("test.ogg") - outputDir = tempfile.mkdtemp(prefix="avp-test-") - outputFilename = os.path.join(outputDir, "output.mp4") - sys.argv = [ - "", - "-c", - "0", - "classic", - "-i", - soundFile, - "-o", - outputFilename, - ] - - command = Command() - command.quit = lambda _: None - command.parseArgs() - # Command object now has a video_thread Worker which is exporting the video - - with qtbot.waitSignal(command.worker.videoCreated, timeout=10000): - """ - Wait until videoCreated is emitted by the video_thread Worker - or until 10 second timeout has passed - """ - print(f"Test Video created at {outputFilename}") - - assert os.path.exists(outputFilename) - # output video should be at least 200kb - assert os.path.getsize(outputFilename) > 200000 diff --git a/src/tests/test_commandline_parser.py b/src/tests/test_commandline_parser.py deleted file mode 100644 index 5d1232b..0000000 --- a/src/tests/test_commandline_parser.py +++ /dev/null @@ -1,45 +0,0 @@ -import sys -import pytest -from ..command import Command - - -def test_commandline_help(): - command = Command() - sys.argv = ["", "--help"] - with pytest.raises(SystemExit): - command.parseArgs() - - -def test_commandline_help_if_bad_args(): - command = Command() - sys.argv = ["", "--junk"] - with pytest.raises(SystemExit): - command.parseArgs() - - -def test_commandline_launches_gui_if_debug(): - command = Command() - sys.argv = ["", "--debug"] - mode = command.parseArgs() - assert mode == "GUI" - - -def test_commandline_launches_gui_if_debug_with_project(): - command = Command() - sys.argv = ["", "test", "--debug"] - mode = command.parseArgs() - assert mode == "GUI" - - -def test_commandline_tries_to_export(): - command = Command() - didCallFunction = False - - def captureFunction(*args): - nonlocal didCallFunction - didCallFunction = True - - sys.argv = ["", "-c", "0", "classic", "-i", "_", "-o", "_"] - command.createAudioVisualization = captureFunction - command.parseArgs() - assert didCallFunction diff --git a/src/tests/test_core_init.py b/src/tests/test_core_init.py deleted file mode 100644 index 950dc13..0000000 --- a/src/tests/test_core_init.py +++ /dev/null @@ -1,21 +0,0 @@ -from ..core import Core - - -def test_component_names(): - core = Core() - assert core.compNames == [ - "Classic Visualizer", - "Color", - "Conway's Game of Life", - "Image", - "Sound", - "Spectrum", - "Title Text", - "Video", - "Waveform", - ] - - -def test_moduleindex(): - core = Core() - assert core.moduleIndexFor("Classic Visualizer") == 0 |
