Migrate to pyproject.toml and bump minimum Python version to 3.9 (#1459)

* Migrate to pyproject.toml

* Add .venv to .gitignore

* Exclude tests in MANIFEST.in

* Move pytest into pyproject.toml

* Remove unused coveralls

* Restore requirements_dev.txt

Needed for CI venv cache and readthedocs.

* Exclude .venv for flake8

* Bump minimum Python version to 3.9
This commit is contained in:
JonnyWong16 2024-11-16 14:09:11 -08:00 committed by GitHub
parent 99205d3b86
commit 60e8c6a6c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 49 additions and 92 deletions

View file

@ -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__.:

View file

@ -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

View file

@ -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

View file

@ -12,7 +12,7 @@ on:
env:
CACHE_VERSION: 1
DEFAULT_PYTHON: 3.8
DEFAULT_PYTHON: 3.9
jobs:
lint-flake8:

View file

@ -9,7 +9,7 @@ on:
types: [published]
env:
DEFAULT_PYTHON: 3.8
DEFAULT_PYTHON: 3.9
jobs:
build:
@ -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

1
.gitignore vendored
View file

@ -26,6 +26,7 @@ pip-selfcheck.json
pyvenv.cfg
MANIFEST
venv/
.venv/
# path for the test lib.
plex/

View file

@ -5,7 +5,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.9"
sphinx:
configuration: docs/conf.py

View file

@ -1,2 +1,2 @@
include README.rst
include requirements.txt
recursive-exclude tests *

View file

@ -1,5 +0,0 @@
{
"scripts": {
"pypi": "python setup.py sdist upload"
}
}

39
pyproject.toml Normal file
View file

@ -0,0 +1,39 @@
[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.9"
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"]
[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"
[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.",
]

View file

@ -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.

View file

@ -1,5 +0,0 @@
#---------------------------------------------------------
# PlexAPI core requirements.
# pip install -r requirements.txt
#---------------------------------------------------------
requests

View file

@ -2,10 +2,9 @@
# 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==8.3.2
pytest-cache==1.0
pytest-cov==5.0.0
pytest-mock==3.14.0

View file

@ -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',
]
)