From 723a563c46e42a94b173cfca6223d7303bb7837b Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 15:37:37 -0500 Subject: [PATCH 01/12] Merge setup.cfg into pyproject.toml --- Makefile | 5 ++-- docs/readme.rst | 48 +++++++++++++++--------------- pyproject.toml | 61 +++++++++++++++++++++++++++++++++++++++ setup.cfg | 50 -------------------------------- setup.py | 21 ++------------ src/phtoolbox/_version.py | 34 ++++++++++++++++++++++ 6 files changed, 123 insertions(+), 96 deletions(-) delete mode 100644 setup.cfg create mode 100644 src/phtoolbox/_version.py diff --git a/Makefile b/Makefile index 270023c..8b24ad5 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ venv: Makefile python -m venv $@ # Build wheel and source tarball for upload to PyPI -build: README.rst $(SRCS) +build: docs/readme.rst $(SRCS) python setup.py sdist bdist_wheel @touch $@ @@ -175,7 +175,6 @@ clean: rm -rf .coverage .coverage.develop .lint .mypy_cache .static .tox .wheel htmlcov .twinecheck rm -rf $(PKG)/__pycache__ $(TPKG)/__pycache__ $(TPKG)/cli/__pycache__/ $(TPKG)/config/__pycache__ rm -rf build dist src/*.egg-info .eggs - make -C docs clean clean-all: clean - rm -rf cache + rm -rf cache venv diff --git a/docs/readme.rst b/docs/readme.rst index d79dc96..134ef7b 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -25,27 +25,27 @@ so we recommend ensuring setuptools is up to date before installing:: Usage ===== -The following `__init__` and `handle_action` boilerplate are required: - -```python -class ExampleConnector(BaseConnector, NiceBaseConnector): - def __init__(self): - BaseConnector.__init__(self) - NiceBaseConnector.__init__( - self, phantom.APP_SUCCESS, phantom.APP_ERROR) - - def handle_action(self, param): - # handle_action is an abstract method; it MUST be implemented here. - self.nice_handle_action(param) -``` - -The decorator `@handle` is used to register a handler to process an action: - -```python - @handle('add') - def _handle_add(self, param): - action_result = self.add_action_result(ActionResult(dict(param))) - - return action_result.set_status(phantom.APP_SUCCESS, - f"Sum {self.x + self.y}") -``` +The following `__init__` and `handle_action` boilerplate are required:: + + ```python + class ExampleConnector(BaseConnector, NiceBaseConnector): + def __init__(self): + BaseConnector.__init__(self) + NiceBaseConnector.__init__( + self, phantom.APP_SUCCESS, phantom.APP_ERROR) + + def handle_action(self, param): + # handle_action is an abstract method; it MUST be implemented here. + self.nice_handle_action(param) + ``` + +The decorator `@handle` is used to register a handler to process an action:: + + ```python + @handle('add') + def _handle_add(self, param): + action_result = self.add_action_result(ActionResult(dict(param))) + + return action_result.set_status(phantom.APP_SUCCESS, + f"Sum {self.x + self.y}") + ``` diff --git a/pyproject.toml b/pyproject.toml index d19a960..32a3021 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,67 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] build-backend = "setuptools.build_meta" +[project] +name = "phantom-toolbox" +dynamic = ["version"] +dependencies = [ + "requests", + "wheel-inspect", +] +description = "Splunk SOAR Application development libraries and utilities" +authors = [ + {name = "David D. Riddle", email = "securitysupport@illinois.edu"} +] +readme = "docs/readme.rst" +license = "NCSA" +license-files = ["LICENSE"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Operating System :: OS Independent", + "Environment :: Console", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Build Tools", + "Topic :: Software Development :: Libraries", + "Topic :: Security", + "Topic :: Utilities", +] +requires-python = ">=3.10" + +[project.urls] +Homepage = "https://github.com/techservicesillinois/phantom-toolbox/" +"Bug Reports" = "https://github.com/techservicesillinois/phantom-toolbox/issues" +Source = "https://github.com/techservicesillinois/phantom-toolbox/" +Changelog = "https://github.com/techservicesillinois/phantom-toolbox/blob/main/CHANGELOG.md" + +[project.optional-dependencies] +test = [ + "pytest", + "coverage", + "setuptools_scm", # Hack to install pytest-splunk-soar-connectors + "pytest-splunk-soar-connectors @ git+https://github.com/splunk/pytest-splunk-soar-connectors.git", +] + +[project.scripts] +phantom = "phtoolbox.cli:main" + +[options] +include-package-data = true + +[options.package_data] +phtoolbox = "py.typed" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools_scm] +version_file = "src/phtoolbox/_version.py" +local_scheme = "dirty-tag" + [tool.pytest.ini_options] minversion = "7.2" pythonpath = "src" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0dfe9a4..0000000 --- a/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -[metadata] -name = phantom-toolbox -author = David D. Riddle -author_email = securitysupport@illinois.edu -description= Splunk SOAR Application development libraries and utilities -long_description = file: docs/readme.rst -long_description_content_type= text/markdown -url= https://github.com/techservicesillinois/phantom-toolbox/ -classifiers= - Development Status :: 3 - Alpha - Operating System :: OS Independent - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: University of Illinois/NCSA Open Source License - Natural Language :: English - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Software Development :: Build Tools - Topic :: Software Development :: Libraries - Topic :: Security - Topic :: Utilities - -[options] -python_requires = >=3.9 -packages = find: -package_dir= - = src -install_requires = - requests - wheel-inspect -include_package_data=True - -[options.entry_points] -console_scripts = - phantom = phtoolbox.cli:main - -[options.packages.find] -where = src - -[options.extras_require] -test = - pytest - coverage - setuptools_scm # Hack to install pytest-splunk-soar-connectors - pytest-splunk-soar-connectors @ git+https://github.com/splunk/pytest-splunk-soar-connectors.git diff --git a/setup.py b/setup.py index 490f72f..b908cbe 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,3 @@ -from setuptools import setup +import setuptools - -def version(): - from setuptools_scm.version import get_local_dirty_tag - - def clean_scheme(version): - # Disable local scheme by default since it is not supported - # by PyPI (See PEP 440). If code is not committed add +dirty - # to version to prevent upload to either PyPI or test PyPI. - return get_local_dirty_tag(version) if version.dirty else '' - - return {'local_scheme': clean_scheme} - - -setup( - use_scm_version=version, - setup_requires=['setuptools_scm', 'wheel'], - package_data={"phtoolbox": ["py.typed"]}, -) +setuptools.setup() diff --git a/src/phtoolbox/_version.py b/src/phtoolbox/_version.py new file mode 100644 index 0000000..10b3568 --- /dev/null +++ b/src/phtoolbox/_version.py @@ -0,0 +1,34 @@ +# file generated by setuptools-scm +# don't change, don't track in version control + +__all__ = [ + "__version__", + "__version_tuple__", + "version", + "version_tuple", + "__commit_id__", + "commit_id", +] + +TYPE_CHECKING = False +if TYPE_CHECKING: + from typing import Tuple + from typing import Union + + VERSION_TUPLE = Tuple[Union[int, str], ...] + COMMIT_ID = Union[str, None] +else: + VERSION_TUPLE = object + COMMIT_ID = object + +version: str +__version__: str +__version_tuple__: VERSION_TUPLE +version_tuple: VERSION_TUPLE +commit_id: COMMIT_ID +__commit_id__: COMMIT_ID + +__version__ = version = '0.1.dev42+dirty' +__version_tuple__ = version_tuple = (0, 1, 'dev42', 'dirty') + +__commit_id__ = commit_id = 'g0c7c8e8f2' From 3242c62b4630cb6731c7d71968b2433ad56868e7 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 15:46:49 -0500 Subject: [PATCH 02/12] fixup --- .github/workflows/cicd.yml | 10 +++++----- Makefile | 2 +- README.rst | 4 ++-- pyproject.toml | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 73136c0..8085eef 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -11,10 +11,10 @@ jobs: with: fetch-depth: 0 # setuptools_scm needs this to calculate the version - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.10 - name: Save pip cache uses: actions/cache@v4 @@ -60,7 +60,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9","3.10","3.11", "3.12"] + python-version: ["3.10","3.11", "3.12", "3.13", "3.14"] steps: @@ -166,10 +166,10 @@ jobs: # steps: # - uses: actions/checkout@v4 - # - name: Set up Python 3.9 + # - name: Set up Python 3.10 # uses: actions/setup-python@v5 # with: - # python-version: 3.9 + # python-version: 3.10 # - name: Save pip cache # uses: actions/cache@v4 diff --git a/Makefile b/Makefile index 8b24ad5..5941e7a 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ TOX_ENV := .tox/wheel/pyvenv.cfg WHEEL = $(wildcard dist/*.whl) PIP = python -m pip install --upgrade --upgrade-strategy eager -PYTHON_VERSIONS = 3.9 3.10 3.11 3.12 3.13 +PYTHON_VERSIONS = 3.10 3.11 3.12 3.13 3.14 comma := , empty := space := $(empty) $(empty) diff --git a/README.rst b/README.rst index 9982619..98d0a19 100644 --- a/README.rst +++ b/README.rst @@ -24,14 +24,14 @@ University of Illinois Urbana-Champaign on a best-effort basis. As of the last update to this README, the expected End-of-Life and End-of-Support dates of this product are 29 September 2027. -Per `Splunk Software Support Policy`_, each minor release of Splunk SOAR is supported for 24 months after the release. Splunk SOAR 7.0.0 Release notes give a release date of +Per `Splunk Software Support Policy`_, each minor release of Splunk SOAR is supported for 24 months after the release. Splunk SOAR 7.0.0 Release notes give a release date of 29 September 2027. .. _Splunk Software Support Policy: https://www.splunk.com/en_us/legal/splunk-software-support-policy.html End-of-Life was decided upon based on these dependencies: -- Python 3.13 (31 October 2029) `End of Life for Python Versions`_ +- Python 3.14 (31 October 2030) `End of Life for Python Versions`_ - Splunk SOAR 7.0.0 (29 September 2027) `Splunk SOAR 7.0.0 Release Notes`_ .. _End of Life for Python Versions: https://endoflife.date/python diff --git a/pyproject.toml b/pyproject.toml index 32a3021..dda9ab9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,8 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries", "Topic :: Security", From 0f16d53802ea58798d3e2d712948c00ec5da7fb0 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 15:49:32 -0500 Subject: [PATCH 03/12] fixup --- .github/workflows/cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 8085eef..877855a 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.10 + python-version: "3.10" - name: Save pip cache uses: actions/cache@v4 @@ -169,7 +169,7 @@ jobs: # - name: Set up Python 3.10 # uses: actions/setup-python@v5 # with: - # python-version: 3.10 + # python-version: "3.10" # - name: Save pip cache # uses: actions/cache@v4 From 3425f240b35d97d957150a42307d6c4976e4c451 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 15:51:23 -0500 Subject: [PATCH 04/12] fixup --- .gitignore | 1 + src/phtoolbox/_version.py | 34 ---------------------------------- 2 files changed, 1 insertion(+), 34 deletions(-) delete mode 100644 src/phtoolbox/_version.py diff --git a/.gitignore b/.gitignore index a0317ba..2f69305 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ dist htmlcov venv docs/src/ +_version.py .coverage .coverage.develop diff --git a/src/phtoolbox/_version.py b/src/phtoolbox/_version.py deleted file mode 100644 index 10b3568..0000000 --- a/src/phtoolbox/_version.py +++ /dev/null @@ -1,34 +0,0 @@ -# file generated by setuptools-scm -# don't change, don't track in version control - -__all__ = [ - "__version__", - "__version_tuple__", - "version", - "version_tuple", - "__commit_id__", - "commit_id", -] - -TYPE_CHECKING = False -if TYPE_CHECKING: - from typing import Tuple - from typing import Union - - VERSION_TUPLE = Tuple[Union[int, str], ...] - COMMIT_ID = Union[str, None] -else: - VERSION_TUPLE = object - COMMIT_ID = object - -version: str -__version__: str -__version_tuple__: VERSION_TUPLE -version_tuple: VERSION_TUPLE -commit_id: COMMIT_ID -__commit_id__: COMMIT_ID - -__version__ = version = '0.1.dev42+dirty' -__version_tuple__ = version_tuple = (0, 1, 'dev42', 'dirty') - -__commit_id__ = commit_id = 'g0c7c8e8f2' From aca5898c11891998e07b92e3facbd90dab842de7 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 16:00:43 -0500 Subject: [PATCH 05/12] fixup --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dda9ab9..cb7beec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ authors = [ ] readme = "docs/readme.rst" license = "NCSA" -license-files = ["LICENSE"] classifiers = [ "Development Status :: 3 - Alpha", "Operating System :: OS Independent", From 6e6e968e5cf7353098686e2759568ef6689d0439 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 16:15:34 -0500 Subject: [PATCH 06/12] fixup --- tox.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tox.ini b/tox.ini index 30982ac..21104dd 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist = {env:TOX_PYTHON_VERSIONS} [testenv] # getuser fails on Windows if these envs are not passed in... passenv = LOGNAME,USER,LNAME,USERNAME +commands_pre = python -m pip install --upgrade pip # https://packaging.python.org/guides/index-mirrors-and-caches/#caching-with-pip install_command=python -m pip install --disable-pip-version-check --find-links=cache {opts} {packages} commands = pytest @@ -12,6 +13,7 @@ sitepackages = false extras = test [testenv:wheel] +commands_pre = python -m pip install --upgrade pip commands = {posargs:coverage run -m pytest} install_command=python -m pip install --no-index --find-links=cache {opts} {packages} # This is needed to ensure Github Action's caching will always work From f4a72e3cbd89220b51b6fab5316e0d6579a6f79e Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 16:19:25 -0500 Subject: [PATCH 07/12] fixup --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 21104dd..1a5fc61 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = {env:TOX_PYTHON_VERSIONS} [testenv] # getuser fails on Windows if these envs are not passed in... passenv = LOGNAME,USER,LNAME,USERNAME -commands_pre = python -m pip install --upgrade pip +commands_pre=python -m pip install --upgrade pip # https://packaging.python.org/guides/index-mirrors-and-caches/#caching-with-pip install_command=python -m pip install --disable-pip-version-check --find-links=cache {opts} {packages} commands = pytest @@ -13,7 +13,7 @@ sitepackages = false extras = test [testenv:wheel] -commands_pre = python -m pip install --upgrade pip +commands_pre=python -m pip install --upgrade pip commands = {posargs:coverage run -m pytest} install_command=python -m pip install --no-index --find-links=cache {opts} {packages} # This is needed to ensure Github Action's caching will always work From 907148e26bd73add44a12334b3bf521f6e882d00 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 16:23:09 -0500 Subject: [PATCH 08/12] fixup --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cb7beec..4f498db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ authors = [ {name = "David D. Riddle", email = "securitysupport@illinois.edu"} ] readme = "docs/readme.rst" -license = "NCSA" +license = { text = "NCSA" } classifiers = [ "Development Status :: 3 - Alpha", "Operating System :: OS Independent", From f988ed892a56efc516a21615aaa122e0a8402d01 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 17 Mar 2026 16:24:47 -0500 Subject: [PATCH 09/12] fixup --- tox.ini | 2 -- 1 file changed, 2 deletions(-) diff --git a/tox.ini b/tox.ini index 1a5fc61..30982ac 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,6 @@ envlist = {env:TOX_PYTHON_VERSIONS} [testenv] # getuser fails on Windows if these envs are not passed in... passenv = LOGNAME,USER,LNAME,USERNAME -commands_pre=python -m pip install --upgrade pip # https://packaging.python.org/guides/index-mirrors-and-caches/#caching-with-pip install_command=python -m pip install --disable-pip-version-check --find-links=cache {opts} {packages} commands = pytest @@ -13,7 +12,6 @@ sitepackages = false extras = test [testenv:wheel] -commands_pre=python -m pip install --upgrade pip commands = {posargs:coverage run -m pytest} install_command=python -m pip install --no-index --find-links=cache {opts} {packages} # This is needed to ensure Github Action's caching will always work From 8beebd99e54d0b88cbb737f062150b7db4439b9b Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Fri, 20 Mar 2026 14:50:50 -0500 Subject: [PATCH 10/12] fixup --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 877855a..7e4a331 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -76,7 +76,7 @@ jobs: name: build - name: Touch Makefile targets - run: touch .lint .static .twinecheck + run: touch .lint .static .twinecheck build - name: Get pip cache dir id: pip-cache From 47e6f09ce94692df5833ae4b9bd0b7bfe398a104 Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Fri, 20 Mar 2026 14:53:34 -0500 Subject: [PATCH 11/12] fixup --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 7e4a331..877855a 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -76,7 +76,7 @@ jobs: name: build - name: Touch Makefile targets - run: touch .lint .static .twinecheck build + run: touch .lint .static .twinecheck - name: Get pip cache dir id: pip-cache From 0023904808fad798ec994820313c53144634944a Mon Sep 17 00:00:00 2001 From: Zach Carrington Date: Tue, 21 Apr 2026 15:43:41 -0500 Subject: [PATCH 12/12] Fixup --- .gitignore | 1 + Makefile | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2f69305..333a334 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ venv docs/src/ _version.py +.build .coverage .coverage.develop .eggs diff --git a/Makefile b/Makefile index 5941e7a..8de0bd2 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ empty := space := $(empty) $(empty) export TOX_PYTHON_VERSIONS := $(subst $(space),$(comma),$(patsubst %,py%,$(subst .,,$(PYTHON_VERSIONS)))) -.PHONY: all check install test lint static develop develop-coverage +.PHONY: all build check install test lint static develop develop-coverage .PHONY: freeze shell clean docs coverage doctest win-tox all: test coverage docs doctest @@ -54,7 +54,8 @@ venv: Makefile python -m venv $@ # Build wheel and source tarball for upload to PyPI -build: docs/readme.rst $(SRCS) +build: .build +.build: docs/readme.rst $(SRCS) python setup.py sdist bdist_wheel @touch $@