Skip to content

Commit 16fdcfa

Browse files
authored
0.3.0: Bump python support (#8)
2 parents 37e5c8d + 3ee1a83 commit 16fdcfa

File tree

10 files changed

+120
-45
lines changed

10 files changed

+120
-45
lines changed

.github/workflows/tox.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Tox CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.8"
20+
21+
- name: Install tox
22+
run: pip install --user tox
23+
24+
- name: Lint
25+
run: tox -e lint
26+
27+
test:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
python-version: ["3.8", "3.9", "3.10", "3.11"]
32+
steps:
33+
- name: Checkout repo
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: Install tox
42+
run: pip install --user tox
43+
44+
- name: Select tox env
45+
id: tox-env
46+
run: echo tox-env=py${{ matrix.python-version }} | tr -d '.' >> ${GITHUB_OUTPUT}
47+
48+
- name: Test
49+
run: tox -e ${{ steps.tox-env.outputs.tox-env }}
50+
51+
set_merge_ok:
52+
name: Set Merge OK
53+
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
54+
needs:
55+
- lint
56+
- test
57+
outputs:
58+
merge_ok: ${{ steps.set_merge_ok.outputs.merge_ok }}
59+
runs-on: ubuntu-latest
60+
steps:
61+
- id: set_merge_ok
62+
run: echo 'merge_ok=true' >> ${GITHUB_OUTPUT}
63+
64+
merge_ok:
65+
name: Merge OK
66+
if: always()
67+
needs:
68+
- set_merge_ok
69+
runs-on: ubuntu-latest
70+
steps:
71+
- run: |
72+
merge_ok="${{ needs.set_merge_ok.outputs.merge_ok }}"
73+
if [[ "${merge_ok}" == "true" ]]; then
74+
echo "Merge OK"
75+
exit 0
76+
else
77+
echo "Merge NOT OK"
78+
exit 1
79+
fi

.travis.yml

-14
This file was deleted.

lint-configs/python/.pylintrc

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
[MESSAGES CONTROL]
22
# C0111 Missing docstring
33
# I0011 Warning locally suppressed using disable-msg
4-
# I0012 Warning locally suppressed using disable-msg
5-
# W0704 Except doesn't do anything Used when an except clause does nothing but "pass" and there is no "else" clause
6-
# W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments.
74
# W0212 Access to a protected member %s of a client class
8-
# W0232 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
95
# W0613 Unused argument %r Used when a function or method argument is not used.
106
# W0702 No exception's type specified Used when an except clause doesn't specify exceptions type to catch.
11-
# R0201 Method could be a function
127
# W0614 Unused import XYZ from wildcard import
138
# R0914 Too many local variables
149
# R0912 Too many branches
1510
# R0915 Too many statements
1611
# R0913 Too many arguments
1712
# R0904 Too many public methods
1813
# E0211: Method has no argument
19-
disable=C0103,C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,W0614,R0914,R0912,R0915,R0913,R0904,R0801
14+
disable=C0103,C0111,I0011,W0212,W0613,W0702,W0614,R0914,R0912,R0915,R0913,R0904,R0801
2015

2116
[TYPECHECK]
2217
# Note: This modules are manipulated during the runtime so we can't detect all the properties during

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
six
21
requests

setup.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@
2828
version = parse_version_string(INIT_FILE)
2929
install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE)
3030

31+
with open("README.md", "r") as fh:
32+
long_description = fh.read()
33+
3134
setup(
3235
name='st2-auth-backend-keystone',
3336
version=version,
3437
description='StackStorm authentication backend which reads credentials from an OpenStack Keystone instance.',
38+
long_description=long_description,
39+
long_description_content_type="text/markdown",
3540
author='StackStorm, Inc.',
3641
author_email='info@stackstorm.com',
3742
url='https://github.com/StackStorm/st2-auth-backend-keystone',
@@ -42,20 +47,21 @@
4247
'License :: OSI Approved :: Apache Software License',
4348
'Programming Language :: Python',
4449
'Programming Language :: Python :: 3',
45-
'Programming Language :: Python :: 3.6',
46-
'Programming Language :: Python :: 3.7',
4750
'Programming Language :: Python :: 3.8',
51+
'Programming Language :: Python :: 3.9',
52+
'Programming Language :: Python :: 3.10',
53+
'Programming Language :: Python :: 3.11',
4854
'Intended Audience :: Developers',
4955
'Environment :: Console',
5056
],
57+
python_requires='>=3.8',
5158
platforms=['Any'],
5259
scripts=[],
5360
provides=['st2auth_keystone_backend'],
5461
packages=find_packages(),
5562
include_package_data=True,
5663
install_requires=install_reqs,
5764
dependency_links=dep_links,
58-
test_suite='tests',
5965
entry_points={
6066
'st2auth.backends.backend': [
6167
'keystone = st2auth_keystone_backend.keystone:KeystoneAuthenticationBackend',

st2auth_keystone_backend/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from keystone import KeystoneAuthenticationBackend
16+
from .keystone import KeystoneAuthenticationBackend
1717

1818
__all__ = [
1919
'KeystoneAuthenticationBackend'
2020
]
2121

22-
__version__ = '0.2.0'
22+
__version__ = '0.3.0'

st2auth_keystone_backend/keystone.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
# limitations under the License.
1515

1616
import logging
17-
import httplib
17+
import http.client
1818

1919
import requests
2020

21-
from six.moves.urllib.parse import urlparse
22-
from six.moves.urllib.parse import urljoin
21+
from urllib.parse import urljoin, urlparse
2322

2423
__all__ = [
2524
'KeystoneAuthenticationBackend'
@@ -66,7 +65,7 @@ def authenticate(self, username, password):
6665
LOG.debug('Authentication for user "{}" failed: {}'.format(username, str(e)))
6766
return False
6867

69-
if login.status_code in [httplib.OK, httplib.CREATED]:
68+
if login.status_code in [http.client.OK, http.client.CREATED]:
7069
LOG.debug('Authentication for user "{}" successful'.format(username))
7170
return True
7271
else:

test-requirements.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
mock==3.0.5
2-
nose>=1.3.7
1+
flake8==7.0.0
2+
mock==5.1.0
33
pep8==1.7.1
4-
pylint==1.9.4
5-
st2flake8==0.1.0
6-
unittest2
4+
pylint~=3.1.0
5+
pytest
6+
st2flake8

tests/unit/test_keystone_backend.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414
# limitations under the License.
1515

1616
import sys
17-
import httplib
17+
import http.client
1818

19-
import unittest2
19+
import unittest
2020
import mock
2121
from requests.models import Response
2222

2323
from st2auth_keystone_backend.keystone import KeystoneAuthenticationBackend
2424

2525

26-
class KeystoneAuthenticationBackendTestCase(unittest2.TestCase):
26+
class KeystoneAuthenticationBackendTestCase(unittest.TestCase):
2727
def _mock_keystone(self, *args, **kwargs):
2828
return_codes = {
29-
'goodv2': httplib.OK,
30-
'goodv3': httplib.CREATED,
31-
'bad': httplib.UNAUTHORIZED
29+
'goodv2': http.client.OK,
30+
'goodv3': http.client.CREATED,
31+
'bad': http.client.UNAUTHORIZED
3232
}
3333
json = kwargs.get('json')
3434
res = Response()
@@ -70,4 +70,4 @@ def test_get_v3_creds(self):
7070
self.assertEqual('password', creds['auth']['identity']['password']['user']['password'])
7171

7272
if __name__ == '__main__':
73-
sys.exit(unittest2.main())
73+
sys.exit(unittest.main())

tox.ini

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
[tox]
2-
envlist = py27,lint
2+
envlist = py36,py38,py39,py310,py311,lint
33

44
[testenv]
55
deps = -r{toxinidir}/test-requirements.txt
6-
commands = python setup.py test
6+
commands = pytest
7+
8+
[testenv:py38]
9+
basepython = python3.8
10+
11+
[testenv:py39]
12+
basepython = python3.9
13+
14+
[testenv:py310]
15+
basepython = python3.10
16+
17+
[testenv:py311]
18+
basepython = python3.11
719

820
[testenv:lint]
9-
deps = -r{toxinidir}/test-requirements.txt
1021
commands = flake8 --config ./lint-configs/python/.flake8 st2auth_keystone_backend/
1122
pylint -E --rcfile=./lint-configs/python/.pylintrc st2auth_keystone_backend/

0 commit comments

Comments
 (0)