Repository: letmaik/pyvirtualcam (language: python)

Issue:
Wheels for macOS ARM64
<!-- 🔎 Search existing issues to avoid creating duplicates. -->

- Operating system: macOS
- Python version: 3.10.6
- pyvirtualcam version: -
- Virtual camera (OBS, v4l2loopback, UnityCapture): -
- Virtual camera version: -

**Describe the bug**

```
$ pip install pyvirtualcam
ERROR: Could not find a version that satisfies the requirement pyvirtualcam (from versions: none)
ERROR: No matching distribution found for pyvirtualcam
```

Related issue: https://github.com/letmaik/pyvirtualcam/issues/15.

Could this be because of M1?


Discussion / hints:
M1 supports both x86-64 (Intel) and ARM64. So if you use an x86-64 Python installation, then you can install pyvirtualcam via PyPI. I'll keep this issue open to track the publication of PyPI wheels for macOS ARM64. The main blocker currently is GitHub Actions which doesn't support ARM64 (wheels are produced and published within Actions).
I would also like to use pyvirtualcam on M1 and am having the same issue. Is there any workaround for this? 

Also, I found https://github.com/pypa/cibuildwheel which supports Apple silicon. Perhaps pyvirtualcam could switch to that for building wheels?
> I would also like to use pyvirtualcam on M1 and am having the same issue. Is there any workaround for this?
> 
> Also, I found https://github.com/pypa/cibuildwheel which supports Apple silicon. Perhaps pyvirtualcam could switch to that for building wheels?

Use the build from source directions at the bottom of the readme. I have the grayscale animation running on an M1 with obs virtual camera, took only a few seconds to install.
Would it make sense to provide the source package as well on PyPi? Because the following works great on an M1:

```
pip install git+https://github.com/letmaik/pyvirtualcam
```
@cansik I generally don't publish source packages anymore for any of my binary Python packages as those more often than not lead to failed builds with obscure error messages and more people complaining and I don't have the time to handle the support requests. I treat building from source as an advanced use case that shouldn't happen by accident (pip automatically falls back to source packages if there are no binary wheels for the target Python version and/or platform, which is unfortunate).
@letmaik Thanks for your explanation and I can understand that of course. I solved it now by including the following lines into the requirements of my project. On MacOS arm64, the library will be installed from source, otherwise from the prebuilt wheel.

```
git+https://github.com/letmaik/pyvirtualcam; platform_system == "Darwin" and platform.machine == "arm64"
pyvirtualcam; platform_system != "Darwin" or platform.machine != "arm64"
```
> Would it make sense to provide the source package as well on PyPi? Because the following works great on an M1:
> 
> ```
> pip install git+https://github.com/letmaik/pyvirtualcam
> ```

Thank you i use it successful

Fix patch:
diff --git a/.github/scripts/build-macos.sh b/.github/scripts/build-macos.sh
index c0d514b..3dd341d 100755
--- a/.github/scripts/build-macos.sh
+++ b/.github/scripts/build-macos.sh
@@ -37,11 +37,11 @@ pip freeze
 # By default, wheels are tagged with the architecture of the Python
 # installation, which would produce universal2 even if only building
 # for x86_64. The following line overrides that behavior.
-export _PYTHON_HOST_PLATFORM="macosx-${MACOS_MIN_VERSION}-x86_64"
+export _PYTHON_HOST_PLATFORM="macosx-${MACOS_MIN_VERSION}-$ARCH"
 
 export CC=clang
 export CXX=clang++
-export CFLAGS="-arch x86_64"
+export CFLAGS="-arch $ARCH"
 export CXXFLAGS=$CFLAGS
 export LDFLAGS=$CFLAGS
 export ARCHFLAGS=$CFLAGS
@@ -54,7 +54,7 @@ python setup.py bdist_wheel
 # no shared library dependencies that have to be bundled.
 
 delocate-listdeps --all --depending dist/*.whl # lists library dependencies
-delocate-wheel --verbose --require-archs=x86_64 dist/*.whl # copies library dependencies into wheel
+delocate-wheel --verbose --require-archs=$ARCH dist/*.whl # copies library dependencies into wheel
 delocate-listdeps --all --depending dist/*.whl # verify
 
 # Dump target versions of dependend libraries.
diff --git a/.github/scripts/install-macos-obs-virtual-cam.sh b/.github/scripts/install-macos-obs-virtual-cam.sh
index 95c9245..48c93c3 100755
--- a/.github/scripts/install-macos-obs-virtual-cam.sh
+++ b/.github/scripts/install-macos-obs-virtual-cam.sh
@@ -3,9 +3,15 @@ set -e -x
 
 VERSION="28.0.2"
 
-DMG_FILENAME="obs-studio-${VERSION}-macos-x86_64.dmg"
+if [[ "$ARCH" == "arm64" ]]; then
+    ARCH_MOUNT="Apple"
+else
+    ARCH_MOUNT="Intel"
+fi
+
+DMG_FILENAME="obs-studio-${VERSION}-macos-${ARCH}.dmg"
 DMG_URL="https://cdn-fastly.obsproject.com/downloads/${DMG_FILENAME}"
-MOUNT_PATH="/Volumes/OBS-${VERSION}-macOS-Intel"
+MOUNT_PATH="/Volumes/OBS-${VERSION}-macOS-${ARCH_MOUNT}"
 INSTALL_PATH="/Library/CoreMediaIO/Plug-Ins/DAL"
 
 sudo mkdir -p "${INSTALL_PATH}"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c2ac55e..0d0438d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -65,30 +65,54 @@ jobs:
 
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.8'
           numpy-version: '1.17.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.9'
           numpy-version: '1.19.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.10'
           numpy-version: '1.21.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.11'
           numpy-version: '1.23.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.12'
           numpy-version: '1.26.*'
 
+        - os-image: macos-14 # M1
+          os-name: mac
+          arch: arm64
+          macos-min-version: '11.0'
+          python-version: '3.10'
+          numpy-version: '1.21.*'
+        - os-image: macos-14 # M1
+          os-name: mac
+          arch: arm64
+          macos-min-version: '11.0'
+          python-version: '3.11'
+          numpy-version: '1.23.*'
+        - os-image: macos-14 # M1
+          os-name: mac
+          arch: arm64
+          macos-min-version: '11.0'
+          python-version: '3.12'
+          numpy-version: '1.26.*'
+
         - os-image: windows-latest
           os-name: windows
           python-version: '3.8'
@@ -159,6 +183,7 @@ jobs:
       if: matrix.config.os-name == 'mac'
       run: .github/scripts/build-macos.sh
       env:
+        ARCH: ${{ matrix.config.arch }}
         MACOS_MIN_VERSION: ${{ matrix.config.macos-min-version }}
         PYTHON_VERSION: ${{ matrix.config.python-version }}
         NUMPY_VERSION: ${{ matrix.config.numpy-version }}
@@ -210,30 +235,54 @@ jobs:
 
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.8'
           numpy-version: '1.17.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.9'
           numpy-version: '1.19.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.10'
           numpy-version: '1.21.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.11'
           numpy-version: '1.23.*'
         - os-image: macos-11
           os-name: mac
+          arch: x86_64
           macos-min-version: '10.9'
           python-version: '3.12'
           numpy-version: '1.26.*'
 
+        - os-image: macos-14 # M1
+          os-name: mac
+          arch: arm64
+          macos-min-version: '11.0'
+          python-version: '3.10'
+          numpy-version: '1.21.*'
+        - os-image: macos-14 # M1
+          os-name: mac
+          arch: arm64
+          macos-min-version: '11.0'
+          python-version: '3.11'
+          numpy-version: '1.23.*'
+        - os-image: macos-14 # M1
+          os-name: mac
+          arch: arm64
+          macos-min-version: '11.0'
+          python-version: '3.12'
+          numpy-version: '1.26.*'
+
         - os-image: windows-latest
           os-name: windows
           python-version: '3.8'
@@ -311,6 +360,7 @@ jobs:
         .github/scripts/install-macos-obs-virtual-cam.sh
         .github/scripts/test-macos.sh
       env:
+        ARCH: ${{ matrix.config.arch }}
         PYTHON_VERSION: ${{ matrix.config.python-version }}
 
     - name: Store test captures as artifacts
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd25d23..103fe62 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [0.11.1] - 2023-02-08
+### Added
+- macOS arm64 support (Python 3.10 and higher).
+
 ## [0.11.0] - 2023-12-10
 ### Added
 - Python 3.12 support.
@@ -131,6 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Windows only, Python 3.5 - 3.8.
 - Support for [OBS-VirtualCam](https://github.com/CatxFish/obs-virtual-cam).
 
+[0.11.1]: https://github.com/letmaik/pyvirtualcam/compare/v0.11.0...v0.11.1
 [0.11.0]: https://github.com/letmaik/pyvirtualcam/compare/v0.10.2...v0.11.0
 [0.10.2]: https://github.com/letmaik/pyvirtualcam/compare/v0.10.1...v0.10.2
 [0.10.1]: https://github.com/letmaik/pyvirtualcam/compare/v0.10.0...v0.10.1
diff --git a/pyvirtualcam/_version.py b/pyvirtualcam/_version.py
index ae6db5f..fee46bd 100644
--- a/pyvirtualcam/_version.py
+++ b/pyvirtualcam/_version.py
@@ -1,1 +1,1 @@
-__version__ = "0.11.0"
+__version__ = "0.11.1"


Test patch:
diff --git a/.github/scripts/test-macos.sh b/.github/scripts/test-macos.sh
index 3b78776..d3a21aa 100755
--- a/.github/scripts/test-macos.sh
+++ b/.github/scripts/test-macos.sh
@@ -9,7 +9,7 @@ python -m venv env/$VENV
 source env/$VENV/bin/activate
 
 # Install pyvirtualcam
-pip install dist/pyvirtualcam*cp${PYVER}*macosx*.whl
+pip install dist/pyvirtualcam*cp${PYVER}*macosx*${ARCH}*.whl
 
 # Test installed pyvirtualcam
 pip install -r dev-requirements.txt