Skip to content

Commit

Permalink
Add pyproject.toml file (#11323)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Feb 17, 2022
1 parent 3a3ba79 commit b99d5c8
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 14 deletions.
10 changes: 0 additions & 10 deletions ceph/MANIFEST.in

This file was deleted.

62 changes: 62 additions & 0 deletions ceph/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-ceph"
description = "The Ceph check"
readme = "README.md"
license = "BSD-3-Clause"
keywords = [
"datadog",
"datadog agent",
"datadog check",
"ceph",
]
authors = [
{ name = "Datadog", email = "[email protected]" },
]
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>=11.2.0",
]
dynamic = [
"version",
]

[project.optional-dependencies]
deps = []

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

[tool.hatch.version]
path = "datadog_checks/ceph/__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 = [
".",
]
1 change: 0 additions & 1 deletion ceph/requirements.in

This file was deleted.

19 changes: 17 additions & 2 deletions ceph/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@ def get_dependencies():
return f.readlines()


CHECKS_BASE_REQ = 'datadog-checks-base>=11.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(
name='datadog-ceph',
Expand Down Expand Up @@ -58,7 +73,7 @@ def get_dependencies():
packages=['datadog_checks.ceph'],
# 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,
)
2 changes: 1 addition & 1 deletion ceph/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ description =
dd_check_style = true
usedevelop = true
platform = linux|darwin|win32
extras = deps
deps =
-e../datadog_checks_base[deps]
-rrequirements-dev.txt
Expand All @@ -24,5 +25,4 @@ passenv =
DOCKER*
COMPOSE*
commands =
pip install -r requirements.in
pytest -v {posargs}

0 comments on commit b99d5c8

Please sign in to comment.