From ce93ecd7da230051a5ccae7f616ece158f9ae1be Mon Sep 17 00:00:00 2001
From: Stepan Henek <stepan.henek@nic.cz>
Date: Thu, 7 Dec 2023 15:39:44 +0100
Subject: [PATCH] chore: migrate to hatchling instead of setuptools

---
 COPYING => LICENSE |  0
 pyproject.toml     | 52 +++++++++++++++++++++++++++++++++++++++
 setup.cfg          |  7 ------
 setup.py           | 61 ----------------------------------------------
 4 files changed, 52 insertions(+), 68 deletions(-)
 rename COPYING => LICENSE (100%)
 create mode 100644 pyproject.toml
 delete mode 100644 setup.cfg
 delete mode 100644 setup.py

diff --git a/COPYING b/LICENSE
similarity index 100%
rename from COPYING
rename to LICENSE
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..eceed8e
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,52 @@
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+[project]
+name = "foris-ws"
+dynamic = ["version"]
+description = "Implementation of websocket server for foris notification system."
+readme = "README.rst"
+license = "GPL-3.0"
+requires-python = ">=3.9"
+authors = [
+    { name = "CZ.NIC, z.s.p.o. (http://www.nic.cz/)", email = "packaging@turris.cz" },
+]
+dependencies = [
+    "foris-client",
+    "websockets",
+]
+
+[project.optional-dependencies]
+fs_auth = [
+    "cachelib",
+]
+mqtt = [
+    "paho-mqtt",
+]
+tests = [
+    "cachelib",
+    "foris-controller",
+    "paho-mqtt",
+    "pytest",
+    "tox",
+    "ubus",
+    "websocket-client",
+]
+ubus = [
+    "ubus",
+]
+
+[project.scripts]
+foris-ws = "foris_ws.__main__:main"
+
+[project.urls]
+Homepage = "https://gitlab.nic.cz/turris/foris-controller/foris-ws"
+
+[tool.hatch.version]
+path = "foris_ws/__init__.py"
+
+[tool.hatch.build.targets.sdist]
+include = [
+    "/foris_ws",
+]
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index d4c9990..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-[aliases]
-test=pytest
-
-[tool:pytest]
-addopts = --verbose
-python_files = tests/test_*.py
-console_output_style = count
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 090da05..0000000
--- a/setup.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-#
-# foris-ws
-# Copyright (C) 2019-2023 CZ.NIC, z.s.p.o. (http://www.nic.cz/)
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
-#
-
-from setuptools import setup
-from foris_ws import __version__
-
-DESCRIPTION = """
-Implementation of websocket server for foris notification system.
-"""
-
-setup(
-    name="foris-ws",
-    version=__version__,
-    author="CZ.NIC, z.s.p.o. (http://www.nic.cz/)",
-    author_email="packaging@turris.cz",
-    packages=["foris_ws", "foris_ws/authentication"],
-    url="https://gitlab.nic.cz/turris/foris-controller/foris-ws",
-    license="COPYING",
-    description=DESCRIPTION,
-    long_description=open("README.rst").read(),
-    install_requires=[
-        "websockets",
-        "foris-client",
-    ],
-    setup_requires=["pytest-runner"],
-    extras_require={
-        "ubus": ["ubus"],
-        "mqtt": ["paho-mqtt"],
-        "fs_auth":["cachelib"],
-        "tests": [
-            "ubus",
-            "paho-mqtt",
-            "cachelib",
-            "pytest",
-            "websocket-client",
-            "foris-controller",
-            "tox",
-        ],
-    },
-    tests_require=[],
-    entry_points={"console_scripts": ["foris-ws = foris_ws.__main__:main"]},
-    python_requires=">=3.9"
-)
-- 
GitLab