From 63851d7c6282b24b4286acc92e635fc91bc2265f Mon Sep 17 00:00:00 2001
From: Manon Blanco <blanco@teklia.com>
Date: Fri, 5 Jan 2024 08:54:40 +0000
Subject: [PATCH] Use pyproject.toml to store package metadata

---
 MANIFEST.in    |  2 --
 VERSION        |  1 -
 pyproject.toml | 26 ++++++++++++++++++++++++++
 setup.py       | 37 -------------------------------------
 4 files changed, 26 insertions(+), 40 deletions(-)
 delete mode 100644 MANIFEST.in
 delete mode 100644 VERSION
 delete mode 100644 setup.py

diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index fd959fa..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,2 +0,0 @@
-include requirements.txt
-include VERSION
diff --git a/VERSION b/VERSION
deleted file mode 100644
index 0d91a54..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.3.0
diff --git a/pyproject.toml b/pyproject.toml
index 24be6f8..79fa552 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,3 +1,29 @@
+[build-system]
+requires = ["setuptools >= 61.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "nerval"
+version = "0.3.0"
+description = "Tool to evaluate NER on noisy text."
+dynamic = ["dependencies"]
+authors = [
+    { name = "Teklia", email = "contact@teklia.com" },
+]
+maintainers = [
+    { name = "Teklia", email = "contact@teklia.com" },
+]
+readme = { file = "README.md", content-type = "text/markdown" }
+
+[project.scripts]
+nerval = "nerval.cli:main"
+
+[tool.setuptools]
+packages = ["nerval"]
+
+[tool.setuptools.dynamic]
+dependencies = { file = ["requirements.txt"] }
+
 [tool.ruff]
 exclude = [".git", "__pycache__"]
 ignore = [
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 611c366..0000000
--- a/setup.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-from pathlib import Path
-
-from setuptools import find_packages, setup
-
-
-def parse_requirements_line(line):
-    """Special case for git requirements"""
-    if line.startswith("git+http"):
-        assert "@" in line, "Branch should be specified with suffix (ex: @master)"
-        assert (
-            "#egg=" in line
-        ), "Package name should be specified with suffix (ex: #egg=kraken)"
-        package_name = line.split("#egg=")[-1]
-        return f"{package_name} @ {line}"
-    else:
-        return line
-
-
-def parse_requirements():
-    path = Path(__file__).parent.resolve() / "requirements.txt"
-    assert path.exists(), f"Missing requirements: {path}"
-    return list(
-        map(parse_requirements_line, map(str.strip, path.read_text().splitlines())),
-    )
-
-
-setup(
-    name="nerval",
-    version=Path("VERSION").read_text(),
-    description="Tool to evaluate NER on noisy text.",
-    author="Teklia",
-    author_email="contact@teklia.com",
-    packages=find_packages(),
-    entry_points={"console_scripts": ["nerval=nerval.cli:main"]},
-    install_requires=parse_requirements(),
-)
-- 
GitLab