Skip to content

Commit

Permalink
πŸ—οΈ Maintenance: Replaced python 3.7.x support with 3.11.x legacy (F…
Browse files Browse the repository at this point in the history
…ixed #369)  [#370]

🚧 Setup.py: 
- Removed support for python-3.7 legacies 
- πŸ“Œ Raised `python_requires` to `>=3.8`. Thereby python `3.7` and any before legacy are no longer supported.
- πŸ”₯ Removed `3.7` legacy from Programming Language metadata.
- 🩹 Readded latest patch to `uvicorn`, `starlette`, `pyzmq` dependencies.
- πŸ“Œ Pinned pyzmq==24.0.1.

Asyncio: 
- 🩹 Formatted TemplateResponse class parameters w.r.t new changes.

CI: 
- πŸ‘· Updated Azure Pipeline workflow. 
	- ✨ Added python 3.11 legacy support for MacOS environments.
	- πŸ”₯ Deprecated  python 3.7 legacy support.

- πŸ‘· Updated Appveyor Pipeline workflow.
	- ✨ Added python 3.11 legacy support for Windows OS environments.
	- πŸ”₯ Deprecated  python 3.7 legacy support.

-πŸ‘· Updated GitHub CI Pipeline workflow.
	- ✨ Added python 3.11 legacy support for Linux OS environments.
	- πŸ”₯ Deprecated  python 3.7 legacy support.
- 🚚 Migrated python version to 3.9 in deploy_docs.yml workflow.
- πŸ’š Temporary fix for AST constructor depth mismatch in pytest on python `3.11.x`, More information: pytest-dev/pytest#10874
	- Made temporary fix platform independent. 
	- Extended fix to all Webgear_RTC tests. 
- β˜‚οΈ Increased code coverage.
- πŸ’š Fixed condition logic bug.

Maintenance: 
- ⚑️ Added GitHub sponsors and dropped liberapay from Funding.yml.

Docs:
- πŸ“ Updated minimum python to version `3.8` while installing vidgear.
- 🎨 Updated API-specific dependencies.
- ✏️ Fixed hyperlinks.
  • Loading branch information
abhiTronix authored Jul 27, 2023
2 parents 778de53 + c861b17 commit 1628685
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ko_fi: abhitronix
liberapay: abhiTronix
github: abhiTronix
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
types: [published]

env:
PYTHON_VERSION: 3.7
PYTHON_VERSION: 3.9
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
GIT_NAME: ${{ secrets.GIT_NAME }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: mike deploy docs release
run: |
echo "${{ env.NAME_RELEASE }}"
mike deploy --push --update-aliases --no-redirect ${{ env.NAME_RELEASE }} ${{ env.RELEASE_NAME }} --title=${{ env.RELEASE_NAME }}
mike deploy --push --update-aliases --no-redirect ${{ env.NAME_RELEASE }} ${{ env.RELEASE_NAME }} --title=${{ env.RELEASE_NAME }}
env:
NAME_RELEASE: "v${{ env.RELEASE_NAME }}-release"
if: success()
Expand Down Expand Up @@ -112,7 +112,6 @@ jobs:
NAME_STABLE: "v${{ env.RELEASE_NAME }}-stable"
if: success()


deploy-docs-dev:
name: Deploy Development Docs
if: github.event_name == 'push' && github.ref == 'refs/heads/testing'
Expand Down
11 changes: 5 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ image: Visual Studio 2019

environment:
matrix:
- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "64"
Expand All @@ -32,6 +28,10 @@ environment:
PYTHON_VERSION: "3.10.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python311-x64"
PYTHON_VERSION: "3.11.x"
PYTHON_ARCH: "64"

build: off

version: "{branch}-{build}"
Expand Down Expand Up @@ -70,6 +70,5 @@ install:
test_script:
- cmd: python -m pytest --verbose --capture=no --cov-report term-missing --cov=vidgear vidgear/tests/


after_test:
- cmd: python -m codecov
- cmd: python -m codecov
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ pool:

strategy:
matrix:
Python37:
python.version: "3.7"
Python38:
python.version: "3.8"
Python39:
python.version: "3.9"
Python310:
python.version: "3.10"
Python311:
python.version: "3.11"

steps:
- task: UsePythonVersion@0
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ limitations under the License.

## Supported Systems

VidGear is well-tested and supported on the following systems(but not limited to), with [python 3.7+](https://www.python.org/downloads/) and [pip](https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip) installed:
VidGear is well-tested and supported on the following systems(but not limited to), with [python 3.8+](https://www.python.org/downloads/) and [pip](https://pip.pypa.io/en/stable/installing/#do-i-need-to-install-pip) installed:

* Any :material-linux: Linux distro released in 2016 or later
* :fontawesome-brands-windows: Windows 7 or later
Expand All @@ -41,9 +41,9 @@ VidGear is well-tested and supported on the following systems(but not limited to

!!! warning "Depreciation Notice"

Python-3.6 legacies support has been dropped from Vidgear.
Python-3.7 legacies support has been dropped from Vidgear.

:fontawesome-brands-python: [**Python 3.7+**](https://www.python.org/downloads/) are only supported legacies for installing Vidgear v0.2.5 and above.
:fontawesome-brands-python: [**Python 3.8+**](https://www.python.org/downloads/) are only supported legacies for installing Vidgear `v0.3.1` and above.

 

Expand Down
6 changes: 3 additions & 3 deletions docs/installation/pip_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ When installing VidGear with [pip](https://pip.pypa.io/en/stable/installing/), y
| CamGear | `pafy`, `yt_dlp`, `streamlink` |
| PiGear | `picamera` |
| VideoGear | *Based on CamGear or PiGear backend in use* |
| ScreenGear | `dxcam`, `mss`, `pyscreenshot`, `Pillow` |
| ScreenGear | `mss`, `pyscreenshot`, `Pillow` |
| WriteGear | **FFmpeg:** See [this doc ➢](../../gears/writegear/compression/advanced/ffmpeg_install/#ffmpeg-installation-instructions) |
| StreamGear | **FFmpeg:** See [this doc ➢](../../gears/streamgear/ffmpeg_install/#ffmpeg-installation-instructions) |
| NetGear | `pyzmq`, `simplejpeg` |
Expand Down Expand Up @@ -329,10 +329,10 @@ pip install git+git://github.com/abhiTronix/vidgear@master#egg=vidgear[asyncio]
```sh
# Install latest stable release with all Core dependencies
pip install vidgear-0.3.1-py3-none-any.whl[core]
pip install vidgear-0.3.2-py3-none-any.whl[core]
# Or Install latest stable release with all Core & Asyncio dependencies
pip install vidgear-0.3.1-py3-none-any.whl[asyncio]
pip install vidgear-0.3.2-py3-none-any.whl[asyncio]
```
 
Expand Down
6 changes: 3 additions & 3 deletions docs/installation/source_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ When installing VidGear from source, FFmpeg is the only API specific prerequisit
| CamGear | `yt_dlp` |
| PiGear | `picamera` |
| VideoGear | *Based on CamGear or PiGear backend in use* |
| ScreenGear | `mss`, `pyscreenshot`, `Pillow` |
| WriteGear | **FFmpeg:** See [this doc ➢](https://abhitronix.github.io/vidgear/v0.2.2-dev/gears/writegear/compression/advanced/ffmpeg_install/#ffmpeg-installation-instructions) |
| StreamGear | **FFmpeg:** See [this doc ➢](https://abhitronix.github.io/vidgear/v0.2.2-dev/gears/streamgear/ffmpeg_install/#ffmpeg-installation-instructions) |
| ScreenGear | `dxcam`, `mss`, `pyscreenshot`, `Pillow` |
| WriteGear | **FFmpeg:** See [this doc ➢](https://abhitronix.github.io/vidgear/dev/gears/writegear/compression/advanced/ffmpeg_install/#ffmpeg-installation-instructions) |
| StreamGear | **FFmpeg:** See [this doc ➢](https://abhitronix.github.io/vidgear/dev/gears/streamgear/ffmpeg_install/#ffmpeg-installation-instructions) |
| NetGear | `pyzmq`, `simplejpeg` |
| WebGear | `starlette`, `jinja2`, `uvicorn`, `simplejpeg` |
| WebGear_RTC | `aiortc`, `starlette`, `jinja2`, `uvicorn` |
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def latest_version(package_name):
"pyzmq==24.0.1",
"Pillow",
"simplejpeg{}".format(latest_version("simplejpeg")),
"mss==7.0.1", # TODO temporary solution, needs to be addressed
"mss{}".format(latest_version("mss")),
"pyscreenshot{}".format(latest_version("pyscreenshot")),
]
+ (["picamera"] if ("arm" in platform.uname()[4][:3]) else [])
Expand All @@ -126,15 +126,15 @@ def latest_version(package_name):
"yt_dlp{}".format(latest_version("yt_dlp")),
"pyzmq==24.0.1",
"simplejpeg{}".format(latest_version("simplejpeg")),
"mss==7.0.1", # TODO temporary solution, needs to be addressed
"mss{}".format(latest_version("mss")),
"Pillow",
"pyscreenshot{}".format(latest_version("pyscreenshot")),
"starlette",
"starlette{}".format(latest_version("starlette")),
"jinja2",
"msgpack{}".format(latest_version("msgpack")),
"msgpack_numpy{}".format(latest_version("msgpack_numpy")),
"aiortc{}".format(latest_version("aiortc")),
"uvicorn",
"uvicorn{}".format(latest_version("uvicorn")),
]
+ (["picamera"] if ("arm" in platform.uname()[4][:3]) else [])
+ (
Expand Down Expand Up @@ -184,12 +184,12 @@ def latest_version(package_name):
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
],
python_requires=">=3.7",
python_requires=">=3.8",
scripts=[],
project_urls={
"Bug Reports": "https://github.com/abhiTronix/vidgear/issues",
Expand Down
10 changes: 3 additions & 7 deletions vidgear/gears/asyncio/webgear.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ async def __homepage(self, request):
Returns an HTML index page.
"""
return (
self.__templates.TemplateResponse("index.html", {"request": request})
self.__templates.TemplateResponse(request, "index.html")
if not self.__skip_generate_webdata
else JSONResponse(
{"detail": "WebGear Data-Files Auto-Generation WorkFlow is disabled!"},
Expand All @@ -509,9 +509,7 @@ async def __not_found(self, request, exc):
Returns an HTML 404 page.
"""
return (
self.__templates.TemplateResponse(
"404.html", {"request": request}, status_code=404
)
self.__templates.TemplateResponse(request, "404.html", status_code=404)
if not self.__skip_generate_webdata
else JSONResponse(
{"detail": "WebGear Data-Files Auto-Generation WorkFlow is disabled!"},
Expand All @@ -524,9 +522,7 @@ async def __server_error(self, request, exc):
Returns an HTML 500 page.
"""
return (
self.__templates.TemplateResponse(
"500.html", {"request": request}, status_code=500
)
self.__templates.TemplateResponse(request, "500.html", status_code=500)
if not self.__skip_generate_webdata
else JSONResponse(
{"detail": "WebGear Data-Files Auto-Generation WorkFlow is disabled!"},
Expand Down
10 changes: 3 additions & 7 deletions vidgear/gears/asyncio/webgear_rtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,23 +596,19 @@ async def __homepage(self, request):
"""
Return an HTML index page.
"""
return self.__templates.TemplateResponse("index.html", {"request": request})
return self.__templates.TemplateResponse(request, "index.html")

async def __not_found(self, request, exc):
"""
Return an HTML 404 page.
"""
return self.__templates.TemplateResponse(
"404.html", {"request": request}, status_code=404
)
return self.__templates.TemplateResponse(request, "404.html", status_code=404)

async def __server_error(self, request, exc):
"""
Return an HTML 500 page.
"""
return self.__templates.TemplateResponse(
"500.html", {"request": request}, status_code=500
)
return self.__templates.TemplateResponse(request, "500.html", status_code=500)

async def __reset_connections(self, request):
"""
Expand Down
71 changes: 65 additions & 6 deletions vidgear/tests/streamer_tests/asyncio_tests/test_webgear_rtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,28 +189,55 @@ def stop(self):
self.running = False


class Invalid_Custom_Stream_Class:
class Invalid_Custom_Channel_Class:
"""
Custom Invalid WebGear_RTC Server
"""

def __init__(self, source=0):
def __init__(self):
# define running flag
self.running = True

# define stream
self.stream = Custom_Grayscale_class()

def read(self):
# return non supported channeled frame
return self.stream.read(size=(480, 640, 5))

def stop(self):
# don't forget this function!!!

# flag that we're not running
self.running = False
self.stream.stop()


class Invalid_Custom_Stream_Class:
"""
Custom Invalid WebGear_RTC Server
"""

def __init__(self):
# define running flag
self.running = True

def stop(self):
# flag that we're not running
self.running = False


test_data = [
(None, False, None, 0),
(return_testvideo_path(), True, None, 0),
(return_testvideo_path(), False, "COLOR_BGR2HSV", 1),
]


@pytest.mark.skipif(
platform.python_version_tuple()[:2] >= ("3", "11"),
reason="Random Failures!",
)
@pytest.mark.asyncio
@pytest.mark.parametrize("source, stabilize, colorspace, time_delay", test_data)
async def test_webgear_rtc_class(source, stabilize, colorspace, time_delay):
Expand Down Expand Up @@ -248,7 +275,7 @@ async def test_webgear_rtc_class(source, stabilize, colorspace, time_delay):
await offer_pc.close()
web.shutdown()
except Exception as e:
if not isinstance(e, MediaStreamError):
if source and not isinstance(e, MediaStreamError):
pytest.fail(str(e))


Expand Down Expand Up @@ -277,6 +304,10 @@ async def test_webgear_rtc_class(source, stabilize, colorspace, time_delay):
]


@pytest.mark.skipif(
platform.python_version_tuple()[:2] >= ("3", "11"),
reason="Random Failures!",
)
@pytest.mark.asyncio
@pytest.mark.parametrize("options", test_data)
async def test_webgear_rtc_options(options):
Expand Down Expand Up @@ -330,7 +361,13 @@ async def test_webgear_rtc_options(options):
]


@pytest.mark.skipif((platform.system() == "Windows"), reason="Random Failures!")
@pytest.mark.skipif(
(
platform.system() == "Windows"
or platform.python_version_tuple()[:2] >= ("3", "11")
),
reason="Random Failures!",
)
@pytest.mark.asyncio
@pytest.mark.parametrize("options", test_data)
async def test_webpage_reload(options):
Expand Down Expand Up @@ -406,12 +443,22 @@ async def test_webpage_reload(options):
test_stream_classes = [
(None, False),
(Custom_Stream_Class(source=return_testvideo_path()), True),
(VideoGear(source=return_testvideo_path(), logging=True), True),
(
VideoGear(
source=return_testvideo_path(), colorspace="COLOR_BGR2BGRA", logging=True
),
True,
),
(Custom_Grayscale_class(), False),
(Invalid_Custom_Stream_Class(source=return_testvideo_path()), False),
(Invalid_Custom_Channel_Class(), False),
(Invalid_Custom_Stream_Class(), False),
]


@pytest.mark.skipif(
platform.python_version_tuple()[:2] >= ("3", "11"),
reason="Random Failures!",
)
@pytest.mark.asyncio
@pytest.mark.parametrize("stream_class, result", test_stream_classes)
async def test_webgear_rtc_custom_stream_class(stream_class, result):
Expand Down Expand Up @@ -462,6 +509,10 @@ async def test_webgear_rtc_custom_stream_class(stream_class, result):
]


@pytest.mark.skipif(
platform.python_version_tuple()[:2] >= ("3", "11"),
reason="Random Failures!",
)
@pytest.mark.asyncio
@pytest.mark.parametrize("middleware, result", test_data_class)
async def test_webgear_rtc_custom_middleware(middleware, result):
Expand All @@ -482,6 +533,10 @@ async def test_webgear_rtc_custom_middleware(middleware, result):
pytest.xfail(str(e))


@pytest.mark.skipif(
platform.python_version_tuple()[:2] >= ("3", "11"),
reason="Random Failures!",
)
@pytest.mark.asyncio
async def test_webgear_rtc_routes():
"""
Expand Down Expand Up @@ -527,6 +582,10 @@ async def test_webgear_rtc_routes():
pytest.fail(str(e))


@pytest.mark.skipif(
platform.python_version_tuple()[:2] >= ("3", "11"),
reason="Random Failures!",
)
@pytest.mark.asyncio
async def test_webgear_rtc_routes_validity():
"""
Expand Down

0 comments on commit 1628685

Please sign in to comment.