From e1f37665122af2cdd6d68dcc69fb6d99c6a86447 Mon Sep 17 00:00:00 2001 From: deepend-tildeclub Date: Thu, 18 Jun 2026 11:41:33 -0600 Subject: [PATCH] Modernize Python packaging/deprecation cleanup --- setup.py | 34 +++++++++++--------------------- ttrv/config.py | 2 +- ttrv/packages/praw/decorators.py | 2 +- ttrv/theme.py | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/setup.py b/setup.py index 08541d5..26dd90d 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,6 @@ -import sys -import codecs import setuptools -from version import __version__ as version +from ttrv.__version__ import __version__ as version install_requires = [ @@ -15,7 +13,7 @@ install_requires = [ tests_require = [ 'coveralls', - 'pytest>=3.1.0', # Pinned for the ``pytest.param`` method + 'pytest>=8.3.0', 'coverage', 'mock', 'pylint', @@ -26,20 +24,8 @@ extras_require = { 'test': tests_require } -# https://hynek.me/articles/conditional-python-dependencies/ -if int(setuptools.__version__.split(".", 1)[0]) < 18: - assert "bdist_wheel" not in sys.argv - if sys.version_info[0:2] < (3, 6): - install_requires.append("mailcap-fix") -else: - # Building the bdist_wheel with conditional environment dependencies - # requires setuptools version > 18. For older setuptools versions this - # will raise an error. - extras_require.update({":python_version<'3.6'": ["mailcap-fix"]}) - - def long_description(): - with codecs.open('README.md', encoding='utf8') as f: + with open('README.md', encoding='utf8') as f: return f.read() @@ -65,8 +51,8 @@ setuptools.setup( }, data_files=[("share/man/man1", ["ttrv.1"])], install_requires=install_requires, - tests_require=tests_require, extras_require=extras_require, + python_requires='>=3.9', entry_points={'console_scripts': ['ttrv=ttrv.__main__:main']}, classifiers=[ 'Intended Audience :: End Users/Desktop', @@ -74,11 +60,13 @@ setuptools.setup( 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX', 'Natural Language :: English', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', + 'Programming Language :: Python :: 3.14', 'Topic :: Terminals', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Message Boards', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: News/Diary', diff --git a/ttrv/config.py b/ttrv/config.py index c042f21..4f8d85a 100644 --- a/ttrv/config.py +++ b/ttrv/config.py @@ -253,7 +253,7 @@ class Config(object): config = configparser.ConfigParser() if os.path.exists(filename): with codecs.open(filename, encoding='utf-8') as fp: - config.readfp(fp) + config.read_file(fp) return cls._parse_ttrv_file(config) diff --git a/ttrv/packages/praw/decorators.py b/ttrv/packages/praw/decorators.py index 77bffab..9680b95 100644 --- a/ttrv/packages/praw/decorators.py +++ b/ttrv/packages/praw/decorators.py @@ -38,7 +38,7 @@ from warnings import filterwarnings, warn # Enable deprecation warnings from this module filterwarnings('default', category=DeprecationWarning, - module='^praw\.decorators$') + module=r'^praw\.decorators$') def alias_function(function, class_name): diff --git a/ttrv/theme.py b/ttrv/theme.py index af662df..9cc7fae 100644 --- a/ttrv/theme.py +++ b/ttrv/theme.py @@ -399,7 +399,7 @@ class Theme(object): config = configparser.ConfigParser() config.optionxform = six.text_type # Preserve case with codecs.open(filename, encoding='utf-8') as fp: - config.readfp(fp) + config.read_file(fp) except configparser.ParsingError as e: raise ConfigError(e.message)