Skip to content

Commit 796fe1d

Browse files
committed
Merge branch 'master' into bcwu-redeploy2unknown
2 parents 0218aa9 + 19f3769 commit 796fe1d

11 files changed

+14
-61
lines changed

.github/workflows/main.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
# TODO: work on windows-latest compatibility?
1616
os: [ubuntu-latest]
17-
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
17+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1818
include:
1919
- os: macos-latest
2020
python-version: '3.9'
@@ -28,10 +28,8 @@ jobs:
2828
python-version: ${{ matrix.python-version }}
2929
- run: pip install -r requirements.txt
3030
- run: pip freeze
31-
- if: matrix.python-version > '3.5'
32-
run: make fmt
33-
- if: matrix.python-version >= '3.6'
34-
run: make lint
31+
- run: make fmt
32+
- run: make lint
3533
- run: python setup.py --version
3634
- run: make test-${{ matrix.python-version }}
3735
prerelease-test:

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tooling](https://packaging.python.org/guides/tool-recommendations/).
55

66
To get started, you'll want to:
77
- clone the repo into a project directory
8-
- setup a virtual 3.5+ python environment in the project directory
8+
- setup a virtual 3.7+ python environment in the project directory
99
- activate that virtual environment
1010
- install the dependencies
1111
- validate your build environment with some sample commands

Makefile

+2-8
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ SOURCE_DATE_EPOCH := $(shell date +%s)
3535
export SOURCE_DATE_EPOCH
3636

3737
.PHONY: all-tests
38-
all-tests: all-images test-3.5 test-3.6 test-3.7 test-3.8 test-3.9 test-3.10
38+
all-tests: all-images test-3.7 test-3.8 test-3.9 test-3.10
3939

4040
.PHONY: all-images
41-
all-images: image-3.5 image-3.6 image-3.7 image-3.8 image-3.9 image-3.10
41+
all-images: image-3.7 image-3.8 image-3.9 image-3.10
4242

4343
image-%:
4444
docker build -t rsconnect-python:$* --build-arg BASE_IMAGE=python:$*-slim .
@@ -62,9 +62,6 @@ mock-test-%: clean-stores
6262
fmt-%:
6363
$(RUNNER) 'black .'
6464

65-
.PHONY: fmt-3.5
66-
fmt-3.5: .fmt-unsupported
67-
6865
.PHONY: .fmt-unsupported
6966
.fmt-unsupported:
7067
@echo ERROR: This python version cannot run the fmting tools
@@ -83,9 +80,6 @@ lint-%:
8380
$(RUNNER) 'flake8 tests/'
8481
$(RUNNER) 'mypy -p rsconnect'
8582

86-
.PHONY: lint-3.5
87-
lint-3.5: .lint-unsupported
88-
8983
.PHONY: .lint-unsupported
9084
.lint-unsupported:
9185
@echo ERROR: This python version cannot run the linting tools

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
!!! warning
44

5-
As of version 1.7.0, rsconnect-python requires Python version 3.5 or higher. Please see the
6-
[official announcement](https://www.rstudio.com/blog/rstudio-connect-2021-08-python-updates/)
7-
for details about this decision.
5+
As of version 1.14.0, rsconnect-python requires Python version 3.7 or higher.
86

97
This package provides a CLI (command-line interface) for interacting
108
with and deploying to Posit Connect. This is also used by the

requirements.txt

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
black==22.3.0; python_version >= '3.6'
1+
black==22.3.0
22
click>=7.0.0
33
coverage
44
flake8
@@ -8,13 +8,12 @@ importlib-metadata
88
ipykernel
99
ipython
1010
jupyter_client
11-
mypy; python_version >= '3.6'
11+
mypy
1212
nbconvert
13-
pyjwt>=2.4.0; python_version >= '3.6'
14-
pyjwt; python_version < '3.6'
13+
pyjwt>=2.4.0
1514
pytest
1615
pytest-cov
17-
pytest-mypy; python_version >= '3.5'
16+
pytest-mypy
1817
semver>=2.0.0,<3.0.0
1918
setuptools_scm
2019
six>=1.14.0

rsconnect/json_web_token.py

-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import base64
66
from datetime import datetime, timedelta, timezone
77
import os
8-
import sys
98

109
import binascii
1110
import jwt
@@ -64,14 +63,6 @@ def validate_hs256_secret_key(key: bytes):
6463
raise RSConnectException("Secret key expected to be at least 32 bytes in length")
6564

6665

67-
def is_jwt_compatible_python_version() -> bool:
68-
"""
69-
JWT library is incompatible with Python 3.5
70-
"""
71-
72-
return not sys.version_info < (3, 6)
73-
74-
7566
def parse_client_response(response):
7667
"""
7768
Helper to handle the response type from RSConnectClient, because

rsconnect/main.py

-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
from .json_web_token import (
7272
read_secret_key,
7373
validate_hs256_secret_key,
74-
is_jwt_compatible_python_version,
7574
TokenGenerator,
7675
produce_bootstrap_output,
7776
parse_client_response,
@@ -333,11 +332,6 @@ def bootstrap(
333332
verbose,
334333
):
335334
set_verbosity(verbose)
336-
if not is_jwt_compatible_python_version():
337-
raise RSConnectException(
338-
"Python version > 3.5 required for JWT generation. Please upgrade your Python installation."
339-
)
340-
341335
if not server.startswith("http"):
342336
raise RSConnectException("Server URL expected to begin with transfer protocol (ex. http/https).")
343337

setup.cfg

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ install_requires =
2020
click>=7.0.0
2121
pip>=10.0.0
2222
semver>=2.0.0,<3.0.0
23-
pyjwt>=2.4.0; python_version >= '3.6'
24-
pyjwt; python_version < '3.6'
23+
pyjwt>=2.4.0
2524
setup_requires =
2625
setuptools
2726
setuptools_scm>=3.4
2827
toml
2928
wheel
3029
packages = rsconnect
31-
python_requires = >=3.5
30+
python_requires = >=3.7
3231
zip_safe = true
3332

3433
[options.entry_points]

tests/test_json_web_token.py

-11
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
SECRET_KEY_ENV,
1919
read_secret_key,
2020
produce_bootstrap_output,
21-
is_jwt_compatible_python_version,
2221
parse_client_response,
2322
TokenGenerator,
2423
JWTEncoder,
@@ -43,9 +42,6 @@ def are_unix_timestamps_approx_equal(a, b):
4342

4443
class TestJsonWebToken(TestCase):
4544
def setUp(self):
46-
if not is_jwt_compatible_python_version():
47-
self.skipTest("JWTs not supported in Python < 3.6")
48-
4945
# decoded copy of the base64-encoded key in testdata/jwt/secret.key
5046
self.secret_key = b"12345678901234567890123456789012345"
5147
self.secret_key_b64 = b"MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU="
@@ -186,13 +182,6 @@ def test_parse_client_response(self):
186182
with pytest.raises(RSConnectException):
187183
parse_client_response(None)
188184

189-
def test_is_jwt_compatible_python_version(self):
190-
"""
191-
With setUp() skipping invalid versions, this test should always return True
192-
regardless of the particular python env we're running the tests in
193-
"""
194-
self.assertTrue(is_jwt_compatible_python_version())
195-
196185
def test_jwt_encoder_constructor(self):
197186
encoder = JWTEncoder("issuer", "audience", self.secret_key)
198187

tests/test_main.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import pytest
1010
from click.testing import CliRunner
1111

12-
from rsconnect.json_web_token import SECRET_KEY_ENV, is_jwt_compatible_python_version
12+
from rsconnect.json_web_token import SECRET_KEY_ENV
1313

1414
from .utils import (
1515
apply_common_args,
@@ -561,9 +561,6 @@ def test_add_shinyapps_missing_options(self):
561561

562562
class TestBootstrap(TestCase):
563563
def setUp(self):
564-
if not is_jwt_compatible_python_version():
565-
self.skipTest("JWTs not supported in Python < 3.6")
566-
567564
self.mock_server = "http://localhost:8080"
568565
self.mock_uri = "http://localhost:8080/__api__/v1/experimental/bootstrap"
569566
self.jwt_keypath = "tests/testdata/jwt/secret.key"

tests/test_utils.py

-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from unittest import TestCase
22
from datetime import timedelta
33

4-
from rsconnect.json_web_token import is_jwt_compatible_python_version
5-
64
from rsconnect.json_web_token import JWTEncoder
75

86
from tests.utils import (
@@ -12,10 +10,6 @@
1210

1311

1412
class TestJwtUtils(TestCase):
15-
def setUp(self):
16-
if not is_jwt_compatible_python_version():
17-
self.skipTest("JWTs not supported in Python < 3.6")
18-
1913
def test_jwt_decoder(self):
2014

2115
secret = b"12345678912345678912345678912345"

0 commit comments

Comments
 (0)