Repository: torchbox/wagtailmedia (language: python)

Issue:
Explicitly add in MEDIA_MODEL default to readme config
Very minor documentation bug that threw us for a bit before we worked it out so putting in tiny PR in case helpful: 

If you paste in the code for `settings.py` from the readme I'd expect it to work without any edits:

```
WAGTAILMEDIA = {
    "MEDIA_MODEL": "",  # string, dotted-notation. Defaults to "wagtailmedia.Media"
    "MEDIA_FORM_BASE": "",  # string, dotted-notation. Defaults to an empty string
    "AUDIO_EXTENSIONS": [],  # list of extensions
    "VIDEO_EXTENSIONS": [],  # list of extensions
}
```

But the MEDIA_MODEL has to be explicitly set to `wagtailmedia.Media` rather than the empty string set in the readme. If you leave as is it throws an error.

Alternatively "" could be treated as None and trigger the default if that's a preffered option to this simpler PR.
Explicitly add in MEDIA_MODEL default to readme config
Very minor documentation bug that threw us for a bit before we worked it out so putting in tiny PR in case helpful: 

If you paste in the code for `settings.py` from the readme I'd expect it to work without any edits:

```
WAGTAILMEDIA = {
    "MEDIA_MODEL": "",  # string, dotted-notation. Defaults to "wagtailmedia.Media"
    "MEDIA_FORM_BASE": "",  # string, dotted-notation. Defaults to an empty string
    "AUDIO_EXTENSIONS": [],  # list of extensions
    "VIDEO_EXTENSIONS": [],  # list of extensions
}
```

But the MEDIA_MODEL has to be explicitly set to `wagtailmedia.Media` rather than the empty string set in the readme. If you leave as is it throws an error.

Alternatively "" could be treated as None and trigger the default if that's a preffered option to this simpler PR.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 40935de..75967e5 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -8,31 +8,46 @@ permissions:
   contents: read # to fetch code (actions/checkout)
 
 jobs:
-  build_and_publish:
+  build:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
         with:
           fetch-depth: 0
 
-      - name: Set up Python 3.8
-        uses: actions/setup-python@v4
+      - uses: actions/setup-python@v4
         with:
-          python-version: '3.8'
+          python-version: '3.11'
           cache: "pip"
           cache-dependency-path: "**/pyproject.toml"
 
       - name: ⬇️ Install build dependencies
         run: |
-          python -m pip install flit
-          flit install --symlink
+          python -Im pip install flit
+          python -Im flit install --symlink
 
       - name: 🏗️ Build
-        run: flit build
-
-      - name: 🚀 Publish to live PyPI
-        env:
-          FLIT_USERNAME: '__token__'
-          FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
-          FLIT_INDEX_URL: https://upload.pypi.org/legacy/
-        run: flit publish
+        run: python -Im flit build
+
+      - uses: actions/upload-artifact@v3
+        with:
+          path: ./dist
+
+  # https://docs.pypi.org/trusted-publishers/using-a-publisher/
+  pypi-publish:
+    needs: build
+    environment: 'release'
+
+    name: ⬆️ Upload release to PyPI
+    runs-on: ubuntu-latest
+    permissions:
+      # Mandatory for trusted publishing
+      id-token: write
+    steps:
+      - uses: actions/download-artifact@v3
+
+      - name: 🚀 Publish package distributions to PyPI
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          packages-dir: artifact/
+          print-hash: true
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 3817673..d0c3f80 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -18,15 +18,15 @@ repos:
     - id: end-of-file-fixer
     - id: trailing-whitespace
   - repo: https://github.com/psf/black
-    rev: 23.3.0
+    rev: 23.7.0
     hooks:
       - id: black
   - repo: https://github.com/astral-sh/ruff-pre-commit
-    rev: 'v0.0.272'
+    rev: 'v0.0.277'
     hooks:
       - id: ruff
   - repo: https://github.com/adamchainz/blacken-docs
-    rev: 1.13.0
+    rev: 1.15.0
     hooks:
       - id: blacken-docs
-        additional_dependencies: [black==23.3.0]
+        additional_dependencies: [black==23.7.0]
diff --git a/README.md b/README.md
index 6550aff..db8d3df 100644
--- a/README.md
+++ b/README.md
@@ -31,22 +31,40 @@ INSTALLED_APPS = [
 ]
 ```
 
-All wagtailmedia settings are defined in a single `WAGTAILMEDIA` dictionary in your settings file:
+All wagtailmedia settings are defined in a single `WAGTAILMEDIA` dictionary in your settings file. The
+defaults are:
 
 ```python
 # settings.py
 
 WAGTAILMEDIA = {
-    "MEDIA_MODEL": "",  # string, dotted-notation. Defaults to "wagtailmedia.Media"
+    "MEDIA_MODEL": "wagtailmedia.Media",  # string, dotted-notation.
     "MEDIA_FORM_BASE": "",  # string, dotted-notation. Defaults to an empty string
-    "AUDIO_EXTENSIONS": [],  # list of extensions
-    "VIDEO_EXTENSIONS": [],  # list of extensions
+    "AUDIO_EXTENSIONS": [
+        "aac",
+        "aiff",
+        "flac",
+        "m4a",
+        "m4b",
+        "mp3",
+        "ogg",
+        "wav",
+    ],  # list of extensions
+    "VIDEO_EXTENSIONS": [
+        "avi",
+        "h264",
+        "m4v",
+        "mkv",
+        "mov",
+        "mp4",
+        "mpeg",
+        "mpg",
+        "ogv",
+        "webm",
+    ],  # list of extensions
 }
 ```
 
-`AUDIO_EXTENSIONS` defaults to "aac", "aiff", "flac", "m4a", "m4b", "mp3", "ogg" and "wav".
-`VIDEO_EXTENSIONS` defaults to "avi", "h264", "m4v", "mkv", "mov", "mp4", "mpeg", "mpg", "ogv" and "webm".
-
 ### URL configuration
 
 Your project needs to be set up to serve user-uploaded files from `MEDIA_ROOT`.
diff --git a/pyproject.toml b/pyproject.toml
index 47d8ba7..7b6f14b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -60,24 +60,6 @@ exclude = [
 [tool.black]
 line_length = 88
 target-version = ["py38"]
-exclude = '''
-(
-  /(
-    \.eggs         # exclude a few common directories in the
-    | \.git          # root of the project
-    | \.mypy_cache
-    | \.tox
-    | \.venv
-    | __pycache__
-    | _build
-    | build
-    | dist
-    | docs
-    | venv
-    | node_modules
-  )/
-)
-'''
 
 [tool.ruff]
 target-version = "py38"
@@ -107,12 +89,12 @@ lines-after-imports = 2
 [tool.coverage.run]
 branch = true
 parallel = true
-source_pkgs = ["wagtailmedia"]
+source = ["wagtailmedia"]
 
-omit = ["**/migrations/*", "tests/*"]
+omit = ["**/migrations/*", "tests/*", "src/wagtailmedia/admin.py", "src/wagtailmedia/deprecation.py"]
 
 [tool.coverage.paths]
-source = ["src", ".tox/*/site-packages"]
+source = ["src", ".tox/py*/**/site-packages"]
 
 [tool.coverage.report]
 show_missing = true
diff --git a/src/wagtailmedia/deprecation.py b/src/wagtailmedia/deprecation.py
index a6dc666..b61831e 100644
--- a/src/wagtailmedia/deprecation.py
+++ b/src/wagtailmedia/deprecation.py
@@ -1,6 +1,6 @@
-class RemovedInWagtailMedia012Warning(PendingDeprecationWarning):
+class RemovedInWagtailMedia015Warning(PendingDeprecationWarning):
     pass
 
 
-class RemovedInWagtailMedia013Warning(DeprecationWarning):
+class RemovedInWagtailMedia016Warning(DeprecationWarning):
     pass
diff --git a/tox.ini b/tox.ini
index 6b54de0..39f3797 100644
--- a/tox.ini
+++ b/tox.ini
@@ -15,7 +15,13 @@ python =
     3.11: py311
 
 [testenv]
-package = editable
+package = wheel
+wheel_build_env = .pkg
+
+pass_env =
+    FORCE_COLOR
+    NO_COLOR
+
 setenv =
     PYTHONPATH = {toxinidir}
     DJANGO_SETTINGS_MODULE = tests.settings
@@ -31,20 +37,21 @@ deps =
     wagtail50: wagtail>=5.0,<5.1
     interactive: wagtail>=4.1
 
-install_command = python -m pip install -U {opts} {packages}
+install_command = python -Im pip install -U {opts} {packages}
 
 commands =
-    python -m coverage run runtests.py {posargs: -v 2}
+    python -Im coverage run runtests.py {posargs: -v 2}
 
 [testenv:coverage-report]
 commands =
-    python -m coverage combine
-    python -m coverage report -m
+    python -Im coverage combine
+    python -Im coverage report -m
 
 [testenv:wagtailmain]
 description = Test with latest Wagtail main branch
 
 [testenv:interactive]
+package = editable
 description = An interactive environment for local testing purposes
 base_python = python3.11
 


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5fb907a..b6abadd 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -31,7 +31,7 @@ jobs:
         python-version: ["3.8", "3.9", "3.10", "3.11"]
 
     steps:
-      - name: Harden Runner
+      - name: 🔒 Harden Runner
         uses: step-security/harden-runner@v2
         with:
           disable-sudo: true
@@ -42,19 +42,24 @@ jobs:
             pypi.org:443
             api.github.com:443
       - uses: actions/checkout@v3
-      - name: Set up Python ${{ matrix.python-version }}
+      - name: 🐍 Set up Python ${{ matrix.python-version }}
         uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
 
-      - name: Install dependencies
+      - name: ⬇️ Install dependencies
         run: |
           python -Im pip install --upgrade pip
-          python -Im pip install tox tox-gh-actions
-      - name: Run tox targets for Python ${{ matrix.python-version }}
-        run: tox
+          python -Im pip install flit tox tox-gh-actions
+          python -Im flit install --symlink
 
-      - name: Upload coverage data
+      - name: 🏗️ Build wheel
+        run: python -Im flit build --format wheel
+
+      - name: 🧪 Run tox targets for Python ${{ matrix.python-version }}
+        run: tox --installpkg ./dist/*.whl
+
+      - name: ⬆️ Upload coverage data
         uses: actions/upload-artifact@v3
         with:
           name: coverage-data
@@ -67,7 +72,7 @@ jobs:
     needs: tests
 
     steps:
-      - name: Harden Runner
+      - name: 🔒 Harden Runner
         uses: step-security/harden-runner@v2
         with:
           disable-sudo: true
@@ -78,6 +83,8 @@ jobs:
             pypi.org:443
             api.github.com:443
       - uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
       - uses: actions/setup-python@v4
         with:
           # Use latest Python, so it understands all syntax.
@@ -90,14 +97,14 @@ jobs:
         with:
           name: coverage-data
 
-      - name: Combine coverage
+      - name: ＋  Combine coverage
         run: |
           python -Im coverage combine
           python -Im coverage html --skip-covered --skip-empty
           python -Im coverage report
           echo "## Coverage summary" >> $GITHUB_STEP_SUMMARY
           python -Im coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
-      - name: Upload HTML report if check failed.
+      - name: 📈 Upload HTML report if check failed.
         uses: actions/upload-artifact@v3
         with:
           name: html-report