diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 73136c0..877855a 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/.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/Makefile b/Makefile index 270023c..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) @@ -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/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/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..4f498db 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,68 @@ 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 = { text = "NCSA" } +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", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "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()