Skip to content

Commit 732d384

Browse files
author
Briar Scott
committed
Remove Python2 support
1 parent 6d83b95 commit 732d384

File tree

7 files changed

+22
-34
lines changed

7 files changed

+22
-34
lines changed

.github/workflows/python-ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77

88
strategy:
99
matrix:
10-
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
10+
python-version: [3.6, 3.7, 3.8, 3.9]
1111

1212
steps:
1313
- uses: actions/checkout@v2
@@ -17,12 +17,13 @@ jobs:
1717
python-version: ${{ matrix.python-version }}
1818
- name: Dependencies
1919
run: |
20-
pip install -r requirements.txt
20+
pip install .
2121
pip install -r tests/requirements.txt
2222
- name: Lint with flake8
2323
run: flake8
24-
- name: Test with nose2
25-
run: nose2
24+
- name: Test with Python3
25+
working-directory: tests
26+
run: python3 -m unittest
2627
- name: Demo dependencies
2728
working-directory: demo
2829
run: pip install -r requirements.txt
@@ -31,4 +32,4 @@ jobs:
3132
run: printf "[duo]\nclient_id=DIAAAAAAAAAAAAAAAAAA\nclient_secret=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\napi_hostname=example.duosecurity.com\nredirect_uri=http://localhost:8080\nfailmode=closed\n" > ./duo.conf
3233
- name: Verify flask can load demo
3334
working-directory: demo
34-
run: flask routes
35+
run: flask routes

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![License](https://img.shields.io/badge/License-View%20License-orange)](https://github.com/duosecurity/duo_universal_python/blob/master/LICENSE)
88

99

10-
This SDK allows a web developer to quickly add Duo's interactive, self-service, two-factor authentication to any Python web login form. Both Python 2 and Python 3 are supported.
10+
This SDK allows a web developer to quickly add Duo's interactive, self-service, two-factor authentication to any Python3 web login form. Only Python 3 is supported.
1111

1212
What's here:
1313
* `duo_universal` - The Python Duo SDK for interacting with the Duo Universal Prompt
@@ -17,7 +17,7 @@ What's here:
1717
## Getting Started
1818
To use the SDK in your existing development environment, install it from pypi (https://pypi.org/project/duo_universal).
1919
```
20-
pip install duo_universal
20+
pip3 install duo_universal
2121
```
2222
Once it's installed, see our developer documentation at https://duo.com/docs/duoweb and `demo/app.py` in this repo for guidance on integrating Duo 2FA into your web application.
2323

@@ -26,37 +26,29 @@ To contribute, fork this repo and make a pull request with your changes when the
2626

2727
If you're not already working from a dedicated development environment, it's recommended a virtual environment is used. Assuming a virtual environment named `env`, create and activate the environment:
2828
```
29-
# Python 3
30-
python -m venv env
31-
source env/bin/activate
32-
33-
# Python 2
34-
virtualenv env
29+
python3 -m venv env
3530
source env/bin/activate
3631
```
3732

3833
Build and install the SDK from source:
3934
```
40-
pip install -r requirements.txt
41-
pip install .
35+
pip3 install -r requirements.txt
36+
pip3 install .
4237
```
4338

4439
## Tests
4540
Install the test requirements:
4641
```
4742
cd tests
48-
pip install -r requirements.txt
43+
pip3 install -r requirements.txt
4944
```
5045
Then run tests from the `test` directory:
5146
```
5247
# Run an individual test file
53-
python <test_name>.py
54-
55-
# Run all tests with nose
56-
nose2
48+
python3 <test_name>.py
5749
5850
# Run all tests with unittest
59-
python -m unittest
51+
python3 -m unittest
6052
```
6153

6254
## Lint

demo/README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Duo Universal Python SDK Demo
22

3-
A simple Python web application that serves a logon page integrated with Duo 2FA.
3+
A simple Python3 web application that serves a logon page integrated with Duo 2FA.
44

55
## Setup
66
Change to the "demo" directory
@@ -10,18 +10,13 @@ cd demo
1010

1111
Set up a virtual environment
1212
```
13-
# Python 3
14-
python -m venv env
15-
source env/bin/activate
16-
17-
# Python 2
18-
virtualenv env
13+
python3 -m venv env
1914
source env/bin/activate
2015
```
2116

2217
Install the demo requirements:
2318
```
24-
pip install -r requirements.txt
19+
pip3 install -r requirements.txt
2520
```
2621

2722
Then, create a `Web SDK` application in the Duo Admin Panel. See https://duo.com/docs/protecting-applications for more details.
@@ -31,7 +26,7 @@ Then, create a `Web SDK` application in the Duo Admin Panel. See https://duo.com
3126
1. Copy the Client ID, Client Secret, and API Hostname values for your `Web SDK` application into the `duo.conf` file.
3227
1. Start the app.
3328
```
34-
python app.py
29+
python3 app.py
3530
```
3631
1. Navigate to http://localhost:8080.
3732
1. Log in with the user you would like to enroll in Duo or with an already enrolled user (any password will work).

duo_universal/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from six.moves.urllib.parse import urlencode
1+
from urllib.parse import urlencode
22
import time
33
import jwt
44
import requests

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ def get_version(rel_path):
4848
description='Duo Web SDK for two-factor authentication',
4949
long_description=long_description,
5050
long_description_content_type='text/markdown',
51+
python_requires='>=3',
5152
classifiers=[
52-
'Programming Language :: Python',
53+
'Programming Language :: Python :: 3',
5354
'License :: OSI Approved :: BSD License'
5455
],
5556
install_requires=install_requires,

tests/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
mock>=3.0.5
2-
nose2>=0.9.1
32
flake8>=3.7.9
43
dlint>=0.9.2

tests/test_create_auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from six.moves.urllib.parse import urlencode
1+
from urllib.parse import urlencode
22
from duo_universal import client
33
from mock import MagicMock, patch
44
import jwt

0 commit comments

Comments
 (0)