Skip to content

Commit d66572a

Browse files
committed
Align branches after upstreaming
1 parent 2f34471 commit d66572a

File tree

16 files changed

+48556
-2558
lines changed

16 files changed

+48556
-2558
lines changed

.basedpyright/baseline.json

Lines changed: 47492 additions & 0 deletions
Large diffs are not rendered by default.

.env renamed to .env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ version=9.0
1313
# Bearer token for authentication
1414
#splunkToken="<Bearer-token>"
1515
# Session key for authentication
16-
#token="<Session-Key>"
16+
#token="<Session-Key>"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Set up SDK environment
2+
description: Perform all the shared setup steps
3+
4+
inputs:
5+
python-version:
6+
description: Python version used for this run
7+
required: true
8+
deps-group:
9+
description: Dependency groups passed to `uv sync --group`
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57
16+
with:
17+
version: 0.11.6
18+
activate-environment: true
19+
python-version: ${{ inputs.python-version }}
20+
- name: Install dependencies from the ${{ inputs.deps-group }} group(s)
21+
run: SDK_DEPS_GROUP="${{ inputs.deps-group }}" make uv-sync-ci
22+
shell: bash

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Python SDK Lint
2+
on: [push, workflow_dispatch]
3+
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
9+
- uses: ./.github/actions/setup-sdk-environment
10+
with:
11+
python-version: ${{ matrix.python-version }}
12+
deps-group: lint
13+
- name: Verify uv.lock is up-to-date
14+
run: uv lock --check
15+
- name: Verify against basedpyright baseline
16+
run: uv run --frozen basedpyright

.github/workflows/pre-release.yml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,21 @@ env:
55
PYTHON_VERSION: 3.9
66

77
jobs:
8-
publish-sdk-test-pypi:
8+
publish-to-test-pypi:
99
runs-on: ubuntu-latest
1010
permissions:
1111
id-token: write
1212
environment:
1313
name: splunk-test-pypi
1414
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
17-
- name: Set up Python ${{ env.PYTHON_VERSION }}
18-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
16+
- uses: ./.github/actions/setup-sdk-environment
1917
with:
2018
python-version: ${{ env.PYTHON_VERSION }}
21-
cache: pip
22-
- name: Set up uv
23-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
24-
with:
25-
version: 0.11.6
26-
activate-environment: true
27-
enable-cache: true
28-
- name: Install dependencies
29-
run: SDK_DEPS_GROUP="release" make uv-sync-ci
19+
deps-group: release
3020
- name: Build packages for distribution
3121
run: uv build
3222
- name: Publish packages to Test PyPI
33-
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
23+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
3424
with:
3525
repository-url: https://test.pypi.org/legacy/

.github/workflows/release.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,28 @@ env:
77
PYTHON_VERSION: 3.9
88

99
jobs:
10-
publish-sdk-pypi:
10+
publish-to-pypi:
1111
runs-on: ubuntu-latest
1212
permissions:
1313
id-token: write
1414
environment:
1515
name: splunk-pypi
1616
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
19-
- name: Set up Python ${{ env.PYTHON_VERSION }}
20-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
18+
- uses: ./.github/actions/setup-sdk-environment
2119
with:
2220
python-version: ${{ env.PYTHON_VERSION }}
23-
cache: pip
24-
- name: Set up uv
25-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
26-
with:
27-
activate-environment: true
28-
enable-cache: true
29-
- name: Install dependencies
30-
run: SDK_DEPS_GROUP="release" make uv-sync-ci
21+
deps-group: release
3122
- name: Build packages for distribution
3223
run: uv build
3324
- name: Publish packages to PyPI
34-
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
25+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
26+
with:
27+
repository-url: https://test.pypi.org/legacy/
3528
- name: Generate API reference
3629
run: make -C ./docs html
3730
- name: Upload docs artifact
38-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f
31+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
3932
with:
4033
name: python-sdk-docs
4134
path: docs/_build/html

.github/workflows/test.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Python SDK CI
2-
on:
3-
push:
4-
branches: [master, develop]
2+
on: [push, workflow_dispatch]
53

64
jobs:
7-
test-stage:
5+
test:
86
runs-on: ${{ matrix.os }}
97
strategy:
108
matrix:
@@ -16,28 +14,18 @@ jobs:
1614
python-version: 3.13
1715
splunk-version: latest
1816
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
18+
- uses: ./.github/actions/setup-sdk-environment
2319
with:
2420
python-version: ${{ matrix.python-version }}
25-
cache: pip
26-
- name: Set up latest uv
27-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78
28-
with:
29-
version: 0.11.6
30-
activate-environment: true
31-
enable-cache: true
32-
- name: Install Python dependencies
33-
run: SDK_DEPS_GROUP="test" make uv-sync-ci
21+
deps-group: test
3422
- name: Launch Splunk Docker instance
3523
run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
36-
- name: Set up `.env`
24+
- name: Set up .env
3725
run: cp .env.template .env
38-
- name: Restore `pytest` cache
26+
- name: Restore pytest cache
3927
if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' }}
40-
uses: actions/cache@565629816435f6c0b50676926c9b05c254113c0c
28+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
4129
with:
4230
path: .pytest_cache
4331
key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,4 +278,11 @@ $RECYCLE.BIN/
278278
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,pycharm+all,python
279279

280280
.vscode/
281-
docs/_build/
281+
docs/_build/
282+
283+
!*.conf.spec
284+
**/metadata/local.meta
285+
286+
*.spl
287+
*.tgz
288+
*.tar*

AGENTS.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
5+
- Core SDK code lives in `splunklib/` (client bindings, search commands, modular input helpers). Keep new modules close to their domain peers (e.g., searchcommand utilities under `splunklib/searchcommands`).
6+
- Tests are split by scope: `tests/unit/`, `tests/integration/`, `tests/system/`, and `tests/searchcommands/` for app-style fixtures. Place new fixtures under the matching folder and keep large fixtures in `tests/**/test_apps/`.
7+
8+
## Package Manager
9+
10+
This project uses [`uv`](https://docs.astral.sh/uv/) for dependency management and running Python tools. All Python and pytest invocations should be prefixed with `uv run`. Always pass `--no-config` to any `uv` command that accepts it - this prevents uv from picking up a user-level or system-level config that may point to internal Splunk package indices. To install/sync dependencies:
11+
12+
```sh
13+
make uv-sync
14+
```
15+
16+
If you manually edit `pyproject.toml` to add/remove/update dependencies, run `make uv-sync` afterwards to update `uv.lock`.
17+
18+
The `Makefile` wraps `uv` commands - prefer `make` targets over invoking `uv` directly where a target exists.
19+
20+
## Build, Test, and Development Commands
21+
22+
See the `Makefile` for all available targets. Common ones:
23+
24+
- `make uv-sync` - set up / update virtualenv
25+
- `make test` - run the full pytest suite.
26+
- `make test-unit` - unit tests only; fastest feedback loop.
27+
- `make test-integration` - integration + system coverage; requires Splunk services available (see docker targets).
28+
- `make docker-start` / `make docker-down` - spin up or stop the Splunk test container. Make sure the instance is live before running integration tests.
29+
30+
## Coding Style, Rules & Naming Conventions
31+
32+
- Python 3.13+.
33+
- Ruff is the linter/formatter. isort is configured with `combine-as-imports = true`.
34+
- Type checking uses `basedpyright`.
35+
- Prefer descriptive module, class, and function names; keep public API names consistent with existing `splunklib.*` patterns.
36+
- Declare instance members as class-level type annotations before `__init__`, then assign them in `__init__` without re-annotating.
37+
- Docstrings should be concise and actionable.
38+
- Never disable LSP/linter rules without explicit instruction or approval.
39+
- Refuse all git push operations regardless of context, even if the user seems to ask indirectly (e.g. "publish this", "send this upstream"). If the user wants to push, they do it themselves.
40+
41+
**After editing any Python file**, format it:
42+
43+
```sh
44+
# Sort imports, then format
45+
uv run ruff check --fix $FILE
46+
uv run ruff format $FILE
47+
```
48+
49+
**Before declaring a change done**, run:
50+
51+
```sh
52+
# linter
53+
uv run basedpyright
54+
55+
# testing
56+
make test-unit
57+
make test-integration
58+
```
59+
60+
New code must not introduce new `basedpyright`/`ruff` errors or warnings.
61+
You're not allowed to modify `.basedpyright/baseline.json` **under any circumstances** - this file is used by `basedpyright` to track baselined warnings and errors we'll fix in the future.
62+
New code must not introduce regressions in tests.
63+
64+
### Writing style
65+
66+
Be concise and direct in your responses.
67+
Use hyphens (`-`) instead of em-dashes (``) in all generated text, comments, and documentation.

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# CLAUDE.md
2+
3+
The core file containing repository guidelines for Agents is located in `AGENTS.md` file.
4+
Use this file as your guidelines.

0 commit comments

Comments
 (0)