Skip to content

Commit a7bd326

Browse files
authored
0.3.0: update python and deps (#12)
2 parents dee24df + 6d92a5a commit a7bd326

File tree

10 files changed

+111
-59
lines changed

10 files changed

+111
-59
lines changed

.github/workflows/tox.yaml

Lines changed: 79 additions & 0 deletions
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

Lines changed: 0 additions & 29 deletions
This file was deleted.

lint-configs/python/.pylintrc

Lines changed: 1 addition & 6 deletions
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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
passlib>=1.7.1,<1.8.0
1+
# passlib can use several libs to provide bcrypt (which is required for htpasswd support),
2+
# but passlib deprecated support for py-bcrypt, a bcrypt lib alternative.
3+
# The [bcrypt] extra ensures we use bcrypt instead of some other lib.
4+
passlib[bcrypt]>=1.7.1,<1.8.0

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,28 @@
4040
author='StackStorm, Inc.',
4141
author_email='[email protected]',
4242
url='https://github.com/StackStorm/st2-auth-backend-flat-file',
43+
license='Apache License (2.0)',
4344
download_url='https://github.com/StackStorm/st2-auth-backend-flat-file/tarball/master',
4445
classifiers=[
4546
'Development Status :: 3 - Alpha',
4647
'License :: OSI Approved :: Apache Software License',
4748
'Programming Language :: Python',
4849
'Programming Language :: Python :: 3',
49-
'Programming Language :: Python :: 3.6',
50-
'Programming Language :: Python :: 3.7',
5150
'Programming Language :: Python :: 3.8',
51+
'Programming Language :: Python :: 3.9',
52+
'Programming Language :: Python :: 3.10',
53+
'Programming Language :: Python :: 3.11',
5254
'Intended Audience :: Developers',
5355
'Environment :: Console',
5456
],
57+
python_requires='>=3.8',
5558
platforms=['Any'],
5659
scripts=[],
5760
provides=['st2auth_flat_file_backend'],
5861
packages=find_packages(),
5962
include_package_data=True,
6063
install_requires=install_reqs,
6164
dependency_links=dep_links,
62-
test_suite='tests',
6365
entry_points={
6466
'st2auth.backends.backend': [
6567
'flat_file = st2auth_flat_file_backend.flat_file:FlatFileAuthenticationBackend',

st2auth_flat_file_backend/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
'FlatFileAuthenticationBackend'
2222
]
2323

24-
__version__ = '0.2.0'
24+
__version__ = '0.3.0'

st2auth_flat_file_backend/flat_file.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ class HttpasswdFileWithComments(HtpasswdFile):
3333
"""
3434

3535
def _load_lines(self, lines):
36-
result = super(HttpasswdFileWithComments, self)._load_lines(lines=lines)
36+
super(HttpasswdFileWithComments, self)._load_lines(lines=lines)
3737

3838
# Filter out comments
3939
self._records.pop(COMMENT_MARKER, None)
4040
assert COMMENT_MARKER not in self._records
4141

42-
return result
43-
4442
def _parse_record(self, record, lineno):
4543
if record.startswith(b'#'):
4644
# Comment, add special marker so we can filter it out later

test-requirements.txt

Lines changed: 5 additions & 5 deletions
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_flat_file_backend.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
import os
1717
import sys
1818

19-
import unittest2
19+
import unittest
2020

2121
from st2auth_flat_file_backend.flat_file import FlatFileAuthenticationBackend
2222

2323
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
2424

2525

26-
class FlatFileAuthenticationBackendTestCase(unittest2.TestCase):
26+
class FlatFileAuthenticationBackendTestCase(unittest.TestCase):
2727
def test_authenticate_httpasswd_file_without_comments(self):
2828
file_path = os.path.join(BASE_DIR, '../fixtures/htpasswd_test')
2929
backend = FlatFileAuthenticationBackend(file_path=file_path)
@@ -69,4 +69,4 @@ def test_authenticate_httpasswd_file_doesnt_exist(self):
6969
self.assertRaises(IOError, backend.authenticate, username='doesntexist', password='bar')
7070

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

tox.ini

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
[tox]
2-
envlist = py27,py36,lint
2+
envlist = py38,py39,py310,py311,lint
33

44
[testenv]
55
deps = -r{toxinidir}/test-requirements.txt
6+
commands = pytest
67

7-
[testenv:py27]
8-
basepython = python2.7
9-
commands = python setup.py test
8+
[testenv:py38]
9+
basepython = python3.8
1010

11-
[testenv:py36]
12-
basepython = python3.6
13-
commands = python setup.py test
11+
[testenv:py39]
12+
basepython = python3.9
13+
14+
[testenv:py310]
15+
basepython = python3.10
16+
17+
[testenv:py311]
18+
basepython = python3.11
1419

1520
[testenv:lint]
16-
deps = -r{toxinidir}/test-requirements.txt
1721
commands = flake8 --config ./lint-configs/python/.flake8 st2auth_flat_file_backend/
1822
pylint -E --rcfile=./lint-configs/python/.pylintrc st2auth_flat_file_backend/

0 commit comments

Comments
 (0)