Skip to content

Commit 79d2dd5

Browse files
committed
Move tox config to pyproject.toml, return to old version accessing strategy, remove Python 3.7
1 parent a0498aa commit 79d2dd5

File tree

5 files changed

+203
-304
lines changed

5 files changed

+203
-304
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ docs:
3434
.PHONY: test
3535
test:
3636
@echo "$(ATTN_COLOR)==> test $(NO_COLOR)"
37-
@tox -e py37,py39
37+
@tox -e py39,py313
3838

3939
.PHONY: test_specific
4040
test_specific:
@@ -44,17 +44,17 @@ test_specific:
4444
.PHONY: test_smoke
4545
test_smoke:
4646
@echo "$(ATTN_COLOR)==> test_smoke $(NO_COLOR)"
47-
@tox -e py37,py39 -- -m smoke
47+
@tox -e py39,py313 -- -m smoke
4848

4949
.PHONY: test_no_app
5050
test_no_app:
5151
@echo "$(ATTN_COLOR)==> test_no_app $(NO_COLOR)"
52-
@tox -e py37,py39 -- -m "not app"
52+
@tox -e py39,py313 -- -m "not app"
5353

5454
.PHONY: test_smoke_no_app
5555
test_smoke_no_app:
5656
@echo "$(ATTN_COLOR)==> test_smoke_no_app $(NO_COLOR)"
57-
@tox -e py37,py39 -- -m "smoke and not app"
57+
@tox -e py39,py313 -- -m "smoke and not app"
5858

5959
.PHONY: env
6060
env:

pyproject.toml

Lines changed: 89 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
44

5+
[project.urls]
6+
HOMEPAGE = "https://pypi.org/project/splunk-sdk"
7+
DOCS = "https://docs.splunk.com/Documentation/PythonSDK/2.0.0"
8+
REPO = "http://github.com/splunk/splunk-sdk-python.git"
9+
510
[project]
611
name = "splunk-sdk"
7-
version = "2.1.0"
812
description = "The Splunk Software Development Kit for Python"
913
readme = "README.md"
10-
requires-python = ">=3.9, <4"
14+
requires-python = ">=3.9.23"
1115
license = { file = "LICENSE" }
1216
authors = [{ name = "Splunk, Inc.", email = "[email protected]" }]
17+
dynamic = ["version"]
1318
classifiers = [
1419
"Programming Language :: Python",
1520
"Development Status :: 6 - Mature",
@@ -22,29 +27,91 @@ classifiers = [
2227

2328
dependencies = [
2429
"deprecation>=2.1.0",
25-
"importlib-metadata>=6.7.0",
26-
"python-dotenv>=0.21.1",
27-
"flake8>=3.9.2",
28-
"flake8-blind-except>=0.2.1",
29-
"flake8-builtins>=2.1.0",
30-
"flake8-docstrings>=1.7.0",
31-
"flake8-import-order>=0.19.2",
32-
"flake8-logging-format>=2024.24.12",
33-
"flake8-rst-docstrings>=0.3.0",
34-
"pylint>=2.13.9",
35-
"pytest>=7.4.4",
36-
"pytest-cov>=4.1.0",
37-
"six>=1.17.0",
38-
"tox>=4.8.0",
39-
"twine>=4.0.2",
40-
"types-setuptools>=69.0.0.0",
30+
"mypy>=1.17.1",
31+
"python-dotenv>=1.1.1",
32+
"ruff>=0.12.7",
33+
"setuptools>=80.9.0",
34+
"tox>=4.28.3",
35+
"twine>=6.1.0",
36+
"types-setuptools>=80.9.0.20250529",
4137
]
4238

4339
# TODO :(
4440
# [dependency-groups]
4541
# dev = []
4642

47-
[project.urls]
48-
HOMEPAGE = "https://pypi.org/project/splunk-sdk"
49-
DOCS = "https://docs.splunk.com/Documentation/PythonSDK/2.0.0"
50-
REPO = "http://github.com/splunk/splunk-sdk-python.git"
43+
[tool.setuptools.dynamic]
44+
version = { attr = "splunklib.__version__" }
45+
46+
# https://docs.astral.sh/ruff/configuration/
47+
[tool.ruff]
48+
line-length = 120
49+
indent-width = 4
50+
51+
[tool.ruff.format]
52+
quote-style = "double"
53+
indent-style = "space"
54+
line-ending = "auto"
55+
56+
[tool.ruff.lint]
57+
select = [
58+
"F", # pyflakes
59+
"E", # pycodestyle
60+
"I", # isort
61+
"ANN", # flake8 type annotations
62+
"RUF", # ruff-specific rules
63+
]
64+
fixable = ["ALL"]
65+
66+
[tool.tox]
67+
# https://tox.wiki/en/latest/config.html#pyproject-toml-ini
68+
legacy_tox_ini = """
69+
[tox]
70+
envlist = clean,docs,py39,313
71+
skipsdist = {env:TOXBUILD:false}
72+
73+
# TODO: Replace with ruff
74+
[testenv:pep8]
75+
deps = flake8
76+
flake8-import-order
77+
flake8-blind-except
78+
flake8-builtins
79+
flake8-docstrings
80+
flake8-rst-docstrings
81+
flake8-logging-format
82+
six
83+
commands = flake8
84+
85+
[flake8]
86+
exclude = .tox
87+
# If you need to ignore some error codes in the whole source code
88+
# you can write them here
89+
# ignore = D100,D101
90+
show-source = true
91+
enable-extensions = G
92+
application-import-names = splunk-sdk-python
93+
94+
[testenv]
95+
passenv = LANG
96+
setenv = SPLUNK_HOME=/opt/splunk
97+
allowlist_externals = make
98+
deps = pytest
99+
pytest-cov
100+
python-dotenv
101+
102+
distdir = build
103+
commands =
104+
{env:TOXBUILD:python -m pytest --junitxml=test-reports/junit-{envname}.xml --cov --cov-config=.coveragerc} {posargs}
105+
106+
[testenv:clean]
107+
deps = coverage
108+
skip-install = true
109+
commands = coverage erase
110+
111+
[testenv:docs]
112+
description = invoke sphinx-build to build the HTML docs
113+
basepython = python3.9
114+
deps = sphinx >= 1.7.5, < 2
115+
jinja2 < 3.1.0
116+
commands = make -C docs/ html
117+
"""

splunklib/__init__.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
"""Python library for Splunk."""
1616

17-
# Assure backport for Python <3.9
18-
try:
19-
from importlib.metadata import version as importlib_metadata_version
20-
except (ImportError, ModuleNotFoundError):
21-
from importlib_metadata import version as importlib_metadata_version
22-
2317
import logging
2418

2519
DEFAULT_LOG_FORMAT = (
@@ -38,5 +32,5 @@ def setup_logging(
3832
logging.basicConfig(level=level, format=log_format, datefmt=date_format)
3933

4034

41-
# Extract current package version from pyproject.toml
42-
__version__: str = importlib_metadata_version("splunk-sdk")
35+
__version_info__ = (2, 1, 0)
36+
__version__ = ".".join(map(str, __version_info__))

tox.ini

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)