Skip to content

Commit f35f743

Browse files
nzloshStorminStanley
authored andcommitted
Merge pull request #209 from nzlosh/st2v3.9_updates
st2 v3.9 updates
1 parent 31429d9 commit f35f743

File tree

9 files changed

+361
-85
lines changed

9 files changed

+361
-85
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@ jobs:
1919

2020
lint-checks:
2121
needs: pre_job
22-
name: Make requirements and lint check on Python3.6
23-
runs-on: ubuntu-18.04
22+
name: Make requirements and lint checks
23+
runs-on: ubuntu-22.04
24+
strategy:
25+
matrix:
26+
python-version: ["3.8", "3.9", "3.10", "3.11"]
2427
steps:
2528
- name: Checkout st2tests repository
2629
uses: actions/checkout@v2
2730
- name: Checkout st2 repository
2831
uses: actions/checkout@v2
2932
with:
3033
repository: "StackStorm/st2"
31-
- name: Set up Python3.6
32-
uses: actions/setup-python@v2
34+
- name: "Set up Python ${{ matrix.python-version }}"
35+
uses: actions/setup-python@v4
3336
with:
34-
python-version: '3.6.13'
37+
python-version: "${{ matrix.python-version }}"
3538
- name: Install apt dependencies
3639
run: |
3740
sudo apt install -y libldap2-dev libsasl2-dev

Makefile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ space_char +=
1414
comma := ,
1515
COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS)))
1616

17-
PYTHON_TARGET := 3.6
18-
19-
REQUIREMENTS := test-requirements.txt requirements.txt
17+
# Extract the Python major/minor version to target the correct test requirements file.
18+
PYTHON_VERSION := $(shell python3 --version | sed -r 's/.*([[0-9]+\.[0-9]+)\.[0-9]+.*/\1/g')
19+
REQUIREMENTS := test-requirements-$(PYTHON_VERSION).txt requirements.txt
2020
# Grab the version of pip from the Makefile in the st2 repository
2121
#
2222
# 1. Grab the st2 branch name from ST2_BRANCH
@@ -73,7 +73,7 @@ pylint: requirements .pylint
7373
. $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/fixtures/actions/scripts/*/*.py || exit 1;
7474
. $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/fixtures/sensors/*.py || exit 1;
7575
. $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/asserts/actions/*.py || exit 1;
76-
76+
7777
.PHONY: flake8
7878
flake8: requirements .flake8
7979

@@ -107,8 +107,8 @@ requirements: virtualenv
107107

108108
# Install requirements
109109
for req in $(REQUIREMENTS); do \
110-
echo "Installing $$req..." ; \
111-
$(VIRTUALENV_DIR)/bin/pip install $(PIP_OPTIONS) -r $$req ; \
110+
echo "Installing $$req..." ; \
111+
$(VIRTUALENV_DIR)/bin/pip install $(PIP_OPTIONS) -r $$req ; \
112112
done
113113

114114
.PHONY: virtualenv
@@ -117,7 +117,7 @@ $(VIRTUALENV_DIR)/bin/activate:
117117
@echo
118118
@echo "==================== virtualenv ===================="
119119
@echo
120-
test -d $(VIRTUALENV_DIR) || virtualenv $(VIRTUALENV_DIR)
120+
test -d $(VIRTUALENV_DIR) || python3 -m venv $(VIRTUALENV_DIR)
121121

122122
# Setup PYTHONPATH in bash activate script...
123123
echo '' >> $(VIRTUALENV_DIR)/bin/activate
@@ -140,3 +140,17 @@ $(VIRTUALENV_DIR)/bin/activate:
140140
echo ' functions -e old_deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
141141
echo 'end' >> $(VIRTUALENV_DIR)/bin/activate.fish
142142
touch $(VIRTUALENV_DIR)/bin/activate.fish
143+
144+
.PHONY: piptools
145+
piptools: virtualenv
146+
@echo
147+
@echo "================== Install pip-tools ===================="
148+
@echo
149+
"$(VIRTUALENV_DIR)/bin/pip" install pip-tools
150+
151+
.PHONY: generate_requirements
152+
generate_requirements: piptools
153+
@echo
154+
@echo "================== Generate requirements file ===================="
155+
@echo
156+
"$(VIRTUALENV_DIR)/bin/pip-compile" --output-file=$(ROOT_DIR)/test-requirements-$(PYTHON_VERSION).txt $(ROOT_DIR)/test-requirements.in

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ For example:
3636
git subtree pull --prefix test_helpers/bats-assert https://github.com/ztombol/bats-assert.git master --squash
3737
git subtree pull --prefix test_helpers/bats-support https://github.com/ztombol/bats-support.git master --squash
3838
```
39+
40+
## Supported Python versions
41+
42+
StackStorm supports mulitple versions of python across numerous GNU/Linux distributions. To define python dependencies in a
43+
reproducible fashion, the `pip-compile` tool is used to resolve dependencies from the `requirements.in` file. The requirements
44+
are kept up to date with the `st2` repository and should be regenerated when requirements are updated.

test-requirements-3.10.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=/root/workspace/st2tests/test-requirements-3.10.txt /root/workspace/st2tests/test-requirements.in
6+
#
7+
aiohappyeyeballs==2.6.1
8+
# via aiohttp
9+
aiohttp==3.12.15
10+
# via slackclient
11+
aiosignal==1.4.0
12+
# via aiohttp
13+
astroid==3.1.0
14+
# via pylint
15+
async-timeout==5.0.1
16+
# via aiohttp
17+
attrs==25.3.0
18+
# via
19+
# aiohttp
20+
# pytest
21+
dill==0.4.0
22+
# via pylint
23+
flake8==7.0.0
24+
# via -r /root/workspace/st2tests/test-requirements.in
25+
frozenlist==1.7.0
26+
# via
27+
# aiohttp
28+
# aiosignal
29+
idna==3.10
30+
# via yarl
31+
iniconfig==2.1.0
32+
# via pytest
33+
isort==5.13.2
34+
# via pylint
35+
mccabe==0.7.0
36+
# via
37+
# flake8
38+
# pylint
39+
multidict==6.6.4
40+
# via
41+
# aiohttp
42+
# yarl
43+
packaging==25.0
44+
# via pytest
45+
platformdirs==4.3.8
46+
# via pylint
47+
pluggy==1.6.0
48+
# via pytest
49+
propcache==0.3.2
50+
# via
51+
# aiohttp
52+
# yarl
53+
py==1.11.0
54+
# via pytest
55+
pycodestyle==2.11.1
56+
# via flake8
57+
pyflakes==3.2.0
58+
# via flake8
59+
pylint==3.1.1
60+
# via -r /root/workspace/st2tests/test-requirements.in
61+
pytest==7.0.1
62+
# via -r /root/workspace/st2tests/test-requirements.in
63+
slackclient==2.9.4
64+
# via -r /root/workspace/st2tests/test-requirements.in
65+
tomli==2.2.1
66+
# via
67+
# pylint
68+
# pytest
69+
tomlkit==0.13.3
70+
# via pylint
71+
typing-extensions==4.14.1
72+
# via
73+
# aiosignal
74+
# astroid
75+
# multidict
76+
wheel==0.45.1
77+
# via -r /root/workspace/st2tests/test-requirements.in
78+
yarl==1.20.1
79+
# via aiohttp
80+
81+
# The following packages are considered to be unsafe in a requirements file:
82+
# setuptools

test-requirements-3.11.txt

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=/root/workspace/st2tests/test-requirements-3.11.txt /root/workspace/st2tests/test-requirements.in
6+
#
7+
aiohappyeyeballs==2.6.1
8+
# via aiohttp
9+
aiohttp==3.12.15
10+
# via slackclient
11+
aiosignal==1.4.0
12+
# via aiohttp
13+
astroid==3.1.0
14+
# via pylint
15+
attrs==25.3.0
16+
# via
17+
# aiohttp
18+
# pytest
19+
dill==0.4.0
20+
# via pylint
21+
flake8==7.0.0
22+
# via -r /root/workspace/st2tests/test-requirements.in
23+
frozenlist==1.7.0
24+
# via
25+
# aiohttp
26+
# aiosignal
27+
idna==3.10
28+
# via yarl
29+
iniconfig==2.1.0
30+
# via pytest
31+
isort==5.13.2
32+
# via pylint
33+
mccabe==0.7.0
34+
# via
35+
# flake8
36+
# pylint
37+
multidict==6.6.4
38+
# via
39+
# aiohttp
40+
# yarl
41+
packaging==25.0
42+
# via pytest
43+
platformdirs==4.3.8
44+
# via pylint
45+
pluggy==1.6.0
46+
# via pytest
47+
propcache==0.3.2
48+
# via
49+
# aiohttp
50+
# yarl
51+
py==1.11.0
52+
# via pytest
53+
pycodestyle==2.11.1
54+
# via flake8
55+
pyflakes==3.2.0
56+
# via flake8
57+
pylint==3.1.1
58+
# via -r /root/workspace/st2tests/test-requirements.in
59+
pytest==7.0.1
60+
# via -r /root/workspace/st2tests/test-requirements.in
61+
slackclient==2.9.4
62+
# via -r /root/workspace/st2tests/test-requirements.in
63+
tomli==2.2.1
64+
# via pytest
65+
tomlkit==0.13.3
66+
# via pylint
67+
typing-extensions==4.14.1
68+
# via aiosignal
69+
wheel==0.45.1
70+
# via -r /root/workspace/st2tests/test-requirements.in
71+
yarl==1.20.1
72+
# via aiohttp
73+
74+
# The following packages are considered to be unsafe in a requirements file:
75+
# setuptools

test-requirements-3.8.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.8
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=/root/workspace/st2tests/test-requirements-3.8.txt /root/workspace/st2tests/test-requirements.in
6+
#
7+
aiohappyeyeballs==2.4.4
8+
# via aiohttp
9+
aiohttp==3.10.11
10+
# via slackclient
11+
aiosignal==1.3.1
12+
# via aiohttp
13+
astroid==3.1.0
14+
# via pylint
15+
async-timeout==5.0.1
16+
# via aiohttp
17+
attrs==25.3.0
18+
# via
19+
# aiohttp
20+
# pytest
21+
dill==0.4.0
22+
# via pylint
23+
flake8==7.0.0
24+
# via -r /root/workspace/st2tests/test-requirements.in
25+
frozenlist==1.5.0
26+
# via
27+
# aiohttp
28+
# aiosignal
29+
idna==3.10
30+
# via yarl
31+
iniconfig==2.1.0
32+
# via pytest
33+
isort==5.13.2
34+
# via pylint
35+
mccabe==0.7.0
36+
# via
37+
# flake8
38+
# pylint
39+
multidict==6.1.0
40+
# via
41+
# aiohttp
42+
# yarl
43+
packaging==25.0
44+
# via pytest
45+
platformdirs==4.3.6
46+
# via pylint
47+
pluggy==1.5.0
48+
# via pytest
49+
propcache==0.2.0
50+
# via yarl
51+
py==1.11.0
52+
# via pytest
53+
pycodestyle==2.11.1
54+
# via flake8
55+
pyflakes==3.2.0
56+
# via flake8
57+
pylint==3.1.1
58+
# via -r /root/workspace/st2tests/test-requirements.in
59+
pytest==7.0.1
60+
# via -r /root/workspace/st2tests/test-requirements.in
61+
slackclient==2.9.4
62+
# via -r /root/workspace/st2tests/test-requirements.in
63+
tomli==2.2.1
64+
# via
65+
# pylint
66+
# pytest
67+
tomlkit==0.13.3
68+
# via pylint
69+
typing-extensions==4.13.2
70+
# via
71+
# astroid
72+
# multidict
73+
# pylint
74+
wheel==0.45.1
75+
# via -r /root/workspace/st2tests/test-requirements.in
76+
yarl==1.15.2
77+
# via aiohttp
78+
79+
# The following packages are considered to be unsafe in a requirements file:
80+
# setuptools

0 commit comments

Comments
 (0)