From 125c2f21235e06e4338c508f3de05767bf44ff27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20J=C4=99drecki?= Date: Tue, 18 Aug 2026 15:14:28 +0200 Subject: [PATCH 1/3] Add mbake --- .bake.toml | 41 +++++++++++ Makefile | 18 ++++- docs/make.bat | 190 -------------------------------------------------- 3 files changed, 57 insertions(+), 192 deletions(-) create mode 100644 .bake.toml delete mode 100644 docs/make.bat diff --git a/.bake.toml b/.bake.toml new file mode 100644 index 000000000..ada248d1d --- /dev/null +++ b/.bake.toml @@ -0,0 +1,41 @@ +# mbake configuration file +# Generated with: mbake init + +# Global settings +debug = false +verbose = false + +# Error message formatting +gnu_error_format = true +wrap_error_messages = false + +[formatter] +# Spacing settings - enable proper spacing +space_around_assignment = true +space_before_colon = false +space_after_colon = true + +# Line continuation settings +normalize_line_continuations = true +max_line_length = 100 + +# PHONY settings +auto_insert_phony_declarations = true +group_phony_declarations = false +phony_at_top = false + +# General settings - enable proper formatting +remove_trailing_whitespace = true +ensure_final_newline = true +normalize_empty_lines = true +max_consecutive_empty_lines = 2 +fix_missing_recipe_tabs = true + +# Conditional formatting settings (Default disabled) +indent_nested_conditionals = false +# Indentation settings +tab_width = 2 + +# Variable alignment settings +align_variable_assignments = false +align_across_comments = false diff --git a/Makefile b/Makefile index fd145d5e6..ff5d2c0ce 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ ci-install: $(UV_SYNC_CMD) --frozen --group $(SDK_DEPS_GROUP) .PHONY: lint -lint: lint-python lint-gh-actions # TODO: Add mbake +lint: lint-python lint-gh-actions lint-makefile .PHONY: lint-gh-actions lint-gh-actions: @@ -37,8 +37,12 @@ lint-python: $(UV_RUN_CMD) ruff format $(UV_RUN_CMD) basedpyright +.PHONY: lint-makefile +lint-makefile: + $(UV_RUN_CMD) mbake format --config ./.bake.toml Makefile docs/Makefile + .PHONY: ci-lint -ci-lint: ci-lint-python ci-lint-gh-actions # TODO: Add mbake +ci-lint: ci-lint-python ci-lint-gh-actions ci-lint-makefile .PHONY: ci-lint-gh-actions ci-lint-gh-actions: @@ -50,6 +54,16 @@ ci-lint-python: $(UV_RUN_CMD) ruff format --check $(UV_RUN_CMD) basedpyright +.PHONY: ci-lint-makefile +ci-lint-makefile: + $(UV_RUN_CMD) mbake format --config ./.bake.toml --check Makefile docs/Makefile + $(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile docs/Makefile + +.PHONY: ci-lint-makefile +ci-lint-makefile: + $(UV_RUN_CMD) mbake format --config ./.bake.toml --check Makefile docs/Makefile + $(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile docs/Makefile + .PHONY: clean clean: rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__ ./**/__pycache__ diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100644 index 2098bdb1b..000000000 --- a/docs/make.bat +++ /dev/null @@ -1,190 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\SplunkPythonSDK.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\SplunkPythonSDK.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end From bd2b012e71147608f2c58a3aa5a5c40a73d005cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20J=C4=99drecki?= Date: Tue, 18 Aug 2026 15:14:28 +0200 Subject: [PATCH 2/3] Remove makefile redundancy --- .github/workflows/cd.yml | 2 +- .github/workflows/lint.yml | 2 +- Makefile | 56 +++++++++++++++++--------------------- docs/Makefile | 19 ------------- 4 files changed, 27 insertions(+), 52 deletions(-) delete mode 100644 docs/Makefile diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3f95db3f1..97d0b3174 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -58,7 +58,7 @@ jobs: name: splunk-sdk-${{ steps.get-version.outputs.version }} path: dist/ - name: Generate API reference - run: make -C ./docs zip + run: make docs-zip - name: Upload docs artifact uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 22a831ded..aaad004f4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,4 +26,4 @@ jobs: - name: Verify uv.lock is up-to-date run: uv lock --check - name: Verify files are linted and formatted - run: make ci-lint + run: make lint diff --git a/Makefile b/Makefile index ff5d2c0ce..6945bd052 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ upgrade: # Workaround for make being unable to pass arguments to underlying cmd # $ SDK_DEPS_GROUP="build" make ci-install +SDK_DEPS_GROUP ?= dev + .PHONY: ci-install ci-install: $(UV_SYNC_CMD) --frozen --group $(SDK_DEPS_GROUP) @@ -33,44 +35,36 @@ lint-gh-actions: .PHONY: lint-python lint-python: - $(UV_RUN_CMD) ruff check --fix-only - $(UV_RUN_CMD) ruff format + $(UV_RUN_CMD) ruff check --fix-only $(if $(CI),--exit-non-zero-on-fix) + $(UV_RUN_CMD) ruff format $(if $(CI),--check) $(UV_RUN_CMD) basedpyright .PHONY: lint-makefile lint-makefile: - $(UV_RUN_CMD) mbake format --config ./.bake.toml Makefile docs/Makefile - -.PHONY: ci-lint -ci-lint: ci-lint-python ci-lint-gh-actions ci-lint-makefile - -.PHONY: ci-lint-gh-actions -ci-lint-gh-actions: - $(ZIZMOR_CMD) ./.github - -.PHONY: ci-lint-python -ci-lint-python: - $(UV_RUN_CMD) ruff check --fix-only --exit-non-zero-on-fix - $(UV_RUN_CMD) ruff format --check - $(UV_RUN_CMD) basedpyright - -.PHONY: ci-lint-makefile -ci-lint-makefile: - $(UV_RUN_CMD) mbake format --config ./.bake.toml --check Makefile docs/Makefile - $(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile docs/Makefile - -.PHONY: ci-lint-makefile -ci-lint-makefile: - $(UV_RUN_CMD) mbake format --config ./.bake.toml --check Makefile docs/Makefile - $(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile docs/Makefile + $(UV_RUN_CMD) mbake format --config ./.bake.toml $(if $(CI),--check) Makefile + $(if $(CI),$(UV_RUN_CMD) mbake validate --config ./.bake.toml Makefile) .PHONY: clean clean: - rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__ ./**/__pycache__ + rm -rf ./build ./dist ./.venv ./.ruff_cache ./.pytest_cache ./splunk_sdk.egg-info ./__pycache__ + find . -name __pycache__ -type d -exec rm -rf {} + + +DOCS_BUILDDIR := docs/_build +DOCS_HTMLDIR := $(DOCS_BUILDDIR)/html +DOCS_ZIPFILE := $(DOCS_BUILDDIR)/splunk-sdk-python-docs.zip .PHONY: docs docs: - make -C ./docs html + rm -rf $(DOCS_BUILDDIR) + sphinx-build -b html -d $(DOCS_BUILDDIR)/doctrees ./docs $(DOCS_HTMLDIR) + sh docs/munge_links.sh $(DOCS_HTMLDIR) + @echo "[splunk-sdk] ---" + @echo "[splunk-sdk] Build finished. HTML pages available at $(DOCS_HTMLDIR)." + +.PHONY: docs-zip +docs-zip: docs + cd $(DOCS_HTMLDIR) && zip -r $(abspath $(DOCS_ZIPFILE)) . + @echo "[splunk-sdk] Zip available at $(DOCS_ZIPFILE)." ## TESTING @@ -90,7 +84,7 @@ test-unit: .PHONY: test-integration test-integration: - $(PYTEST_CMD) --ff ./tests/integration ./tests/system + $(PYTEST_CMD) ./tests/integration ./tests/system .PHONY: test-ai test-ai: @@ -136,8 +130,8 @@ docker-refresh: docker-remove docker-start .PHONY: docker-splunk-restart docker-splunk-restart: - docker exec -it $(CONTAINER_NAME) sudo sh -c '$(SPLUNK_HOME)/bin/splunk restart --run-as-root' + docker exec -u splunk $(CONTAINER_NAME) $(SPLUNK_HOME)/bin/splunk restart .PHONY: docker-tail-python-log docker-tail-python-log: - docker exec -it $(CONTAINER_NAME) sudo tail $(SPLUNK_HOME)/var/log/splunk/python.log + docker exec -u root $(CONTAINER_NAME) sudo tail -n 20 $(SPLUNK_HOME)/var/log/splunk/python.log diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index 478fccbec..000000000 --- a/docs/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Makefile for Sphinx docs generation -# - -BUILDDIR = ./_build -HTMLDIR = ${BUILDDIR}/html -ZIPFILE = ${BUILDDIR}/splunk-sdk-python-docs.zip - -.PHONY: html zip -html: - 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)." - -zip: html - cd $(HTMLDIR) && zip -r $(abspath $(ZIPFILE)) . - @echo "[splunk-sdk] Zip available at docs/$(ZIPFILE)." From f48471a9c87b447ac5f282e435990212db430628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20J=C4=99drecki?= Date: Tue, 18 Aug 2026 15:14:28 +0200 Subject: [PATCH 3/3] Add continue-on-error to MCP server test --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8683c4950..75ab36f73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,7 @@ jobs: python-version: ${{ matrix.python-version }} deps-group: test - name: Download Splunk MCP Server App + continue-on-error: true env: SPLUNKBASE_USERNAME: ${{ secrets.SPLUNKBASE_USERNAME }} SPLUNKBASE_PASSWORD: ${{ secrets.SPLUNKBASE_PASSWORD }}