From eab28935315bbfba9875b180b7bca5ac113cd7be Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Mon, 8 May 2023 13:58:45 -0700 Subject: [PATCH 1/8] Migrate to pyproject.toml --- .github/workflows/ci.yaml | 6 ++--- .github/workflows/pypi.yml | 5 ++--- package.json | 5 ----- pyproject.toml | 46 ++++++++++++++++++++++++++++++++++++++ requirements.txt | 5 ----- requirements_dev.txt | 18 --------------- setup.py | 46 -------------------------------------- 7 files changed, 50 insertions(+), 81 deletions(-) delete mode 100644 package.json create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 requirements_dev.txt delete mode 100644 setup.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 800b8ad0c..717881e45 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,8 +47,7 @@ jobs: python -m venv venv . venv/bin/activate pip install -U pip - pip install -r requirements_dev.txt - pip install -e . + pip install -e .[dev] - name: Lint with flake8 run: | @@ -111,8 +110,7 @@ jobs: python -m venv venv . venv/bin/activate pip install -U pip - pip install -r requirements_dev.txt - pip install -e . + pip install -e .[dev] - name: Get PMS Docker image digest id: docker-digest diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index a366a8876..d509d26c2 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -27,9 +27,8 @@ jobs: - name: Install dependencies and build run: | pip install -U pip - pip install -r requirements.txt - pip install setuptools twine wheel - python setup.py sdist bdist_wheel + pip install build twine + python -m build - name: Verify README # https://packaging.python.org/guides/making-a-pypi-friendly-readme/#validating-restructuredtext-markup diff --git a/package.json b/package.json deleted file mode 100644 index 9257a6605..000000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "scripts": { - "pypi": "python setup.py sdist upload" - } -} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..a1ef1c77e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +[project] +name = "PlexAPI" +authors = [ + { name = "Michael Shepanski", email = "michael.shepanski@gmail.com" } +] +description = "Python bindings for the Plex API." +readme = "README.rst" +requires-python = ">=3.8" +keywords = ["plex", "api"] +license = {file = "LICENSE.txt"} +classifiers = [ + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "License :: OSI Approved :: BSD License", +] +dependencies = ["requests"] +dynamic = ["version"] + +[project.optional-dependencies] +alert = ["websocket-client>=1.3.3"] +dev = [ + "coveralls", + "flake8", + "pillow", + "pytest", + "pytest-cache", + "pytest-cov", + "pytest-mock", + "recommonmark", + "requests-mock", + "sphinx", + "sphinx-rtd-theme", + "tqdm", + "websocket-client", +] + +[project.urls] +Homepage = "https://github.com/pkkid/python-plexapi" +Documentation = "https://python-plexapi.readthedocs.io" + +[tool.setuptools.dynamic] +version = {attr = "plexapi.const.__version__"} + +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ac8922b4d..000000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -#--------------------------------------------------------- -# PlexAPI core requirements. -# pip install -r requirements.txt -#--------------------------------------------------------- -requests diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 5d8e7a4a0..000000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,18 +0,0 @@ -#--------------------------------------------------------- -# PlexAPI requirements to run py.test. -# pip install -r requirements_dev.txt -#--------------------------------------------------------- -coveralls==4.0.1 -flake8==7.1.1 -pillow==10.4.0 -pytest==8.3.3 -pytest-cache==1.0 -pytest-cov==5.0.0 -pytest-mock==3.14.0 -recommonmark==0.7.1 -requests==2.32.3 -requests-mock==1.12.1 -sphinx==7.1.2 -sphinx-rtd-theme==2.0.0 -tqdm==4.66.5 -websocket-client==1.8.0 diff --git a/setup.py b/setup.py deleted file mode 100644 index 7e87e1297..000000000 --- a/setup.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -""" -Install PlexAPI -""" -from pkg_resources import parse_requirements -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -# Get version -version = {} -with open('plexapi/const.py') as handle: - exec(handle.read(), version) - -# Get README.rst contents -with open('README.rst') as handle: - readme = handle.read() - -# Get requirements -with open('requirements.txt') as handle: - requirements = [str(req) for req in parse_requirements(handle)] - -setup( - name='PlexAPI', - version=version['__version__'], - description='Python bindings for the Plex API.', - author='Michael Shepanski', - author_email='michael.shepanski@gmail.com', - url='https://github.com/pkkid/python-plexapi', - packages=['plexapi'], - install_requires=requirements, - extras_require={ - 'alert': ["websocket-client>=1.3.3"], - }, - python_requires='>=3.8', - long_description=readme, - long_description_content_type='text/x-rst', - keywords=['plex', 'api'], - classifiers=[ - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'License :: OSI Approved :: BSD License', - ] -) From 68f5284dfb86233d3a270fd0f669e6132ff6bf10 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 18 Aug 2024 15:19:13 -0700 Subject: [PATCH 2/8] Add .venv to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 64dabf950..d55a5c2e2 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ pip-selfcheck.json pyvenv.cfg MANIFEST venv/ +.venv/ # path for the test lib. plex/ From b3a558a055ac0ef34295f140ec54f63e2f5ecc4d Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 18 Aug 2024 15:19:28 -0700 Subject: [PATCH 3/8] Exclude tests in MANIFEST.in --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 36c6bd73a..955396f99 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include README.rst -include requirements.txt \ No newline at end of file +recursive-exclude tests * \ No newline at end of file From 25496e495f3a8d380c51b7712d7cfb1910d9ad47 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 18 Aug 2024 15:46:30 -0700 Subject: [PATCH 4/8] Move pytest into pyproject.toml --- pyproject.toml | 8 ++++++++ pytest.ini | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index a1ef1c77e..e7ecea79b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,3 +44,11 @@ version = {attr = "plexapi.const.__version__"} [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" + +[tool.pytest.ini_options] +markers = [ + "client: this is a client test.", + "req_client: require a client to run this test.", + "anonymously: test plexapi anonymously.", + "authenticated: test plexapi authenticated.", +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index a6a6e3715..000000000 --- a/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -markers = - client: this is a client test. - req_client: require a client to run this test. - anonymously: test plexapi anonymously. - authenticated: test plexapi authenticated. From e49348edbf59f48b726ae7104b65c5f546ef1d93 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 18 Aug 2024 15:46:41 -0700 Subject: [PATCH 5/8] Remove unused coveralls --- .coveragerc | 19 ------------------- pyproject.toml | 1 - 2 files changed, 20 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index e75e85e79..000000000 --- a/.coveragerc +++ /dev/null @@ -1,19 +0,0 @@ -[run] -omit = */site-packages/plexapi/* - - - -[report] -exclude_lines = - pragma: no cover - raise NotImplementedError - raise Unsupported - raise Exception - except ImportError - except BadRequest - def __repr__ - def __bool__ - def __iter__ - def __hash__ - def __len__ - if __name__ == .__main__.: diff --git a/pyproject.toml b/pyproject.toml index e7ecea79b..f290b43bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,6 @@ dynamic = ["version"] [project.optional-dependencies] alert = ["websocket-client>=1.3.3"] dev = [ - "coveralls", "flake8", "pillow", "pytest", From 2de82e1f175df462592627f6ac009eeddf1ef2b8 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sun, 18 Aug 2024 16:00:06 -0700 Subject: [PATCH 6/8] Restore requirements_dev.txt Needed for CI venv cache and readthedocs. --- .github/workflows/ci.yaml | 6 ++++-- pyproject.toml | 14 -------------- requirements_dev.txt | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 requirements_dev.txt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 717881e45..800b8ad0c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,7 +47,8 @@ jobs: python -m venv venv . venv/bin/activate pip install -U pip - pip install -e .[dev] + pip install -r requirements_dev.txt + pip install -e . - name: Lint with flake8 run: | @@ -110,7 +111,8 @@ jobs: python -m venv venv . venv/bin/activate pip install -U pip - pip install -e .[dev] + pip install -r requirements_dev.txt + pip install -e . - name: Get PMS Docker image digest id: docker-digest diff --git a/pyproject.toml b/pyproject.toml index f290b43bb..d93fd197d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,20 +18,6 @@ dynamic = ["version"] [project.optional-dependencies] alert = ["websocket-client>=1.3.3"] -dev = [ - "flake8", - "pillow", - "pytest", - "pytest-cache", - "pytest-cov", - "pytest-mock", - "recommonmark", - "requests-mock", - "sphinx", - "sphinx-rtd-theme", - "tqdm", - "websocket-client", -] [project.urls] Homepage = "https://github.com/pkkid/python-plexapi" diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 000000000..2eaf00d69 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,17 @@ +#--------------------------------------------------------- +# PlexAPI requirements to run py.test. +# pip install -r requirements_dev.txt +#--------------------------------------------------------- +flake8==7.1.1 +pillow==10.4.0 +pytest==8.3.2 +pytest-cache==1.0 +pytest-cov==5.0.0 +pytest-mock==3.14.0 +recommonmark==0.7.1 +requests==2.32.3 +requests-mock==1.12.1 +sphinx==7.1.2 +sphinx-rtd-theme==2.0.0 +tqdm==4.66.5 +websocket-client==1.8.0 From 80ed3cd4d550e96579c65b3b06365ec722d5d0d4 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 31 Aug 2024 17:36:06 -0700 Subject: [PATCH 7/8] Exclude .venv for flake8 --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 70b9e9cef..1eb16ebc5 100644 --- a/.flake8 +++ b/.flake8 @@ -9,7 +9,7 @@ # W605: invalid escape sequence [flake8] ignore=E128,E701,E702,E731,W503,W605 -exclude=compat.py,venv +exclude=compat.py,venv,.venv per-file-ignores = tests/payloads.py:E501 max-complexity = -1 From 066beb47f739b9374571f70f17c55d9713190e92 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Sat, 16 Nov 2024 14:02:20 -0800 Subject: [PATCH 8/8] Bump minimum Python version to 3.9 --- .github/ISSUE_TEMPLATE/BUG_REPORT.yml | 2 +- .github/workflows/ci.yaml | 2 +- .github/workflows/pypi.yml | 2 +- .readthedocs.yml | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 2a5c2162b..110b33546 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -50,7 +50,7 @@ body: id: python attributes: label: Python Version - placeholder: eg. 3.8.17 + placeholder: eg. 3.9.20 validations: required: true - type: input diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 800b8ad0c..f4b86675c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ on: env: CACHE_VERSION: 1 - DEFAULT_PYTHON: 3.8 + DEFAULT_PYTHON: 3.9 jobs: lint-flake8: diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index d509d26c2..ed4cf1072 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -9,7 +9,7 @@ on: types: [published] env: - DEFAULT_PYTHON: 3.8 + DEFAULT_PYTHON: 3.9 jobs: build: diff --git a/.readthedocs.yml b/.readthedocs.yml index e817dd195..a2646ce1f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -5,7 +5,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.8" + python: "3.9" sphinx: configuration: docs/conf.py diff --git a/pyproject.toml b/pyproject.toml index d93fd197d..452faee0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ authors = [ ] description = "Python bindings for the Plex API." readme = "README.rst" -requires-python = ">=3.8" +requires-python = ">=3.9" keywords = ["plex", "api"] license = {file = "LICENSE.txt"} classifiers = [