Skip to content

Commit e528971

Browse files
committed
Update pre-release.yml to set the version before uploading to Test PyPI
1 parent be76151 commit e528971

7 files changed

Lines changed: 89 additions & 82 deletions

File tree

.github/workflows/pre-release.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
name: Publish SDK to Test PyPI
2-
on: [workflow_dispatch]
1+
name: Publish pre-release to Test PyPI
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- release/2.x
37

48
env:
59
PYTHON_VERSION: 3.13
610

711
jobs:
8-
publish-to-test-pypi:
12+
publish-pre-release:
913
runs-on: ubuntu-latest
1014
permissions:
1115
id-token: write
@@ -17,9 +21,18 @@ jobs:
1721
with:
1822
python-version: ${{ env.PYTHON_VERSION }}
1923
deps-group: release
24+
- name: Set pre-release version
25+
env:
26+
RUN_NUMBER: ${{ github.run_number }}
27+
# --frozen skips re-locking since we only need to patch the version, not update deps.
28+
run: |
29+
SHA=$(git rev-parse --short HEAD)
30+
BASE=$(uv version --short)
31+
uv version --frozen "${BASE}.dev${RUN_NUMBER}+g${SHA}"
2032
- name: Build packages for distribution
2133
run: uv build
22-
- name: Publish packages to Test PyPI
23-
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
24-
with:
25-
repository-url: https://test.pypi.org/legacy/
34+
- run: ls -Al dist/
35+
# - name: Publish packages to Test PyPI
36+
# uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b
37+
# with:
38+
# repository-url: https://test.pypi.org/legacy/

.github/workflows/test.yml

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
name: Python SDK CI
2-
on: [push, workflow_dispatch]
1+
# name: Python SDK CI
2+
# on: [push, workflow_dispatch]
33

4-
concurrency:
5-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6-
cancel-in-progress: true
4+
# concurrency:
5+
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6+
# cancel-in-progress: true
77

8-
jobs:
9-
test-stage:
10-
runs-on: ${{ matrix.os }}
11-
strategy:
12-
matrix:
13-
os: [ubuntu-latest]
14-
python-version: [3.13]
15-
splunk-version: [latest]
16-
steps:
17-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
18-
- uses: ./.github/actions/setup-sdk-environment
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
deps-group: test
22-
- name: Download Splunk MCP Server App
23-
run: uv run ./scripts/download_splunk_mcp_server_app.py
24-
env:
25-
SPLUNKBASE_USERNAME: ${{ secrets.SPLUNKBASE_USERNAME }}
26-
SPLUNKBASE_PASSWORD: ${{ secrets.SPLUNKBASE_PASSWORD }}
27-
- name: Launch Splunk Docker instance
28-
run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
29-
- name: Set up .env
30-
run: cp .env.template .env
31-
- name: Write internal AI secrets to .env
32-
run: |
33-
echo "internal_ai_app_key=$INTERNAL_AI_APP_KEY" >> .env
34-
echo "internal_ai_client_id=$INTERNAL_AI_CLIENT_ID" >> .env
35-
echo "internal_ai_client_secret=$INTERNAL_AI_CLIENT_SECRET" >> .env
36-
echo "internal_ai_token_url=$INTERNAL_AI_TOKEN_URL" >> .env
37-
echo "internal_ai_base_url=$INTERNAL_AI_BASE_URL" >> .env
38-
env:
39-
INTERNAL_AI_APP_KEY: ${{ secrets.INTERNAL_AI_APP_KEY }}
40-
INTERNAL_AI_CLIENT_ID: ${{ secrets.INTERNAL_AI_CLIENT_ID }}
41-
INTERNAL_AI_CLIENT_SECRET: ${{ secrets.INTERNAL_AI_CLIENT_SECRET }}
42-
INTERNAL_AI_TOKEN_URL: ${{ secrets.INTERNAL_AI_TOKEN_URL }}
43-
INTERNAL_AI_BASE_URL: ${{ secrets.INTERNAL_AI_BASE_URL }}
44-
- name: Restore pytest cache
45-
if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' }}
46-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
47-
with:
48-
path: .pytest_cache
49-
key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}
50-
restore-keys: |
51-
pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-
52-
- name: Run unit tests
53-
run: make test-unit
54-
- name: Run entire test suite
55-
run: make test-integration
8+
# jobs:
9+
# test-stage:
10+
# runs-on: ${{ matrix.os }}
11+
# strategy:
12+
# matrix:
13+
# os: [ubuntu-latest]
14+
# python-version: [3.13]
15+
# splunk-version: [latest]
16+
# steps:
17+
# - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
18+
# - uses: ./.github/actions/setup-sdk-environment
19+
# with:
20+
# python-version: ${{ matrix.python-version }}
21+
# deps-group: test
22+
# - name: Download Splunk MCP Server App
23+
# run: uv run ./scripts/download_splunk_mcp_server_app.py
24+
# env:
25+
# SPLUNKBASE_USERNAME: ${{ secrets.SPLUNKBASE_USERNAME }}
26+
# SPLUNKBASE_PASSWORD: ${{ secrets.SPLUNKBASE_PASSWORD }}
27+
# - name: Launch Splunk Docker instance
28+
# run: SPLUNK_VERSION=${{ matrix.splunk-version }} docker compose up -d
29+
# - name: Set up .env
30+
# run: cp .env.template .env
31+
# - name: Write internal AI secrets to .env
32+
# run: |
33+
# echo "internal_ai_app_key=$INTERNAL_AI_APP_KEY" >> .env
34+
# echo "internal_ai_client_id=$INTERNAL_AI_CLIENT_ID" >> .env
35+
# echo "internal_ai_client_secret=$INTERNAL_AI_CLIENT_SECRET" >> .env
36+
# echo "internal_ai_token_url=$INTERNAL_AI_TOKEN_URL" >> .env
37+
# echo "internal_ai_base_url=$INTERNAL_AI_BASE_URL" >> .env
38+
# env:
39+
# INTERNAL_AI_APP_KEY: ${{ secrets.INTERNAL_AI_APP_KEY }}
40+
# INTERNAL_AI_CLIENT_ID: ${{ secrets.INTERNAL_AI_CLIENT_ID }}
41+
# INTERNAL_AI_CLIENT_SECRET: ${{ secrets.INTERNAL_AI_CLIENT_SECRET }}
42+
# INTERNAL_AI_TOKEN_URL: ${{ secrets.INTERNAL_AI_TOKEN_URL }}
43+
# INTERNAL_AI_BASE_URL: ${{ secrets.INTERNAL_AI_BASE_URL }}
44+
# - name: Restore pytest cache
45+
# if: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' }}
46+
# uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae
47+
# with:
48+
# path: .pytest_cache
49+
# key: pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-${{ github.sha }}
50+
# restore-keys: |
51+
# pytest-cache-${{ runner.os }}-py${{ matrix.python-version }}-${{ github.ref_name }}-
52+
# - name: Run unit tests
53+
# run: make test-unit
54+
# - name: Run entire test suite
55+
# run: make test-integration

docs/conf.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
# All configuration values have a default; values that are commented out
1010
# serve to show the default.
1111

12+
import importlib.metadata
1213
from datetime import datetime
1314

14-
import splunklib
15-
1615
# If extensions (or modules to document with autodoc) are in another directory,
1716
# add these directories to sys.path here. If the directory is relative to the
1817
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -40,17 +39,17 @@
4039
master_doc = "index"
4140

4241
# General information about the project.
43-
project = "Splunk SDK for Python"
44-
copyright = f"{datetime.now().year}, Splunk Inc."
42+
package_name = "splunk-sdk"
43+
project = f"Splunk SDK for Python (f{package_name}/splunklib)"
44+
copyright = f"2011-{datetime.now().year} Splunk, Inc."
4545

4646
# The version info for the project you're documenting, acts as replacement for
4747
# |version| and |release|, also used in various other places throughout the
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = splunklib.__version__
52-
# The full version, including alpha/beta/rc tags.
53-
release = splunklib.__version__
51+
release = importlib.metadata.version(package_name)
52+
version = ".".join(release.split(".")[:2])
5453

5554
# The language for content autogenerated by Sphinx. Refer to documentation
5655
# for a list of supported languages.

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ download = "https://github.com/splunk/splunk-sdk-python/releases/latest"
88

99
[project]
1010
name = "splunk-sdk"
11-
dynamic = ["version"]
11+
version = "3.0.0"
1212
description = "Splunk Software Development Kit for Python"
1313
readme = "README.md"
1414
requires-python = ">=3.13"
@@ -57,8 +57,7 @@ dev = [
5757
]
5858

5959
[build-system]
60-
# setuptools v61 introduces pyproject.toml support
61-
requires = ["setuptools>=61.0.0"]
60+
requires = ["setuptools>=82.0.1"]
6261
build-backend = "setuptools.build_meta"
6362

6463
[tool.setuptools]
@@ -71,9 +70,6 @@ packages = [
7170
"splunklib.ai.engines",
7271
]
7372

74-
[tool.setuptools.dynamic]
75-
version = { attr = "splunklib.__version__" }
76-
7773
[tool.basedpyright]
7874
exclude = [".venv"]
7975
allowedUntypedLibraries = ["splunklib"]

splunklib/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,3 @@ def setup_logging(
3030
level, log_format=DEFAULT_LOG_FORMAT, date_format=DEFAULT_DATE_FORMAT
3131
):
3232
logging.basicConfig(level=level, format=log_format, datefmt=date_format)
33-
34-
35-
__version_info__ = (3, 0, 0)
36-
__version__ = ".".join(map(str, __version_info__))

splunklib/binding.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
:mod:`splunklib.client` module.
2525
"""
2626

27+
import importlib.metadata
2728
import io
2829
import json
2930
import logging
@@ -34,14 +35,13 @@
3435
from contextlib import contextmanager
3536
from datetime import datetime
3637
from functools import wraps
37-
from io import BytesIO
38-
from urllib import parse
3938
from http import client
4039
from http.cookies import SimpleCookie
40+
from io import BytesIO
41+
from urllib import parse
4142
from xml.etree.ElementTree import XML, ParseError
42-
from .data import record
43-
from . import __version__
4443

44+
from .data import record
4545

4646
logger = logging.getLogger(__name__)
4747

@@ -1787,9 +1787,11 @@ def connect(scheme, host, port):
17871787
def request(url, message, **kwargs):
17881788
scheme, host, port, path = _spliturl(url)
17891789
body = message.get("body", "")
1790+
1791+
sdk_version = importlib.metadata.version("splunk-sdk")
17901792
head = {
17911793
"Content-Length": str(len(body)),
1792-
"User-Agent": "splunk-sdk-python/%s" % __version__,
1794+
"User-Agent": f"splunk-sdk-python/{sdk_version}",
17931795
"Accept": "*/*",
17941796
"Connection": "Close",
17951797
} # defaults

uv.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)