diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0246c6f..10aae2fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -149,9 +149,6 @@ jobs: run: gem install fpm if: "startsWith(matrix.os, 'ubuntu-')" - - name: Build Wheels - run: poetry build - - name: Bundle run: | if [ "$RUNNER_OS" == "macOS" ]; then @@ -181,6 +178,7 @@ jobs: elif [ "$RUNNER_OS" == "Windows" ]; then + cp -r ./dll_backup ./buzz/ poetry run make bundle_windows fi @@ -201,35 +199,57 @@ jobs: path: | dist/Buzz*-windows.exe dist/Buzz*-mac.dmg - dist/buzz_*.whl - publish-pypi: + build_wheels: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - include: - - os: macos-latest - - os: windows-latest - - os: ubuntu-20.04 - needs: [ build, test ] - if: startsWith(github.ref, 'refs/tags/') + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + steps: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-python@v5 - with: - python-version: "3.11.9" - - name: Install Poetry Action - uses: snok/install-poetry@v1.3.1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - - name: Publish to PyPI + + - name: Copy Windows DLLs run: | - poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} - poetry publish --build --skip-existing + if [ "$RUNNER_OS" == "Windows" ]; then + cp -r ./dll_backup ./buzz/ + fi + shell: bash + + - name: Build wheels + uses: pypa/cibuildwheel@v2.19.2 + env: + CIBW_ARCHS_WINDOWS: "auto" + CIBW_ARCHS_MACOS: "universal2" + CIBW_ARCHS_LINUX: "auto" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }} + path: ./wheelhouse/*.whl + + publish_pypi: + needs: [ build_wheels, test ] + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + password: ${{ secrets.PYPI_TOKEN }} release: runs-on: ${{ matrix.os }} @@ -245,14 +265,17 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - uses: actions/download-artifact@v4 with: name: Buzz-${{ runner.os }} + - name: Install Poetry Action uses: snok/install-poetry@v1.3.1 with: virtualenvs-create: true virtualenvs-in-project: true + - name: Release uses: softprops/action-gh-release@v2 with: diff --git a/.github/workflows/snapcraft.yml b/.github/workflows/snapcraft.yml index 96de33a8..cdf8c02a 100644 --- a/.github/workflows/snapcraft.yml +++ b/.github/workflows/snapcraft.yml @@ -25,7 +25,7 @@ jobs: id: snapcraft - run: | sudo apt-get update - sudo apt-get install libportaudio2 + sudo apt-get install libportaudio2 libtbb-dev - run: sudo snap install --devmode *.snap - run: | cd $HOME diff --git a/.gitignore b/.gitignore index 39bd402a..988c9a15 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ build/ htmlcov/ coverage.xml .idea/ +.venv/ # whisper_cpp libwhisper.* @@ -24,3 +25,4 @@ benchmarks.json .eggs *.egg-info /coverage/ +/wheelhouse/ diff --git a/Buzz.spec b/Buzz.spec index 8619c0d5..15074a13 100644 --- a/Buzz.spec +++ b/Buzz.spec @@ -47,6 +47,14 @@ binaries = [ (shutil.which("ffprobe"), "."), ] +# Include dll_backup folder and its contents on Windows +if platform.system() == "Windows": + datas += [("dll_backup", "dll_backup")] + + binaries.append(("dll_backup/SDL2.dll", "dll_backup")) + binaries.append(("dll_backup/whisper.dll", "dll_backup")) + binaries.append(("dll_backup/win32/whisper.dll", "dll_backup/win32")) + a = Analysis( ["main.py"], pathex=[], diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4554649d..0ba13967 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ Linux versions get also pushed to the snap. To install latest development versio 5. Install the dependencies `poetry install` 6. Install system dependencies you may be missing ``` -sudo apt-get install --no-install-recommends libyaml-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-shape0 libxcb-cursor0 libportaudio2 gettext libpulse0 ffmpeg +sudo apt-get install --no-install-recommends libyaml-dev libtbb-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-shape0 libxcb-cursor0 libportaudio2 gettext libpulse0 ffmpeg ``` On versions prior to Ubuntu 24.04 install `sudo apt-get install --no-install-recommends libegl1-mesa` 7. Build Buzz `poetry build` @@ -86,7 +86,7 @@ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 7. Enter repo folder `cd buzz` 8. Copy `whisper.dll` from the repo backup to `buzz` folder. ``` -cp .\dll_backup\*.dll .\buzz\ +cp -r .\dll_backup\ .\buzz\ ``` 9. Activate the virtual environment `poetry shell` 10. Install the dependencies `poetry install` diff --git a/Makefile b/Makefile index 6d2ce1eb..22d140c3 100644 --- a/Makefile +++ b/Makefile @@ -67,15 +67,10 @@ else endif buzz/$(LIBWHISPER): -ifeq ($(OS),Windows_NT) - cp dll_backup/whisper.dll buzz || true - cp dll_backup/SDL2.dll buzz || true -else cmake -S whisper.cpp -B whisper.cpp/build/ $(CMAKE_FLAGS) cmake --build whisper.cpp/build --verbose cp whisper.cpp/build/bin/Debug/$(LIBWHISPER) buzz || true cp whisper.cpp/build/$(LIBWHISPER) buzz || true -endif buzz/whisper_cpp.py: buzz/$(LIBWHISPER) translation_mo cd buzz && ctypesgen ../whisper.cpp/whisper.h -lwhisper -o whisper_cpp.py diff --git a/buzz/__version__.py b/buzz/__version__.py index 50b5ea95..2be0457e 100644 --- a/buzz/__version__.py +++ b/buzz/__version__.py @@ -1 +1 @@ -VERSION = "1.0.1" +VERSION = "1.0.2" diff --git a/buzz/buzz.py b/buzz/buzz.py index c3e388a7..111d8be4 100644 --- a/buzz/buzz.py +++ b/buzz/buzz.py @@ -26,6 +26,8 @@ os.environ["PATH"] += os.pathsep + APP_BASE_DIR # Add the app directory to the DLL list: https://stackoverflow.com/a/64303856 if platform.system() == "Windows": os.add_dll_directory(APP_BASE_DIR) + os.add_dll_directory(os.path.join(APP_BASE_DIR, "dll_backup")) + os.add_dll_directory(os.path.join(APP_BASE_DIR, "dll_backup", "win32")) def main(): diff --git a/dll_backup/win32/whisper.dll b/dll_backup/win32/whisper.dll new file mode 100644 index 00000000..67b8871a Binary files /dev/null and b/dll_backup/win32/whisper.dll differ diff --git a/installer.iss b/installer.iss index ff53e09a..533ed702 100644 --- a/installer.iss +++ b/installer.iss @@ -35,6 +35,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ [Files] Source: {#AppSourcePath}; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "dll_backup"; DestDir: "{app}\dll_backup"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/poetry.lock b/poetry.lock index 81db88cd..4b05c8b5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3399,5 +3399,5 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" -python-versions = ">=3.9.13,<3.13" -content-hash = "fcdb182782521a49b7eeeff8f6c92021c48709c8f0dcac14ad8879c62987bbbe" +python-versions = ">=3.9,<3.13" +content-hash = "c62d3e0a79ed56cccbbd28548655a072ca9e144fc5700260f788f1b88057faa7" diff --git a/pyproject.toml b/pyproject.toml index 321d8b9a..1a792265 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,21 +1,29 @@ [tool.poetry] name = "buzz-captions" -version = "1.0.1" +version = "1.0.2" description = "" authors = ["Chidi Williams "] license = "MIT" readme = "README.md" -include = ["buzz/libwhisper.*", "buzz/whisper_cpp.py", "buzz/locale/*/LC_MESSAGES/buzz.mo"] +include = [ + "buzz/libwhisper.*", "buzz/*.dll", "buzz/whisper_cpp.py", "buzz/locale/*/LC_MESSAGES/buzz.mo", + "buzz/dll_backup/*", +] repository = "https://github.com/chidiwilliams/buzz" packages = [ { include = "buzz" }, ] +[project] +requires-python = ">=3.9,<3.13" + [tool.poetry.dependencies] -python = ">=3.9.13,<3.13" +python = ">=3.9,<3.13" sounddevice = "^0.4.5" humanize = "^4.4.0" -PyQt6 = "^6.4.0" +PyQt6 = "6.6.1" +PyQt6-Qt6 = "6.6.2" +PyQt6-sip = "13.6.0" openai = "^1.14.2" keyring = "^25.0.0" platformdirs = "^4.2.0" @@ -24,9 +32,9 @@ numpy = "^1.21.2" requests = "^2.31.0" yt-dlp = "2024.3.10" stable-ts = "2.15.9" -faster-whisper = "^1.0.1" +faster-whisper = "1.0.1" openai-whisper = "v20231117" -transformers = "^4.39.1" +transformers = "4.39.1" polib = "^1.2.0" [tool.poetry.group.dev.dependencies]