Skip to content

Commit a6214e1

Browse files
committed
Upstream updates to some project files
1 parent b581ae1 commit a6214e1

File tree

4 files changed

+857
-2468
lines changed

4 files changed

+857
-2468
lines changed

Makefile

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,64 @@
1-
CONTAINER_NAME := "splunk"
1+
### Conveniences for splunk-sdk-python development
2+
3+
## VIRTUALENV MANAGEMENT
4+
5+
# https://docs.astral.sh/uv/reference/cli/#uv-run--upgrade
6+
# --no-config skips Splunk's internal PyPI mirror
7+
UV_SYNC_CMD := uv sync --no-config
8+
9+
.PHONY: uv-sync
10+
uv-sync:
11+
$(UV_SYNC_CMD) --dev
12+
13+
.PHONY: uv-upgrade
14+
uv-upgrade:
15+
$(UV_SYNC_CMD) --dev --upgrade
16+
17+
18+
# Workaround for make being unable to pass arguments to underlying cmd
19+
# $ SDK_DEPS_GROUP="build" make uv-sync-ci
20+
.PHONY: uv-sync-ci
21+
uv-sync-ci:
22+
uv sync --locked --group $(SDK_DEPS_GROUP)
23+
24+
.PHONY: clean
25+
clean:
26+
rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__ ./**/__pycache__
227

328
.PHONY: docs
429
docs:
5-
@make -C ./docs html
30+
make -C ./docs html
31+
32+
## TESTING
33+
34+
# --ff lets previously failing tests go first
35+
# -ra prints a report on all failed tests after a run
36+
# -vv shows why a test failed while the rest of the suite is running
37+
PYTHON_CMD := uv run python
38+
PYTEST_CMD := $(PYTHON_CMD) -m pytest --no-header --ff -ra -vv
639

740
.PHONY: test
841
test:
9-
@python -m pytest ./tests
42+
$(PYTEST_CMD) ./tests
1043

1144
.PHONY: test-unit
1245
test-unit:
13-
@python -m pytest ./tests/unit
46+
$(PYTEST_CMD) ./tests/unit
1447

1548
.PHONY: test-integration
1649
test-integration:
17-
@python -m pytest ./tests/integration ./tests/system
50+
$(PYTEST_CMD) --ff ./tests/integration ./tests/system
51+
52+
## DOCKER
53+
54+
CONTAINER_NAME := splunk
55+
SPLUNK_HOME := /opt/splunk
1856

1957
.PHONY: docker-up
2058
docker-up:
21-
@docker-compose up -d
59+
# For podman (at least on macOS) you might need to add DOCKER_BUILDKIT=0
60+
# --build forces Docker to build a new image instead of using an existing one
61+
@docker-compose up -d --build
2262

2363
.PHONY: docker-ensure-up
2464
docker-ensure-up:
@@ -35,14 +75,22 @@ docker-start: docker-up docker-ensure-up
3575

3676
.PHONY: docker-down
3777
docker-down:
38-
@docker-compose stop
78+
docker-compose stop
3979

4080
.PHONY: docker-restart
4181
docker-restart: docker-down docker-start
4282

4383
.PHONY: docker-remove
4484
docker-remove:
45-
@docker-compose rm -f -s
85+
docker-compose rm -f -s
4686

4787
.PHONY: docker-refresh
48-
docker-refresh: docker-remove docker-start
88+
docker-refresh: docker-remove docker-start
89+
90+
.PHONY: docker-splunk-restart
91+
docker-splunk-restart:
92+
docker exec -it $(CONTAINER_NAME) sudo sh -c '$(SPLUNK_HOME)/bin/splunk restart --run-as-root'
93+
94+
.PHONY: docker-tail-python-log
95+
docker-tail-python-log:
96+
docker exec -it $(CONTAINER_NAME) sudo tail $(SPLUNK_HOME)/var/log/splunk/python.log

docs/Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@
22
# Makefile for Sphinx docs generation
33
#
44

5-
SPHINXBUILD = sphinx-build
65
BUILDDIR = ./_build
76
HTMLDIR = ${BUILDDIR}/html
87

9-
# Internal variables
10-
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees .
11-
128
.PHONY: html
139
html:
14-
@rm -rf $(BUILDDIR)
15-
@$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTMLDIR)
16-
@sh munge_links.sh $(HTMLDIR)
17-
@echo
18-
@echo "Build finished. HTML pages available at docs/$(HTMLDIR)."
10+
rm -rf $(BUILDDIR)
11+
sphinx-build -b html -d $(BUILDDIR)/doctrees . $(HTMLDIR)
12+
sh munge_links.sh $(HTMLDIR)
13+
@echo "[splunk-sdk] ---"
14+
@echo "[splunk-sdk] Build finished. HTML pages available at docs/$(HTMLDIR)."

pyproject.toml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ name = "splunk-sdk"
1111
dynamic = ["version"]
1212
description = "Splunk Software Development Kit for Python"
1313
readme = "README.md"
14-
requires-python = ">=3.7"
14+
requires-python = ">=3.9"
1515
license = { text = "Apache-2.0" }
1616
authors = [{ name = "Splunk, Inc.", email = "devinfo@splunk.com" }]
1717
keywords = ["splunk", "sdk"]
1818
classifiers = [
1919
"Programming Language :: Python :: 3",
2020
"Programming Language :: Python :: 3 :: Only",
21-
"Programming Language :: Python :: 3.7",
2221
"Programming Language :: Python :: 3.9",
2322
"Programming Language :: Python :: 3.13",
2423
"Development Status :: 6 - Mature",
@@ -29,25 +28,27 @@ classifiers = [
2928
"Topic :: Software Development :: Libraries :: Application Frameworks",
3029
]
3130

32-
dependencies = ["python-dotenv>=0.21.1"]
33-
optional-dependencies = { compat = ["six>=1.17.0"] }
31+
dependencies = []
3432

33+
# https://github.com/astral-sh/uv/issues/8981#issuecomment-2466787211
34+
# Treat the same as NPM's `dependencies`
35+
[project.optional-dependencies]
36+
compat = ["six>=1.17.0"]
37+
38+
# Treat the same as NPM's `devDependencies`
3539
[dependency-groups]
36-
build = ["build>=1.1.1", "twine>=4.0.2"]
37-
# Can't pin `sphinx` otherwise installation fails on python>=3.7
38-
docs = ["sphinx", "jinja2>=3.1.6"]
39-
lint = ["mypy>=1.4.1", "ruff>=0.13.1"]
40-
test = ["pytest>=7.4.4", "pytest-cov>=4.1.0"]
41-
release = [{ include-group = "build" }, { include-group = "docs" }]
40+
test = ["pytest>=8.4.2", "pytest-cov>=7.1.0", "python-dotenv>=1.2.1"]
41+
release = ["build>=1.4.2", "jinja2>=3.1.6", "sphinx>=7.4.7", "twine>=6.2.0"]
42+
lint = ["basedpyright>=1.38.4", "ruff>=0.15.8"]
4243
dev = [
4344
{ include-group = "test" },
4445
{ include-group = "lint" },
45-
{ include-group = "build" },
46-
{ include-group = "docs" },
46+
{ include-group = "release" },
4747
]
4848

4949
[build-system]
50-
requires = ["setuptools"]
50+
# setuptools v61 introduces pyproject.toml support
51+
requires = ["setuptools>=61.0.0"]
5152
build-backend = "setuptools.build_meta"
5253

5354
[tool.setuptools]
@@ -56,13 +57,32 @@ packages = ["splunklib", "splunklib.modularinput", "splunklib.searchcommands"]
5657
[tool.setuptools.dynamic]
5758
version = { attr = "splunklib.__version__" }
5859

60+
[tool.basedpyright]
61+
exclude = [".venv"]
62+
allowedUntypedLibraries = ["splunklib"]
63+
reportAny = false
64+
reportExplicitAny = false
65+
reportMissingTypeStubs = false
66+
reportUnknownMemberType = false
67+
reportUnusedCallResult = false
68+
5969
# https://docs.astral.sh/ruff/configuration/
6070
[tool.ruff.lint]
6171
fixable = ["ALL"]
6272
select = [
63-
"F", # pyflakes
73+
"ANN", # flake-8-annotations
74+
"C4", # comprehensions
75+
"DOC", # pydocstyle
6476
"E", # pycodestyle
77+
"F", # pyflakes
6578
"I", # isort
66-
"ANN", # flake8 type annotations
79+
"PT", # flake-8-pytest-rules
6780
"RUF", # ruff-specific rules
81+
"UP", # pyupgrade
82+
]
83+
ignore = [
84+
"E501", # line-length
6885
]
86+
87+
[tool.ruff.lint.isort]
88+
combine-as-imports = true

0 commit comments

Comments
 (0)