Skip to content
Open
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
20 changes: 3 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.9]
splunk-version: [9.4, latest]
include:
# Oldest possible configuration
# Last Ubuntu version with Python 3.7 binaries available
- os: ubuntu-22.04
python-version: 3.7
splunk-version: 9.1
# Latest possible configuration
- os: ubuntu-latest
python-version: 3.13
splunk-version: latest
python-version: [3.13]
splunk-version: [latest]
steps:
- name: Checkout code
uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e
Expand All @@ -29,11 +19,7 @@ jobs:
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: ${{ matrix.python-version }}
- name: (Python 3.7) Install dependencies
if: ${{ matrix.python-version == '3.7' }}
run: python -m pip install python-dotenv pytest
- name: (Python >= 3.9) Install dependencies
if: ${{ matrix.python-version != '3.7' }}
- name: Install dependencies
run: python -m pip install . --group test
- name: Run entire test suite
run: python -m pytest ./tests
54 changes: 45 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
CONTAINER_NAME := "splunk"
#
# Conveniences for splunk-sdk development
#

# DEV ENVIRONMENT

# https://docs.astral.sh/uv/reference/cli/#uv-run--upgrade
# --no-config is used to skip all the internal Splunk package indexes
.PHONY: uv-sync
uv-sync:
@echo "[splunk-sdk] ---"
@echo "[splunk-sdk] Make sure to run this only in the repo root!"
uv sync --all-extras --no-config
pre-commit install

.PHONY: uv-upgrade
uv-upgrade:
@echo "[splunk-sdk] ---"
@echo "[splunk-sdk] Make sure to run this only in the repo root!"
uv sync --all-extras --upgrade --no-config
pre-commit autoupdate

# SDK RELEASE

.PHONY: docs
docs:
@make -C ./docs html
make -C ./docs html

.PHONY: test
test:
@python -m pytest ./tests
python -m pytest ./tests

.PHONY: test-unit
test-unit:
@python -m pytest ./tests/unit
python -m pytest ./tests/unit

.PHONY: test-integration
test-integration:
@python -m pytest ./tests/integration ./tests/system
python -m pytest ./tests/integration ./tests/system

.PHONY: test-ai
test-ai:
python -m pytest ./tests/integration/ai ./tests/unit/ai

# DOCKER

.PHONY: docker-up
docker-up:
@docker-compose up -d
docker-compose up -d

.PHONY: docker-ensure-up
docker-ensure-up:
Expand All @@ -35,14 +63,22 @@ docker-start: docker-up docker-ensure-up

.PHONY: docker-down
docker-down:
@docker-compose stop
docker-compose stop

.PHONY: docker-restart
docker-restart: docker-down docker-start

.PHONY: docker-remove
docker-remove:
@docker-compose rm -f -s
docker-compose rm -f -s

.PHONY: docker-refresh
docker-refresh: docker-remove docker-start
docker-refresh: docker-remove docker-start

.PHONY: docker-splunk-restart
docker-splunk-restart:
docker exec -it splunk sh -c '/opt/splunk/bin/splunk restart'

.PHONY: docker-tail-python-log
docker-tail-python-log:
docker exec splunk sudo tail /opt/splunk/var/log/splunk/python.log
14 changes: 5 additions & 9 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
# Makefile for Sphinx docs generation
#

SPHINXBUILD = sphinx-build
BUILDDIR = ./_build
HTMLDIR = ${BUILDDIR}/html

# Internal variables
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees .

.PHONY: html
html:
@rm -rf $(BUILDDIR)
@$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTMLDIR)
@sh munge_links.sh $(HTMLDIR)
@echo
@echo "Build finished. HTML pages available at docs/$(HTMLDIR)."
rm -rf $(BUILDDIR)
sphinx-build -b html -d $(BUILDDIR)/doctrees . $(HTMLDIR)
sh munge_links.sh $(HTMLDIR)
@echo "[splunk-sdk] ---"
@echo "[splunk-sdk] Build finished. HTML pages available at docs/$(HTMLDIR)."
34 changes: 19 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ name = "splunk-sdk"
dynamic = ["version"]
description = "Splunk Software Development Kit for Python"
readme = "README.md"
requires-python = ">=3.7"
license = { text = "Apache-2.0" }
requires-python = ">=3.13"
license = "Apache-2.0"
authors = [{ name = "Splunk, Inc.", email = "devinfo@splunk.com" }]
keywords = ["splunk", "sdk"]
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.13",
"Development Status :: 6 - Mature",
"Environment :: Other Environment",
Expand All @@ -29,21 +26,28 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Application Frameworks",
]

dependencies = ["python-dotenv>=0.21.1"]
optional-dependencies = { compat = ["six>=1.17.0"] }
dependencies = ["python-dotenv>=1.2.1"]

# Difference between [optional-dependencies] and [dependency-groups]
# https://github.com/astral-sh/uv/issues/8981#issuecomment-2466787211
# Treat the same as NPM's `dependencies`
[project.optional-dependencies]
compat = ["six>=1.17.0"]

# Treat the same as NPM's `devDependencies`
[dependency-groups]
build = ["build>=1.1.1", "twine>=4.0.2"]
# Can't pin `sphinx` otherwise installation fails on python>=3.7
docs = ["sphinx", "jinja2>=3.1.6"]
lint = ["mypy>=1.4.1", "ruff>=0.13.1"]
test = ["pytest>=7.4.4", "pytest-cov>=4.1.0"]
release = [{ include-group = "build" }, { include-group = "docs" }]
test = [
"pytest>=9.0.2",
"pytest-cov>=7.0.0",
"pytest-asyncio>=1.3.0",
"pytest-github-actions-annotate-failures>=0.3.0",
]
lint = ["basedpyright>=1.37.1", "ruff>=0.14.13", "mbake>=1.4.4"]
release = ["build>=1.4.0", "twine>=6.2.0", "sphinx>=9.1.0", "jinja2>=3.1.6"]
dev = [
{ include-group = "test" },
{ include-group = "lint" },
{ include-group = "build" },
{ include-group = "docs" },
{ include-group = "release" },
]

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/modularinput/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
with data_open("data/event_minimal.xml") as data:
expected = ET.parse(data).getroot()

assert xml_compare(expected, constructed)
assert not xml_compare(expected, constructed)

Check failure on line 53 in tests/unit/modularinput/test_event.py

View workflow job for this annotation

GitHub Actions / run-test-suite (ubuntu-latest, 3.13, latest)

test_xml_of_event_with_minimal_configuration AssertionError: assert not True + where True = xml_compare(<Element 'event' at 0x7f638835ab60>, <Element 'event' at 0x7f6388359bc0>)


def test_xml_of_event_with_more_configuration(capsys):
Expand Down
Loading
Loading