From 4ab369f95b4c5fca696a0ede1aebb7443f0aa949 Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Tue, 10 Jan 2023 08:53:54 +1100 Subject: [PATCH] Package tool for PyPI/pip distribution. --- pyproject.toml | 38 +++++++++++++++++++ .../fediblockhole/__init__.py | 6 +-- 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 pyproject.toml rename bin/fediblock_sync.py => src/fediblockhole/__init__.py (99%) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..107ad9e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[project] +name = "fediblockhole" +version = "0.2.1" +description = "Federated blocklist management for Mastodon" +readme = "README.md" +license = {file = "LICENSE"} +requires-python = ">=3.6" +keywords = ["mastodon", "fediblock"] +authors = [ + {name = "Justin Warren"}, {email = "justin@eigenmagic.com"} +] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU Affero General Public License v3", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", +] +dependencies = [ + "requests", + "toml" +] + +[project.urls] +homepage = "https://github.com/eigenmagic/fediblockhole" +documentation = "https://github.com/eigenmagic/fediblockhole" +repository = "https://github.com/eigenmagic/fediblockhole" + +[project.scripts] +fediblock-sync = "fediblockhole:main" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" +# requires = ["flit_core >=3.4,<4"] +# build-backend = "flit_core.buildapi" \ No newline at end of file diff --git a/bin/fediblock_sync.py b/src/fediblockhole/__init__.py similarity index 99% rename from bin/fediblock_sync.py rename to src/fediblockhole/__init__.py index 5d222d0..37d63f8 100755 --- a/bin/fediblock_sync.py +++ b/src/fediblockhole/__init__.py @@ -1,5 +1,5 @@ -#!/usr/bin/python3 -# Export and import blocklists via API +"""A tool for managing federated Mastodon blocklists +""" import argparse import toml @@ -571,7 +571,7 @@ def str2bool(boolstring: str) -> bool: else: raise ValueError(f"Cannot parse value '{boolstring}' as boolean") -if __name__ == '__main__': +def main(): ap = argparse.ArgumentParser(description="Bulk blocklist tool", formatter_class=argparse.ArgumentDefaultsHelpFormatter)