diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2b1af89 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "thoth_pre_commit_hook" +description = "Get Thoth recommendations in a pre-commit hook." +authors = [ + { name = "Maya Costantini", email = "mcostant@redhat.com" } +] +license = { text = "GPLv3+" } +dynamic = [ "version", "dependencies" ] + +[project.readme] +file = "README.md" +content-type = "text/markdown" + +[project.urls] +Homepage = "https://github.com/thoth-station/thoth-pre-commit-hook" +"Source Code" = "https://github.com/thoth-station/thoth-pre-commit-hook/" +Issues = "https://github.com/thoth-station/thoth-pre-commit-hook/issues" +Changelog = "https://github.com/thoth-station/thoth-pre-commit-hook/blob/master/CHANGELOG.md" + +[project.scripts] +thoth-advise = "thoth_pre_commit_hook.thoth_advise:main" + +[tool.setuptools] +zip-safe = false +packages = ["thoth_pre_commit_hook"] + +[tool.setuptools.dynamic] +version = {attr = "thoth.thoth_pre_commit_hook.__version__"} +dependencies = { file = ["requirements.txt"] } diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..554a50e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ +[build_sphinx] +version = attr: thoth.thoth_pre_commit_hook.__version__ +release = attr: thoth.thoth_pre_commit_hook.__version__ + +[options] +package_dir = + thoth_pre_commit_hook = ./thoth/thoth_pre_commit_hook diff --git a/setup.py b/setup.py deleted file mode 100644 index 2640aa6..0000000 --- a/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -"""This file sets up the thoth-pre-commit-hook module.""" - -import os -from setuptools import setup -from pathlib import Path - - -def get_install_requires(): - """Get thoth pre-commit hook installation requirements.""" - with open("requirements.txt", "r") as requirements_file: - return [req for req in requirements_file.readlines() if req] - - -def get_version(): - """Get thoth pre-commit hook version.""" - with open(os.path.join("thoth/thoth_pre_commit_hook", "__init__.py")) as f: - content = f.readlines() - - for line in content: - if line.startswith("__version__ ="): - # dirty, remove trailing and leading chars - return line.split(" = ")[1][1:-2] - raise ValueError("No version identifier found") - - -VERSION = get_version() -setup( - name="thoth_pre_commit_hook", - entry_points={ - "console_scripts": ["thoth-advise = thoth_pre_commit_hook.thoth_advise:main"] - }, - version=VERSION, - url="https://github.com/thoth-station/thoth-pre-commit-hook", - description="Get Thoth recommendations in a pre-commit hook.", - long_description=Path("README.md").read_text(), - author="Maya Costantini", - author_email="mcostant@redhat.com", - license="GPLv3+", - packages=["thoth_pre_commit_hook"], - package_dir={ - "thoth_pre_commit_hook": "./thoth/thoth_pre_commit_hook", - }, - long_description_content_type="text/markdown", - project_urls={ - "Source Code": "https://github.com/thoth-station/thoth-pre-commit-hook/", - "Issues": "https://github.com/thoth-station/thoth-pre-commit-hook/issues", - "Changelog": "https://github.com/thoth-station/thoth-pre-commit-hook/blob/master/CHANGELOG.md", - }, - install_requires=get_install_requires(), - command_options={ - "build_sphinx": { - "version": ("setup.py", VERSION), - "release": ("setup.py", VERSION), - } - }, -)