Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyproject.toml file #11378

Merged
merged 1 commit into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions kafka_consumer/MANIFEST.in

This file was deleted.

65 changes: 65 additions & 0 deletions kafka_consumer/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[build-system]
requires = [
"hatchling>=0.11.2",
"setuptools; python_version < '3.0'",
]
build-backend = "hatchling.build"

[project]
name = "datadog-kafka-consumer"
description = "The Kafka Consumer check"
readme = "README.md"
license = "BSD-3-Clause"
keywords = [
"datadog",
"datadog agent",
"datadog check",
"kafka_consumer",
]
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>=15.3.0",
]
dynamic = [
"version",
]

[project.optional-dependencies]
deps = [
"kafka-python==2.0.2",
"kazoo==2.8.0",
]

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

[tool.hatch.version]
path = "datadog_checks/kafka_consumer/__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 = [
".",
]
2 changes: 0 additions & 2 deletions kafka_consumer/requirements.in

This file was deleted.

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


CHECKS_BASE_REQ = 'datadog-checks-base>=15.3.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-kafka_consumer',
Expand Down Expand Up @@ -56,7 +71,7 @@ def get_dependencies():
packages=['datadog_checks.kafka_consumer'],
# 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 kafka_consumer/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ platform = linux|darwin|win32
passenv =
DOCKER*
COMPOSE*
extras = deps
deps =
-e../datadog_checks_base[deps]
-rrequirements-dev.txt
-e../datadog_checks_tests_helper
commands =
pip install -r requirements.in
pytest -v {posargs}
setenv =
USE_MULTIPLE_BROKERS=true
Expand Down