From 7c6ebd1dae07cf91b129d0f474538e1c146caf90 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Wed, 31 Aug 2022 20:13:23 +0100 Subject: [PATCH] add support for python 3.10. update python ver in readme all tests run and passed for version 3.10 setup.py removed from gitignore. --- .gitignore | 1 - README.md | 14 +++++++------- obsstudio_sdk/baseclient.py | 6 +++++- setup.py | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index cea0017..7b77f4a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,6 @@ wheels/ *.egg-info/ .installed.cfg *.egg -setup.py MANIFEST # Unit test / coverage reports diff --git a/README.md b/README.md index 6f9a7ad..80c9b6c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Not all endpoints in the official documentation are implemented. - [OBS Studio](https://obsproject.com/) - [OBS Websocket v5 Plugin](https://github.com/obsproject/obs-websocket/releases/tag/5.0.0) -- Python 3.11 or greater +- Python 3.10 or greater ### How to install using pip @@ -44,7 +44,7 @@ Import and start using, keyword arguments are as follows: Example `__main__.py`: ```python -from obsstudio_sdk import reqs as obs +import obsstudio_sdk as obs # pass conn info if not in config.toml cl = obs.ReqClient(host='localhost', port=4455, password='mystrongpass') @@ -60,15 +60,14 @@ Method names for requests match the API calls but snake cased. example: ```python -from obsstudio_sdk import reqs as obs -cl = obs.ReqClient(host='localhost', port=4455, password='mystrongpass') - +# load conn info from config.toml +cl = obs.ReqClient() # GetVersion resp = cl.get_version() # SetCurrentProgramScene -cl.set_current_program_scene() +cl.set_current_program_scene("BRB") ``` For a full list of requests refer to [Requests](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md#requests) @@ -80,7 +79,8 @@ When registering a function callback use the name of the expected API event in s example: ```python -cl = EventClient() +# load conn info from config.toml +cl = obs.EventClient() def scene_created(data): ... diff --git a/obsstudio_sdk/baseclient.py b/obsstudio_sdk/baseclient.py index 0779a69..262a507 100644 --- a/obsstudio_sdk/baseclient.py +++ b/obsstudio_sdk/baseclient.py @@ -4,7 +4,11 @@ import json from pathlib import Path from random import randint -import tomllib +try: + import tomllib +except ModuleNotFoundError: + import tomli as tomllib + import websocket diff --git a/setup.py b/setup.py index ee44c1d..d5e9da4 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import find_packages, setup HERE = pathlib.Path(__file__).parent -VERSION = "1.0.2" +VERSION = "1.0.3" PACKAGE_NAME = "obsstudio_sdk" AUTHOR = "Adem Atikturk" AUTHOR_EMAIL = "aatikturk@gmail.com" @@ -18,7 +18,7 @@ LONG_DESCRIPTION = (HERE / "README.md").read_text() LONG_DESC_TYPE = "text/markdown" # Dependencies for the package -INSTALL_REQUIRES = ["websocket-client"] +INSTALL_REQUIRES = ["websocket-client", "tomli >= 1.1.0;python_version < '3.11'"] # Development dependencies EXTRAS_REQUIRE = { @@ -31,7 +31,7 @@ EXTRAS_REQUIRE = { } # Python version requirement -PYTHON_REQUIRES = ">=3.11" +PYTHON_REQUIRES = ">=3.10" setup( name=PACKAGE_NAME,