Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
max-parallel: 5
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version: ['3.2', '4.1', '4.2', '5.0', '5.1']
django-version: ['3.2', '4.1', '4.2', '5.0', '5.1', '5.2']
include:
# Tox configuration for QA environment
- python-version: '3.11'
django-version: 'qa'
# Patchwork for GitHub "required" test environments
- python-version: '3.7'
django-version: '3.2'
- python-version: '3.8'
django-version: '4.0'
- python-version: '3.9'
Expand All @@ -29,7 +27,7 @@ jobs:
# Exclude Django 3.2 for Python 3.11
- python-version: '3.11'
django-version: '3.2'
# Django 5.0/5.1 don't support < Python 3.10
# Django 5.0/5.1/5.2 don't support < Python 3.10
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.9'
Expand All @@ -38,26 +36,29 @@ jobs:
django-version: '5.1'
- python-version: '3.9'
django-version: '5.1'
- python-version: '3.8'
django-version: '5.2'
- python-version: '3.9'
django-version: '5.2'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
key: ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ matrix.python-version }}-v1-

Expand All @@ -73,6 +74,6 @@ jobs:
DJANGO: ${{ matrix.django-version }}

- name: Upload coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
name: Python ${{ matrix.python-version }}
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

from pkg_resources import get_distribution
import os
import sys

from pkg_resources import get_distribution

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down
8 changes: 5 additions & 3 deletions docs/ext/djangodocs.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
"""
Sphinx plugins for Django documentation.
"""

import json
import os
import re

from sphinx import addnodes, __version__ as sphinx_ver
from docutils.parsers.rst import Directive
from sphinx import __version__ as sphinx_ver
from sphinx import addnodes
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.writers.html import HTMLTranslator
from sphinx.util.console import bold
from docutils.parsers.rst import Directive
from sphinx.writers.html import HTMLTranslator

# RE for option descriptions without a '--' prefix
simple_option_desc_re = re.compile(r"([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)")
Expand Down
9 changes: 2 additions & 7 deletions embed_video/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import sys
from importlib.metadata import version

if sys.version_info >= (3, 8):
import importlib.metadata as metadata
else:
import importlib_metadata as metadata

__version__ = metadata.version("django-embed-video")
__version__ = version("django-embed-video")
4 changes: 2 additions & 2 deletions embed_video/tests/backends/tests_soundcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def get_info(self):
"width": 123,
"height": 321,
"thumbnail_url": "xyz",
"html": '\u003Ciframe width="100%" height="400" '
"html": '\u003ciframe width="100%" height="400" '
'scrolling="no" frameborder="no" '
'src="{0}"\u003E\u003C/iframe\u003E'.format(self.url),
'src="{0}"\u003e\u003c/iframe\u003e'.format(self.url),
}

self.foo = FooBackend("abcd")
Expand Down
11 changes: 9 additions & 2 deletions embed_video/tests/backends/tests_vimeo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import urllib.parse
from unittest import TestCase
from unittest.mock import patch

Expand Down Expand Up @@ -39,9 +40,15 @@ def test_vimeo_get_info_exception(self):

def test_get_thumbnail_url(self):
backend = VimeoBackend("https://vimeo.com/72304002")
expected_url = "https://i.vimeocdn.com/video/446150690-9621b882540b53788eaa36ef8e303d4e06fc40af3d27918b7f561bb44ed971dc-d_640"
actual_url = backend.get_thumbnail_url()
# Parse URLs and compare without query parameters
expected_parts = urllib.parse.urlparse(expected_url)
actual_parts = urllib.parse.urlparse(actual_url)
# Compare scheme, netloc, and path only
self.assertEqual(
backend.get_thumbnail_url(),
"https://i.vimeocdn.com/video/446150690-9621b882540b53788eaa36ef8e303d4e06fc40af3d27918b7f561bb44ed971dc-d_640",
(expected_parts.scheme, expected_parts.netloc, expected_parts.path),
(actual_parts.scheme, actual_parts.netloc, actual_parts.path),
)

@patch("embed_video.backends.EMBED_VIDEO_TIMEOUT", 0.000001)
Expand Down
2 changes: 1 addition & 1 deletion example_project/example_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

APPEND_SLASH = True

Expand Down
3 changes: 1 addition & 2 deletions example_project/example_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import include, path

from django.contrib import admin

admin.autodiscover()

urlpatterns = staticfiles_urlpatterns() + [
Expand Down
1 change: 1 addition & 0 deletions example_project/example_project/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
framework.

"""

import os

# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
Expand Down
27 changes: 20 additions & 7 deletions example_project/posts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
# Generated by Django 4.0.5 on 2022-06-26 08:55

from django.db import migrations, models

import embed_video.fields


class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Post',
name="Post",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=50)),
('video', embed_video.fields.EmbedVideoField(help_text='This is a help text', verbose_name='My video')),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=50)),
(
"video",
embed_video.fields.EmbedVideoField(
help_text="This is a help text", verbose_name="My video"
),
),
],
options={'ordering': ['pk']},
options={"ordering": ["pk"]},
),
]
2 changes: 1 addition & 1 deletion example_project/posts/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.urls import include, re_path

from .views import PostListView, PostDetailView
from .views import PostDetailView, PostListView

urlpatterns = [
re_path(r"(?P<pk>\d+)/$", PostDetailView.as_view(), name="detail"),
Expand Down
2 changes: 1 addition & 1 deletion example_project/posts/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.views.generic import ListView, DetailView
from django.views.generic import DetailView, ListView

from .models import Post

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
Expand Down
12 changes: 7 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[tox]
envlist =
py{37,38,39,310}-dj32
py{38,39,310}-dj32
py{38,39,310}-dj40
py{38,39,310,311}-dj41
py{38,39,310,311}-dj42
py{310,311,312}-dj50
py{310,311,312}-dj51
py{310,311,312}-dj52
py{311}-djmain
py{311}-djqa

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
Expand All @@ -26,6 +26,7 @@ DJANGO =
4.2: dj42
5.0: dj50
5.1: dj51
5.2: dj52
main: djmain
qa: djqa

Expand All @@ -37,6 +38,7 @@ deps =
dj42: django>=4.2,<4.3
dj50: django>=5.0,<5.1
dj51: django>=5.1,<5.2
dj52: django>=5.2,<5.3
djmain: https://github.com/django/django/archive/main.tar.gz
coverage
requests-mock
Expand All @@ -57,9 +59,9 @@ ignore_errors =
ignore_errors = true
basepython = 3.11
deps =
black==22.6.0
isort==5.6.4
black>=24.1.1
isort>=5.13.2
skip_install = true
commands =
isort --profile black --check-only --diff embed_video setup.py
black -t py38 --check --diff embed_video
black --check --diff embed_video
Loading