diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..2ad04616 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: Build + +on: + push: + branches: ['*'] + pull_request: + branches: + - master + schedule: + # run every Monday at 6am + - cron: '0 6 * * 1' + +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ["3.10"] + needs: + - tests + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: "Set up Python ${{ matrix.python-version }}" + uses: actions/setup-python@v4 + with: + python-version: "${{ matrix.python-version }}" + - name: Build wheel + run: | + make clean + make package diff --git a/.github/workflows/tox.yml b/.github/workflows/check.yml similarity index 89% rename from .github/workflows/tox.yml rename to .github/workflows/check.yml index 3dab1cd4..12ed69cf 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/check.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout repository uses: actions/checkout@v4 @@ -29,4 +29,5 @@ jobs: pip install -r requirements-ci.txt make clean reqs schemas - name: "Run tox for ${{ matrix.python-version }}" - run: make check + run: | + make check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..e8c144a0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,20 @@ +name: Publish + +jobs: + publish: + runs-on: ubuntu-22.04 + strategy: + matrix: + python-version: ["3.10"] + needs: + - build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: "Set up Python ${{ matrix.python-version }}" + uses: actions/setup-python@v4 + with: + python-version: "${{ matrix.python-version }}" + - name: Publish wheel + run: | + echo "TODO: make publish" diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e46f2c4..7400b278 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,12 +6,16 @@ Unreleased Changed ~~~~~~~ -* Dropped python3.6 support. +* Dropped support for python3.6 to 3.9. Contributed by @nzlosh * Use pip 24.0 in virtualenv Contributed by @nzlosh * Aligned pinned dependencies with St2 core. Contributed by @nzlosh +* Replaced usage of imp module by importlib + Contributed by @nzlosh +* Added support for python3.10 to 3.12. + Contributed by @nzlosh Fixed ~~~~~ diff --git a/Makefile b/Makefile index 7e0bbbe1..bda46601 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,22 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +SHELL = /bin/bash +OS_ID := $(shell source /etc/os-release; echo $ID) +# Major OS version is sufficient. +OS_VERSION := $(shell source /etc/os-release; echo ${VERSION_ID%.*}) PY3 := python3 +# Rocky9 requires a newer python version than the default py3.9 +ifeq ($(OS_ID),rocky) + ifeq ($(OS_VERSION),9) + PY3 := python3.11 + endif +endif + SYS_PY3 := $(shell which $(PY3)) -PIP_VERSION = 24.0 +PIP_VERSION ?= 26.1.2 +SETUPTOOLS_VERSION ?= 82.0.1 # Virtual Environment VENV_DIR ?= .venv @@ -55,48 +67,49 @@ venv: .PHONY: reqs reqs: venv check_virtualenv - echo Install pip version $(PIP_VERSION) to match st2 core. - $(VENV_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)" - $(VENV_DIR)/bin/pip install -r requirements.txt - $(VENV_DIR)/bin/pip install -r requirements-test.txt - $(VENV_DIR)/bin/pip install -r requirements-docs.txt - $(VENV_DIR)/bin/pip install -r requirements-ci.txt - $(VENV_DIR)/bin/python setup.py develop + echo Install pip $(PIP_VERSION) and setuptools $(SETUPTOOLS_VERSION) to match st2 core. + $(VENV_DIR)/bin/$(PY3) -m pip install --upgrade "pip==$(PIP_VERSION)" + $(VENV_DIR)/bin/$(PY3) -m pip install --upgrade "setuptools==$(SETUPTOOLS_VERSION)" + $(VENV_DIR)/bin/$(PY3) -m pip install -r requirements.txt + $(VENV_DIR)/bin/$(PY3) -m pip install -r requirements-test.txt + $(VENV_DIR)/bin/$(PY3) -m pip install -r requirements-docs.txt + $(VENV_DIR)/bin/$(PY3) -m pip install -r requirements-ci.txt + $(VENV_DIR)/bin/$(PY3) -m pip install --editable . echo .PHONY: check_virtualenv check_virtualenv: - test -d $(VENV_DIR) || exit 1 + test -d "$(VENV_DIR)" || exit 1 .PHONY: schemas schemas: check_virtualenv - $(VENV_DIR)/bin/$(PY3) bin/orquesta-generate-schemas + "$(VENV_DIR)/bin/$(PY3)" bin/orquesta-generate-schemas .PHONY: format format: check_virtualenv - $(VENV_DIR)/bin/black orquesta bin setup.py -l 100 + "$(VENV_DIR)/bin/black" orquesta bin setup.py -l 100 .PHONY: check check: check_virtualenv - $(VENV_DIR)/bin/tox + "$(VENV_DIR)/bin/tox" .PHONY: docs docs: reqs - rm -rf $(BUILDDIR) - . $(VENV_DIR)/bin/activate; $(SPHINXBUILD) -W -b html $(SOURCEDIR) $(BUILDDIR)/html + rm -rf "$(BUILDDIR)" + . "$(VENV_DIR)/bin/activate"; "$(SPHINXBUILD)" -W -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" .PHONY: livedocs livedocs: reqs - rm -rf $(BUILDDIR) - . $(VENV_DIR)/bin/activate; $(SPHINXAUTO) -H 0.0.0.0 -b html $(SOURCEDIR) $(BUILDDIR)/html + rm -rf "$(BUILDDIR)" + . "$(VENV_DIR)/bin/activate"; "$(SPHINXAUTO)" -H 0.0.0.0 -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" .PHONY: package -package: check_virtualenv - rm -rf $(PKGDISTDIR) - rm -rf $(PKGBUILDDIR) - $(VENV_DIR)/bin/$(PY3) setup.py sdist bdist_wheel +package: reqs + rm -rf "$(PKGDISTDIR)" + rm -rf "$(PKGBUILDDIR)" + "$(VENV_DIR)/bin/$(PY3)" -m build --outdir "${PKGDISTDIR}" .PHONY: publish publish: package - $(VENV_DIR)/bin/$(PY3) -m twine upload dist/* + "$(VENV_DIR)/bin/$(PY3)" -m twine upload dist/* diff --git a/orquesta/tests/hacking/import_modules_rule.py b/orquesta/tests/hacking/import_modules_rule.py index e4c31132..c1ab189f 100644 --- a/orquesta/tests/hacking/import_modules_rule.py +++ b/orquesta/tests/hacking/import_modules_rule.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import imp +import importlib import inspect import sys import traceback @@ -54,10 +54,10 @@ def check_is_module(mod, search_path=sys.path): while "." in mod_name: pack_name, _sep, mod_name = mod_name.partition(".") - f, p, d = imp.find_module(pack_name, search_path) + f, p, d = importlib.util.find_spec(pack_name, search_path) search_path = [p] - imp.find_module(mod_name, search_path) + importlib.util.find_spec(mod_name, search_path) except ImportError: try: # Handle namespace modules diff --git a/orquesta/tests/unit/specs/native/test_workflow_spec_validate.py b/orquesta/tests/unit/specs/native/test_workflow_spec_validate.py index 3da1ce47..727f545a 100644 --- a/orquesta/tests/unit/specs/native/test_workflow_spec_validate.py +++ b/orquesta/tests/unit/specs/native/test_workflow_spec_validate.py @@ -1,4 +1,4 @@ -# Copyright 2021 The StackStorm Authors. +# Copyright 2021-2026 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -234,7 +234,7 @@ def test_empty_task_list(self): expected_errors = { "syntax": [ { - "message": "{} does not have enough properties", + "message": "{} should be non-empty", "schema_path": "properties.tasks.minProperties", "spec_path": "tasks", } diff --git a/requirements-test.txt b/requirements-test.txt index 7c109be0..419c54ba 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -8,5 +8,6 @@ pytest-cov==4.1.0 pep8==1.7.1 pylint==3.1.0 twine +build # 202404: Use forked version for flake8 v7.0.0 to align requirements with st2 test-requirements hacking @ git+https://github.com/nzlosh/hacking@flake8v7 diff --git a/requirements.txt b/requirements.txt index 310de986..04100a18 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,12 +4,12 @@ chardet>=3.0.2 eventlet jinja2>=2.11 # BSD License (3 clause) -jsonschema>=3,<4 # MIT -# networkx v3.2 and greater does not support Python3.8. -networkx>=2.6,<3.2 +jsonschema==4.26.0 +# networkx v3.5 and greater does not support Python3.10. +networkx>=2.6,<3.4 python-dateutil pyyaml>=5.3.1 # MIT six>=1.14.0 stevedore>=1.3.0 # Apache-2.0 ujson>=1.35 # BSD License -yaql>=1.1.0 # Apache-2.0 +yaql>=3.2.0 # Apache-2.0 diff --git a/setup.py b/setup.py index ecc611dd..f8aa84c1 100644 --- a/setup.py +++ b/setup.py @@ -62,10 +62,9 @@ def get_requirements(): "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", - "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", ], entry_points={ "orquesta.composers": [ diff --git a/tox.ini b/tox.ini index bd6ee1b4..ff770be3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,13 @@ [tox] -envlist = py38,py39,py310,py311,pep8,docs +envlist = py310,py311,py312,pep8,docs minversion = 1.6 skipsdist = True [gh-actions] python = - 3.8: py38,pep8,docs - 3.9: py39 - 3.10: py310 + 3.10: py310,pep8,docs 3.11: py311 + 3.12: py312 [testenv] usedevelop = True