Skip to content

Commit

Permalink
Revert "Revert "Add pyproject.toml file (#11305)" (#11467)"
Browse files Browse the repository at this point in the history
This reverts commit 0462336.
  • Loading branch information
ofek authored Feb 8, 2022
1 parent 54aab6b commit 9900e63
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 15 deletions.
62 changes: 62 additions & 0 deletions datadog_checks_downloader/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[build-system]
requires = [
"hatchling>=0.11.2",
"setuptools; python_version < '3.0'",
]
build-backend = "hatchling.build"

[project]
name = "datadog-checks-downloader"
description = "The Datadog Checks Downloader"
readme = "README.md"
license = "BSD-3-Clause"
keywords = [
"datadog",
"datadog agent",
"datadog check",
]
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",
]
dynamic = [
"version",
]

[project.optional-dependencies]
deps = [
"in-toto==1.0.1",
"securesystemslib[crypto,pynacl]==0.20.1",
"tuf==0.17.0; python_version < '3.0'",
"tuf==0.19.0; python_version > '3.0'",
]

[project.urls]
Source = "https://github.com/DataDog/integrations-core"

[tool.hatch.version]
path = "datadog_checks/downloader/__about__.py"

[tool.hatch.build.targets.sdist]
include = [
"/datadog_checks",
"/tests",
"/requirements-dev.txt",
"/tox.ini",
]

[tool.hatch.build.targets.wheel]
include = [
"/datadog_checks",
]
dev-mode-dirs = [
".",
]
13 changes: 0 additions & 13 deletions datadog_checks_downloader/requirements.in

This file was deleted.

17 changes: 16 additions & 1 deletion datadog_checks_downloader/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ def get_dependencies():
return f.readlines()


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)


setup(
# Version should always match one from an agent release
version=ABOUT["__version__"],
Expand All @@ -52,7 +67,7 @@ def get_dependencies():
],
packages=['datadog_checks.downloader'],
# Run-time dependencies
extras_require={'deps': get_dependencies()},
extras_require={'deps': parse_pyproject_array('deps')},
# NOTE: Copy over TUF directories, and root metadata.
package_data={
'datadog_checks.downloader': [
Expand Down
2 changes: 1 addition & 1 deletion datadog_checks_downloader/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ envdir =
py38: {toxworkdir}/py38
dd_check_style = true
usedevelop = true
extras = deps
deps =
-e../datadog_checks_base[deps]
-rrequirements-dev.txt
commands =
pip install -r requirements.in
pytest -v {posargs} --capture=no --log-cli-level=debug

0 comments on commit 9900e63

Please sign in to comment.