From a23b555877ff4894351ca60b0021734d29ffb9ff Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Mon, 7 Feb 2022 11:25:25 -0500 Subject: [PATCH] Add `pyproject.toml` file --- activemq_xml/MANIFEST.in | 10 ------ activemq_xml/pyproject.toml | 62 ++++++++++++++++++++++++++++++++++++ activemq_xml/requirements.in | 1 - activemq_xml/setup.py | 19 +++++++++-- activemq_xml/tox.ini | 2 +- 5 files changed, 80 insertions(+), 14 deletions(-) delete mode 100644 activemq_xml/MANIFEST.in create mode 100644 activemq_xml/pyproject.toml delete mode 100644 activemq_xml/requirements.in diff --git a/activemq_xml/MANIFEST.in b/activemq_xml/MANIFEST.in deleted file mode 100644 index 6fa1c2388a4eb..0000000000000 --- a/activemq_xml/MANIFEST.in +++ /dev/null @@ -1,10 +0,0 @@ -graft datadog_checks -graft tests - -include MANIFEST.in -include README.md -include requirements.in -include requirements-dev.txt -include manifest.json - -global-exclude *.py[cod] __pycache__ diff --git a/activemq_xml/pyproject.toml b/activemq_xml/pyproject.toml new file mode 100644 index 0000000000000..6c9203dbbf3f7 --- /dev/null +++ b/activemq_xml/pyproject.toml @@ -0,0 +1,62 @@ +[build-system] +requires = [ + "hatchling>=0.11.2", + "setuptools; python_version < '3.0'", +] +build-backend = "hatchling.build" + +[project] +name = "datadog-activemq-xml" +description = "The ActiveMQ XML check" +readme = "README.md" +license = "BSD-3-Clause" +keywords = [ + "datadog", + "datadog agent", + "datadog check", + "activemq_xml", +] +authors = [ + { name = "Datadog", email = "packages@datadoghq.com" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.8", + "Topic :: System :: Monitoring", +] +dependencies = [ + "datadog-checks-base>=24.0.0", +] +dynamic = [ + "version", +] + +[project.optional-dependencies] +deps = [] + +[project.urls] +Source = "https://github.com/DataDog/integrations-core" + +[tool.hatch.version] +path = "datadog_checks/activemq_xml/__about__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/datadog_checks", + "/tests", + "/manifest.json", + "/requirements-dev.txt", + "/tox.ini", +] + +[tool.hatch.build.targets.wheel] +include = [ + "/datadog_checks", +] +dev-mode-dirs = [ + ".", +] diff --git a/activemq_xml/requirements.in b/activemq_xml/requirements.in deleted file mode 100644 index 8b137891791fe..0000000000000 --- a/activemq_xml/requirements.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/activemq_xml/setup.py b/activemq_xml/setup.py index 92ce4328f0b37..7a097eab0a46a 100644 --- a/activemq_xml/setup.py +++ b/activemq_xml/setup.py @@ -29,7 +29,22 @@ def get_dependencies(): return f.readlines() -CHECKS_BASE_REQ = 'datadog-checks-base>=24.0.0' +def parse_pyproject_array(name): + import os + import re + from ast import literal_eval + + pattern = r'^{} = (\[.*?\])$'.format(name) + + with open(os.path.join(HERE, 'pyproject.toml'), 'r', encoding='utf-8') as f: + # Windows \r\n prevents match + contents = '\n'.join(line.rstrip() for line in f.readlines()) + + array = re.search(pattern, contents, flags=re.MULTILINE | re.DOTALL).group(1) + return literal_eval(array) + + +CHECKS_BASE_REQ = parse_pyproject_array('dependencies')[0] setup( name='datadog-activemq_xml', @@ -61,7 +76,7 @@ def get_dependencies(): packages=['datadog_checks.activemq_xml'], # Run-time dependencies install_requires=[CHECKS_BASE_REQ], - extras_require={'deps': get_dependencies()}, + extras_require={'deps': parse_pyproject_array('deps')}, # Extra files to ship with the wheel package include_package_data=True, ) diff --git a/activemq_xml/tox.ini b/activemq_xml/tox.ini index 8c370229af79d..338179e0e77b9 100644 --- a/activemq_xml/tox.ini +++ b/activemq_xml/tox.ini @@ -14,6 +14,7 @@ description = usedevelop = true dd_check_style = true platform = linux|darwin|win32 +extras = deps deps = -e../datadog_checks_base[deps] -rrequirements-dev.txt @@ -22,5 +23,4 @@ passenv = DOCKER* setenv = ACTIVEMQ_XML_VERSION=5.11.1 commands = - pip install -r requirements.in pytest -v {posargs}