Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fb9c056
Remove unused code from docs Makefile
Ickerday Sep 22, 2025
2f77a2f
Fix missing backtick in docstring
Ickerday Sep 22, 2025
f77ffdb
Remove tox
Ickerday Sep 22, 2025
a12dc5f
Add programmatic year setting in docs
Ickerday Sep 22, 2025
b842d41
Move python version string to env, use dependency groups in pre-relea…
Ickerday Sep 22, 2025
4982b68
Sync pre-release.yml to release.yml
Ickerday Sep 22, 2025
485e80c
Add "Python 3 Only" classifier
Ickerday Sep 22, 2025
1656286
Update missed deps installation statement in test.yml
Ickerday Sep 22, 2025
92bb926
Run linter on CHANGELOG.md, fix typos
Ickerday Sep 22, 2025
96baeca
Capitalize some terms in CHANGELOG
Ickerday Sep 22, 2025
d9abd16
Add unfortunate workaround for deps installation in Python 3.7 in CI
Ickerday Sep 22, 2025
a54d756
Unify naming in GH Action workflows
Ickerday Sep 22, 2025
324669e
Fix missing dependencies in test suite 🤦
Ickerday Sep 22, 2025
d898ac5
Use latest release of splunk-app-collection
Ickerday Sep 22, 2025
b1edb7c
Separate .PHONY-ies as they look better; Update README.md
Ickerday Sep 22, 2025
7531347
uv.lock
Ickerday Sep 22, 2025
9000d33
More cleanup in `Makefile`s
Ickerday Sep 22, 2025
fd3a218
Fix "Converting `source_suffix = '.rst'` to `source_suffix = {'.rst':…
Ickerday Sep 22, 2025
70c3f74
Refactor README
Ickerday Sep 22, 2025
81695d6
Refactor README #2
Ickerday Sep 22, 2025
7938b65
Finish cleanup in Makefile
Ickerday Sep 22, 2025
3ae152b
Spruce up example app names etc.
Ickerday Sep 22, 2025
37d5537
Separate app dependency install for Python 3.7 and the rest
Ickerday Sep 22, 2025
11ada60
Rewrite installation section in README
Ickerday Sep 22, 2025
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
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[run]
omit =
.tox/*
tests/*
18 changes: 10 additions & 8 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: CD
name: Publish SDK to Test PyPI
on: [workflow_dispatch]

env:
PYTHON_VERSION: 3.9

jobs:
test-pypi-deploy:
name: Deploy to Test PyPI
publish-sdk-test-pypi:
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -12,15 +14,15 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Set up Python
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: pip install build
- name: Build package
run: python -m pip install . --group build
- name: Build packages for distribution
run: python -m build
- name: Publish package to Test PyPI
- name: Publish packages to Test PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
repository-url: https://test.pypi.org/legacy/
30 changes: 14 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Release
name: Publish SDK to PyPI
on:
release:
types: [published]

env:
PYTHON_VERSION: 3.9

jobs:
publish:
name: Deploy release to PyPI
publish-sdk-pypi:
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -14,24 +16,20 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Set up Python
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version: 3.9
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: pip install build
- name: Build package
run: python -m pip install . --group release
- name: Build packages for distribution
run: python -m build
- name: Publish package to PyPI
- name: Publish packages to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
- name: Install tox
run: pip install tox
- name: Generate API docs
run: |
rm -rf ./docs/_build
tox -e docs
- name: Docs Upload
- name: Generate API reference
run: make -C ./docs html
- name: Upload docs artifact
uses: actions/upload-artifact@de65e23aa2b7e23d713bb51fbfcb6d502f8667d8
with:
name: python_sdk_docs
name: python-sdk-docs
path: docs/_build/html
18 changes: 11 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Python CI
on: [push, workflow_dispatch]

jobs:
build:
run-test-suite:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -23,13 +23,17 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
- name: Run docker compose
- name: Launch Splunk Docker instance
run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
- name: Setup Python
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox
- name: Test Execution
run: tox -e py -- ./tests
- name: (Python 3.7) Install dependencies
if: ${{ matrix.python-version == '3.7' }}
run: python -m pip install python-dotenv deprecation pytest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: python -m pip install python-dotenv deprecation pytest
run: python -m pip install python-dotenv pytest

Can we drop that now? Or is it still required by something?

- name: (Python >= 3.9) Install dependencies
if: ${{ matrix.python-version != '3.7' }}
run: python -m pip install . --group test
- name: Run entire test suite
run: python -m pytest ./tests
604 changes: 316 additions & 288 deletions CHANGELOG.md

Large diffs are not rendered by default.

68 changes: 30 additions & 38 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,56 +1,48 @@
RESET_COLOR=\033[0m
GREEN_COLOR=\033[32;01m

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove that newline

CONTAINER_NAME := 'splunk'
CONTAINER_NAME := "splunk"

.PHONY: docs
docs:
@echo "$(GREEN_COLOR)==> docs $(RESET_COLOR)"
@rm -rf ./docs/_build
@tox -e docs
@cd ./docs/_build/html && zip -r ../docs_html.zip . -x ".*" -x "__MACOSX"
@echo "$(ATTN_COLOR)==> Docs pages can be found at ./docs/_build/html, docs bundle available at ./docs/_build/docs_html.zip"
@make -C ./docs html

.PHONY: test
test:
@echo "$(GREEN_COLOR)==> test $(RESET_COLOR)"
@tox -e py -- ./tests
@python -m pytest ./tests

.PHONY: test-unit
test:
@echo "$(GREEN_COLOR)==> test $(RESET_COLOR)"
@tox -e py -- ./tests/unit
test-unit:
@python -m pytest ./tests/unit

.PHONY: test-integration
test:
@echo "$(GREEN_COLOR)==> test $(RESET_COLOR)"
@tox -e py -- ./tests/integration ./tests/system
test-integration:
@python -m pytest ./tests/integration ./tests/system

.PHONY: up
up:
@echo "$(GREEN_COLOR)==> up $(RESET_COLOR)"
.PHONY: docker-up
docker-up:
@docker-compose up -d

.PHONY: remove
remove:
@echo "$(GREEN_COLOR)==> rm $(RESET_COLOR)"
@docker-compose rm -f -s

.PHONY: wait_up
wait_up:
@echo "$(GREEN_COLOR)==> wait_up $(RESET_COLOR)"
@for i in `seq 0 180`; do if docker exec -it $(CONTAINER_NAME) /sbin/checkstate.sh &> /dev/null; then break; fi; printf "\rWaiting for Splunk for %s seconds..." $$i; sleep 1; done

.PHONY: down
down:
@echo "$(GREEN_COLOR)==> down $(RESET_COLOR)"
.PHONY: docker-ensure-up
docker-ensure-up:
@for i in `seq 0 180`; do \
if docker exec -it $(CONTAINER_NAME) /sbin/checkstate.sh &> /dev/null; then \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command is really bad and i have been frustrated with it (while using podman), since it does not differentiate between errors returned by docker/shell and checkstate.sh errors.

Suggested change
if docker exec -it $(CONTAINER_NAME) /sbin/checkstate.sh &> /dev/null; then \
if docker exec -it $(CONTAINER_NAME) /bin/bash -c "/sbin/checkstate.sh &> /dev/null"; then \

This way you at least get an error that docker is not in $PATH and users will act accordingly (edit MakeFile to use podman or just do not use docker-ensure-up, instead of endless waiting).

[mateusz@MPOLIWCZ-M-3NJ6 splunk-sdk-python ]$ make docker-ensure-up
/bin/sh: docker: command not found
Waiting for Splunk for 0 seconds...^[[A/bin/sh: docker: command not found
Waiting for Splunk for 1 seconds.../bin/sh: docker: command not found
Waiting for Splunk for 2 seconds.../bin/sh: docker: command not found
Waiting for Splunk for 3 seconds.../bin/sh: docker: command not found
Waiting for Splunk for 4 seconds.../bin/sh: docker: command not found

Still not ideal, but at least the error is visible.

break; \
fi; \
printf "\rWaiting for Splunk for %s seconds..." $$i; \
sleep 1; \
done
.PHONY: docker-start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add newline before this.

docker-start: docker-up docker-ensure-up

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

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

.PHONY: restart
restart: down start
.PHONY: docker-remove
docker-remove:
@docker-compose rm -f -s

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