Refactor: Migrate to pyproject.toml 21/72221/5
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Thu, 5 Oct 2023 14:06:44 +0000 (07:06 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Thu, 5 Oct 2023 18:58:59 +0000 (11:58 -0700)
* Convert build configuration to a pure pyproject.toml project.
* Clamps reno notes generation to greater than v0.36.0

Issue: RELENG-4932
Change-Id: I10ebe156bb7712569fb06bd0c4b203074c3aed2b
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
MANIFEST.in [deleted file]
pyproject.toml
reno.yaml [new file with mode: 0644]
setup.cfg [deleted file]
setup.py [deleted file]
tox.ini

diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644 (file)
index 3456517..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-include etc/logging.ini
-include README.md
-include requirements.txt
-include requirements-docs.txt
-include requirements-openstack.txt
-
index bb9a629..89e15a0 100644 (file)
@@ -1,6 +1,151 @@
+[build-system]
+requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "lftools"
+dynamic = ["version"]
+description = "Linux Foundation Release Engineering Tools"
+readme = "README.md"
+requires-python = ">=3.8"
+license = {text = "EPL-1.0"}
+
+authors = [
+    {name = "LF Release Engineering", email = "releng@linuxfoundation.org"},
+]
+
+maintainers = [
+    {name = "LF Release Engineering", email = "releng@linuxfoundation.org"},
+]
+
+# Add here all kinds of additional classifiers as defined under
+# https://pypi.org/classifiers/
+classifiers = [
+    "Intended Audience :: Developers",
+    "Intended Audience :: Information Technology",
+    "License :: OSI Approved :: Eclipse Public License 1.0 (EPL-1.0)",
+    "Operating System :: POSIX :: Linux",
+    "Programming Language :: Python",
+    "Programming Language :: Python :: 3.8",
+    "Programming Language :: Python :: 3.9"
+]
+
+dependencies = [
+    "appdirs",
+    "aspy.yaml",
+    "attrs",
+    "beautifulsoup4",
+    "boto3",
+    "bs4",
+    "certifi",
+    "cfgv",
+    "chardet",
+    "click",
+    "defusedxml",
+    "Deprecated",
+    "dnspython",
+    "docker==4.2.2",
+    "email-validator",
+    "filelock",
+    "GitPython",
+    "httplib2",
+    "identify",
+    "idna",
+    "jinja2",
+    "jsonschema",
+    "lxml",
+    "multi-key-dict",
+    "nodeenv",
+    "oauth2client",
+    "openstacksdk<1.5.0",
+    "pbr",
+    "pyasn1",
+    "pyasn1-modules",
+    "pygerrit2",
+    "PyGithub",
+    "PyJWT",
+    "pyrsistent",
+    "python-jenkins",
+    "PyYAML",
+    "requests",
+    "rsa",
+    "ruamel.yaml",
+    "ruamel.yaml.clib",
+    "six",
+    "soupsieve",
+    "tabulate",
+    "toml",
+    "tqdm",
+    "urllib3<2.0.0",
+    "websocket-client",
+    "wrapt",
+    "xdg"
+]
+
+[project.optional-dependencies]
+dev = [
+    "mypy"
+]
+
+docs = [
+    "lfdocs-conf",
+    "reno",
+    "sphinxcontrib-programoutput"
+]
+
+ldap = [
+    "python-ldap~=3.1.0"
+]
+
+openstack = [
+    "osc-lib~=2.2.0"
+]
+
+test = [
+    "pytest==5.3.5",
+    "pytest-click==0.3",
+    "pytest-datafiles==2.0",
+    "pytest-mock==2.0.0",
+    "pytest-responses==0.4.0"
+]
+
+[project.urls]
+"Homepage" = "https://docs.releng.linuxfoundation.org/projects/lftools"
+"Bug Tracker" = "https://github.com/lfit/releng-tools/issues"
+"Documentation" = "https://docs.releng.linuxfoundation.org/projects/lftools"
+"Source Code" = "https://github.com/lfit/releng-lftools"
+
+[project.scripts]
+lftools = "lftools.cli:main"
+
+[tool.setuptools]
+platforms = ["linux"]
+script-files = [
+    "shell/deploy",
+    "shell/gerrit_create",
+    "shell/inactivecommitters",
+    "shell/sign",
+    "shell/version",
+    "shell/yaml4info",
+    "shell/autocorrectinfofile"
+]
+
+[tool.setuptools.packages.find]
+where = ["."]
+include = ["lftools*"]
+exclude = ["tests*"]
+
+
+[tool.setuptools_scm]
+# For smarter version schemes and other configuration options,
+# check out https://github.com/pypa/setuptools_scm
+local_scheme = "no-local-version"
+version_scheme = "python-simplified-semver"
+
+
 [tool.black]
 line-length = 120
-target-version = ['py36']
+target-version = ['py38']
 exclude = '''
 /(
     \.venv
diff --git a/reno.yaml b/reno.yaml
new file mode 100644 (file)
index 0000000..5b79125
--- /dev/null
+++ b/reno.yaml
@@ -0,0 +1,2 @@
+---
+earliest_version: v0.36.0
diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644 (file)
index b1ddbfc..0000000
--- a/setup.cfg
+++ /dev/null
@@ -1,45 +0,0 @@
-[metadata]
-name = lftools
-author = LF Releng
-author_email = releng@linuxfoundation.org
-summary = Linux Foundation Release Engineering Tools
-description_file = README.md
-description_content_type = text/x-rst; charset=UTF-8
-home_page = https://docs.releng.linuxfoundation.org/projects/lftools
-project_urls =
-    Bug Tracker = https://jira.linuxfoundation.org
-    Documentation = https://docs.releng.linuxfoundation.org/projects/lftools
-    Source Code = https://github.com/lfit/releng-lftools
-license = EPL-1.0
-classifier =
-    Intended Audience :: Developers
-    Intended Audience :: Information Technology
-    License :: OSI Approved :: Eclipse Public License 1.0 (EPL-1.0)
-    Operating System :: POSIX :: Linux
-    Programming Language :: Python
-    Programming Language :: Python :: 3.8
-    Programming Language :: Python :: 3.9
-
-[wheel]
-universal = 1
-
-[extras]
-ldap =
-    python-ldap~=3.1.0
-openstack =
-    osc-lib~=2.2.0
-
-[files]
-packages = lftools
-scripts =
-    shell/deploy
-    shell/gerrit_create
-    shell/inactivecommitters
-    shell/sign
-    shell/version
-    shell/yaml4info
-    shell/autocorrectinfofile
-
-[entry_points]
-console_scripts =
-    lftools = lftools.cli:main
diff --git a/setup.py b/setup.py
deleted file mode 100644 (file)
index 486ea9d..0000000
--- a/setup.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-# SPDX-License-Identifier: EPL-1.0
-##############################################################################
-# Copyright (c) 2017 The Linux Foundation and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-##############################################################################
-"""Setup.py."""
-
-from setuptools import find_packages, setup
-
-with open("requirements.txt") as f:
-    install_reqs = f.read().splitlines()
-
-with open("requirements-test.txt") as f:
-    f.readline()  # Skip the first -rrequirements.txt line
-    test_reqs = f.read().splitlines()
-
-setup(
-    setup_requires=["pbr", "pytest-runner"],
-    pbr=True,
-    install_requires=install_reqs,
-    packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
-    tests_require=test_reqs,
-)
diff --git a/tox.ini b/tox.ini
index b7a9a88..bca842f 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -16,7 +16,14 @@ addopts = -p no:warnings
 
 [testenv]
 basepython = python3
-deps = -r{toxinidir}/requirements-test.txt
+# This needs to mirror the test section of pyproject.toml
+deps =
+    pytest==5.3.5
+    pytest-click==0.3
+    pytest-datafiles==2.0
+    pytest-mock==2.0.0
+    pytest-responses==0.4.0
+
 commands = pytest
 usedevelop = true
 
@@ -42,29 +49,37 @@ commands =
 
 [testenv:docs]
 description = Build the documentation with sphinx
-basepython = python3
-deps = -rrequirements-docs.txt
+basepython = python3.8
+# This needs to mirror the docs section of pyproject.toml plus the testenv
+deps =
+    {[testenv]deps}
+    lfdocs-conf
+    reno
+    sphinxcontrib-programoutput
+
 extras = openstack
 commands = sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
 
 [testenv:docs-linkcheck]
 description = Check the documentation links with sphinx
-basepython = python3
-deps = -rrequirements-docs.txt
+basepython = python3.8
+deps =
+    {[testenv:docs]deps}
 extras = openstack
 commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
 
 [testenv:latest-upstream]
 description = Latest upstream test. Used for what exactly?
 basepython = python3
-deps = -r{toxinidir}/requirements-test.txt
+deps =
+    {[testenv:docs]deps}
 commands =
     pip install -U python-jenkins requests
     pytest
 
 [testenv:license]
 description = Check all files for license header
-basepython = python3
+basepython = python3.8
 deps = lftools
 commands =
     lftools license check-dir lftools
@@ -72,7 +87,7 @@ commands =
 
 [testenv:pre-commit]
 description = Precommit checks for black, gitlint, etc.
-basepython = python3.7
+basepython = python3.8
 allowlist_externals =
     /bin/sh
 deps =