From 66cf101aa6e40d3a0e74188af14bd9bb64f3738e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Harald=20S=C3=B8by?= Date: Sun, 13 Apr 2025 12:56:38 +0200 Subject: [PATCH] Exchange setup.py for pyproject.toml Exchange setup.py for the more modern approach, pyproject.toml, update requirements.txt based on current requirements, and add bot version to ukbot.py output. This fixes #59. --- pyproject.toml | 47 ++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 25 ++++++++++++++++++++---- setup.py | 49 ------------------------------------------------ ukbot/ukbot.py | 5 ++++- 4 files changed, 72 insertions(+), 54 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..12d31a6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "ukbot" +version = "1.1.0" +description = "Wikipedia writing contest bot" +authors = [ + { name = "Dan Michael O. Heggø", email = "danmichaelo@gmail.com" }, + { name = "Jon Harald Søby", email = "jhsoby@wikimedia.no" } +] +license = { text = "MIT" } +readme = "README.md" +requires-python = ">=3.7" +keywords = ["wikipedia"] +dependencies = [ + "Flask", + "isoweek", + "jsonpath-rw", + "lxml", + "matplotlib", + "more-itertools", + "mwclient", + "mwtemplates", + "mwtextextractor", + "numpy", + "psutil", + "pydash", + "PyMySQL", + "python-dotenv", + "pytz", + "PyYAML", + "requests", + "requests-oauthlib", +] + +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3.9" +] + +[project.scripts] +ukbot = "ukbot.ukbot:main" + +[tool.setuptools.packages.find] +where = ["."] diff --git a/requirements.txt b/requirements.txt index bc1f3b9..f855f71 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,22 @@ -. -pytest -responses +Faker +Flask +isoweek +jsonpath_rw +lxml +matplotlib mock -faker +more_itertools +mwclient +mwtemplates +mwtextextractor +numpy +psutil +pydash +PyMySQL +python-dotenv +pytz +PyYAML +Requests +requests_oauthlib +setuptools +uwsgi diff --git a/setup.py b/setup.py deleted file mode 100644 index 7e7af5c..0000000 --- a/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# encoding=utf-8 -from setuptools import setup, find_packages -import os, sys - -setup(name='ukbot', - version='1.0.0', - description='Wikipedia writing contest bot', - keywords='wikipedia', - author='Dan Michael O. Heggø', - author_email='danmichaelo@gmail.com', - url='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/danmichaelo/ukbot', - license='MIT', - packages=find_packages(), - include_package_data=True, - entry_points={ - 'console_scripts': [ - 'ukbot = ukbot.ukbot:main', - ], - }, - classifiers=[ - 'Programming Language :: Python', - 'Programming Language :: Python :: 3.9', - ], - install_requires=[ - 'Jinja2', - 'Werkzeug', - 'pytz', - 'isoweek', - 'pyyaml', - 'jsonpath-rw', - 'lxml', - 'beautifulsoup4', - 'numpy', - 'matplotlib', - 'mwclient', - 'mwtemplates', - 'mwtextextractor', - 'rollbar', - 'flipflop', - 'flask', - 'requests', - 'pymysql', - 'psutil', - 'python-dotenv', - 'pydash', - 'retry', - 'more-itertools', - ]) diff --git a/ukbot/ukbot.py b/ukbot/ukbot.py index fbf0d28..3539826 100644 --- a/ukbot/ukbot.py +++ b/ukbot/ukbot.py @@ -17,6 +17,7 @@ from mwtemplates import TemplateEditor import platform from dotenv import load_dotenv +from importlib.metadata import version from .common import get_mem_usage, Localization, _, STATE_NORMAL, InvalidContestPage from .util import load_config @@ -26,6 +27,7 @@ matplotlib.use('svg') +__version__ = version('ukbot') class AppFilter(logging.Filter): @@ -119,8 +121,9 @@ def main(): mainstart.strftime('%F %T'), mainstart.astimezone(config['wiki_timezone']).strftime('%F %T')) logger.info( - 'Platform: Python %s, Mwclient %s, %s', + 'Platform: Python %s, UKBot %s, Mwclient %s, %s', platform.python_version(), + __version__, mwclient.__version__, platform.platform() )