From 814b8d2afa0d79544fb9c6c0e01fbcc814fbfad7 Mon Sep 17 00:00:00 2001 From: dgw Date: Thu, 20 Jun 2024 15:56:04 -0500 Subject: [PATCH] Modernize the heck out of things MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * `pyproject.toml` packaging * Entry-point plugin style; no more `sopel_modules` namespace * Compatibility with Sopel 8 * Drop Python 2 and EOL 3.x releases; minimum now py3.8 * Drop Sopel 7.0 (but keep 7.1 for now, except on old Pythons) * Improved documentation, metadata, etc. Closes #2 🥳 --- MANIFEST.in | 2 - NEWS | 29 +++++++-- README.md | 29 +++++++-- pyproject.toml | 62 +++++++++++++++++++ requirements.txt | 1 - setup.py | 44 ------------- .../__init__.py | 0 .../plugin.py | 12 ++-- sopel_modules/__init__.py | 1 - sopel_modules/inclusivity/__init__.py | 13 ---- tests/__init__.py | 1 - tests/test_inclusivity.py | 14 ----- 12 files changed, 116 insertions(+), 92 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100755 setup.py rename dev-requirements.txt => sopel_inclusivity/__init__.py (100%) rename sopel_modules/inclusivity/inclusivity.py => sopel_inclusivity/plugin.py (68%) delete mode 100644 sopel_modules/__init__.py delete mode 100644 sopel_modules/inclusivity/__init__.py delete mode 100644 tests/__init__.py delete mode 100644 tests/test_inclusivity.py diff --git a/MANIFEST.in b/MANIFEST.in index 60ca266..10b886b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,6 @@ include NEWS include COPYING include README.md -include *requirements.txt -recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] diff --git a/NEWS b/NEWS index acca116..b6066e4 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,24 @@ -Changes between 0.1.0 and 0.2.0 -=============================== - -Changed: -* Updated compatibility for Sopel 7 +## Changelog + +### 0.3.0 + +First release as `sopel-inclusivity`, replacing `sopel_modules.inclusivity`. + +Changed: +* Updated compatibility for Sopel 8 +* Minimum Sopel version is now 7.1 +* Use newer `search` rule type, instead of bookending pattern with `.*` + +Meta: +* Packaging converted to `pyproject.toml` and modernized + * Package name has changed: `sopel_modules.inclusivity` → `sopel-inclusivity` +* Author & Maintainer metadata corrected to credit embolalia as the creator + +### 0.2.0 + +Changed: +* Updated compatibility for Sopel 7 + +### 0.1.0 + +Initial release of `sopel_modules.inclusivity`. diff --git a/README.md b/README.md index 8d44096..15f640f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,25 @@ # sopel-inclusivity -Sopel Inclusive Language suggests better wordings when people don't use -inclusive language. It's inspired by [this blog -post](https://18f.gsa.gov/2016/01/12/hacking-inclusion-by-customizing-a-slack-bot/) -from 18F, who've added a similar feature to their Slack rooms. It only deals -with use of the word "guys" for now, but if there is any other language it -could cover, PRs are welcome. +Have your Sopel bot suggest more inclusive language + +## Installing + +Releases are hosted on PyPI, so after installing Sopel, all you need is `pip`: + +```shell +$ pip install sopel-inclusivity +``` + +### Requirements + +The `sopel-inclusivity` plugin is compatible with Sopel 7.1 or higher, but your +bot must run on Python 3.8 or higher; legacy Python versions are not supported. + +## Functionality + +`sopel-inclusivity` suggests better wordings when people don't use inclusive +language in chat. It's inspired by [this blog post][18f-post] from 18F, who +added a similar feature to their Slack rooms. It only deals with use of the word +"guys" for now, but PRs are welcome to add coverage of more vocabulary. + +[18f-post]: https://18f.gsa.gov/2016/01/12/hacking-inclusion-by-customizing-a-slack-bot/ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..48dd8f0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,62 @@ +[build-system] +requires = ["setuptools>=63.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +platforms = ["Linux x86, x86-64"] + +[tool.setuptools.packages.find] +include = ["sopel_inclusivity", "sopel_inclusivity.*"] +namespaces = false + +[tool.setuptools.dynamic] +readme = { file=["README.md", "NEWS"], content-type="text/markdown" } + +[project] +name = "sopel-inclusivity" +version = "0.3.0.dev0" +description = "Have your Sopel bot suggest more inclusive language" + +authors = [ + { name="Elsie Powell" }, +] + +maintainers = [ + { name="dgw", email="dgw@technobabbl.es" }, +] + +license = { text="EFL-2.0" } +dynamic = ["readme"] + +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: Eiffel Forum License (EFL)", + "License :: OSI Approved :: Eiffel Forum License", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Communications :: Chat :: Internet Relay Chat", +] +keywords = [ + "sopel", + "plugin", + "bot", + "irc", +] + +requires-python = ">=3.8, <4" +dependencies = [ + "sopel>=7.1", +] + +[project.urls] +"Homepage" = "https://github.com/sopel-irc/sopel-inclusivity" +"Bug Tracker" = "https://github.com/sopel-irc/sopel-inclusivity/issues" + +[project.entry-points."sopel.plugins"] +"inclusivity" = "sopel_inclusivity.plugin" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4c14b8c..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -sopel>=7.0,<8 diff --git a/setup.py b/setup.py deleted file mode 100755 index 97684b1..0000000 --- a/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import print_function -import os -import sys -from setuptools import setup, find_packages - - -if __name__ == '__main__': - print('Sopel does not correctly load plugins installed with setup.py ' - 'directly. Please use "pip install .", or add {}/sopel_modules to ' - 'core.extra in your config.'.format( - os.path.dirname(os.path.abspath(__file__))), - file=sys.stderr) - -with open('README.md') as readme_file: - readme = readme_file.read() - -with open('NEWS') as history_file: - history = history_file.read() - -with open('requirements.txt') as requirements_file: - requirements = [req for req in requirements_file.readlines()] - -with open('dev-requirements.txt') as dev_requirements_file: - dev_requirements = [req for req in dev_requirements_file.readlines()] - - -setup( - name='sopel_modules.inclusivity', - version='0.2.0', - description="Sopel Inclusive Language suggests better wordings when people don't use inclusive language", - long_description=readme + '\n\n' + history, - long_description_content_type='text/markdown', - author='dgw', - author_email='dgw@technobabbl.es', - url='https://github.com/sopel-irc/sopel-inclusivity', - packages=find_packages('.'), - namespace_packages=['sopel_modules'], - include_package_data=True, - install_requires=requirements, - tests_require=dev_requirements, - test_suite='tests', - license='Eiffel Forum License, version 2', -) diff --git a/dev-requirements.txt b/sopel_inclusivity/__init__.py similarity index 100% rename from dev-requirements.txt rename to sopel_inclusivity/__init__.py diff --git a/sopel_modules/inclusivity/inclusivity.py b/sopel_inclusivity/plugin.py similarity index 68% rename from sopel_modules/inclusivity/inclusivity.py rename to sopel_inclusivity/plugin.py index c03463c..96e9974 100644 --- a/sopel_modules/inclusivity/inclusivity.py +++ b/sopel_inclusivity/plugin.py @@ -1,10 +1,12 @@ -# coding=utf-8 +"""sopel-inclusivity -from __future__ import unicode_literals, absolute_import, division, print_function +Inclusive language plugin for Sopel IRC bots +""" +from __future__ import annotations import random -from sopel import module +from sopel import plugin # Works for generic "hi, guys", but maybe not "you (specific group of) guys" @@ -14,11 +16,11 @@ yall = ["y'all", 'you all', 'you folks'] -@module.rule('(hey|hi|yo|hello|howdy|um|er|oh)[,.?!:;]? guys') +@plugin.rule('(hey|hi|yo|hello|howdy|um|er|oh)[,.?!:;]? guys') def hi_guys(bot, trigger): bot.reply('Did you mean {}?'.format(random.choice(greet))) -@module.rule('.*you guys.*') +@plugin.search('you guys') def you_guys(bot, trigger): bot.reply('Did you mean {}?'.format(random.choice(yall))) diff --git a/sopel_modules/__init__.py b/sopel_modules/__init__.py deleted file mode 100644 index de40ea7..0000000 --- a/sopel_modules/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/sopel_modules/inclusivity/__init__.py b/sopel_modules/inclusivity/__init__.py deleted file mode 100644 index aef96b5..0000000 --- a/sopel_modules/inclusivity/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# coding=utf8 -"""Sopel Inclusive Language - -Sopel Inclusive Language suggests better wordings when people don't use inclusive language -""" -from __future__ import unicode_literals, absolute_import, division, print_function - -from .inclusivity import * - -__author__ = 'dgw' -__email__ = 'dgw@technobabbl.es' -__version__ = '0.2.0' - diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 9bad579..0000000 --- a/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# coding=utf-8 diff --git a/tests/test_inclusivity.py b/tests/test_inclusivity.py deleted file mode 100644 index ebf76b3..0000000 --- a/tests/test_inclusivity.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -# coding=utf-8 -from __future__ import unicode_literals, absolute_import, division, print_function - -import unittest - -from sopel_modules.inclusivity import inclusivity - -class TestInclusivity(unittest.TestCase): - def setUp(self): - pass - - def testSomething(self): - pass