diff --git a/riak_repl/MANIFEST.in b/riak_repl/MANIFEST.in deleted file mode 100644 index 46f690a5c7..0000000000 --- a/riak_repl/MANIFEST.in +++ /dev/null @@ -1,11 +0,0 @@ -graft datadog_checks -graft tests - -include MANIFEST.in -include README.md -include requirements.in -include requirements.txt -include requirements-dev.txt -include manifest.json - -global-exclude *.py[cod] __pycache__ diff --git a/riak_repl/pyproject.toml b/riak_repl/pyproject.toml new file mode 100644 index 0000000000..5a7ea8493e --- /dev/null +++ b/riak_repl/pyproject.toml @@ -0,0 +1,62 @@ +[build-system] +requires = [ + "hatchling>=0.12.0", + "setuptools; python_version < '3.0'", +] +build-backend = "hatchling.build" + +[project] +name = "datadog-riak-repl" +description = "The Riak MDC Replication check" +readme = "README.md" +license = "BSD-3-Clause" +keywords = [ + "datadog", + "datadog agent", + "datadog check", + "riak_repl", +] +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>=4.2.0", +] +dynamic = [ + "version", +] + +[project.optional-dependencies] +deps = [] + +[project.urls] +Source = "https://github.com/DataDog/integrations-extras" + +[tool.hatch.version] +path = "datadog_checks/riak_repl/__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/riak_repl", +] +dev-mode-dirs = [ + ".", +] diff --git a/riak_repl/requirements.in b/riak_repl/requirements.in deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/riak_repl/setup.py b/riak_repl/setup.py index 512b4d45b1..b133739cca 100644 --- a/riak_repl/setup.py +++ b/riak_repl/setup.py @@ -24,7 +24,22 @@ def get_dependencies(): return f.readlines() -CHECKS_BASE_REQ = 'datadog-checks-base>=4.2.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( @@ -56,7 +71,7 @@ def get_dependencies(): packages=['datadog_checks', 'datadog_checks.riak_repl'], # 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/riak_repl/tox.ini b/riak_repl/tox.ini index 807e4be29a..0985dbd29b 100644 --- a/riak_repl/tox.ini +++ b/riak_repl/tox.ini @@ -11,6 +11,7 @@ envdir = py38: {toxworkdir}/py38 dd_check_style = true platform = linux|darwin|win32 +extras = deps deps = datadog-checks-base[deps] -rrequirements-dev.txt @@ -18,7 +19,6 @@ passenv = DOCKER* COMPOSE* commands = - pip install -r requirements.in unit: pytest -v -m "not integration" {posargs} integration: pytest -v -m"integration" {posargs} setenv =