Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies #839

Merged
merged 32 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
480768f
updated dependencies
edsu Apr 11, 2023
3ccc7ea
Use httpbin fork
edsu Apr 12, 2023
e824ffd
pop_path_info
edsu Jun 29, 2023
5b72d96
Spaces in test responses
edsu Jun 29, 2023
0bdc968
httpbin adjustments
edsu Sep 22, 2023
bfbb4ab
Merge branch 'main' into upgrade-dependencies
tw4l Mar 27, 2024
778556d
Add asserts to TestInputReq for app and testapp
tw4l Mar 28, 2024
a91cfd9
Move asserts
tw4l Mar 28, 2024
a8ed1db
Test Python 3.8-3.11
tw4l Mar 28, 2024
0c6b21e
Test Python 3.8-3.11 in tox
tw4l Mar 28, 2024
9a5da9b
Remove asserts
tw4l Mar 28, 2024
d253d2b
Pin to specific versions of werkzeug, flask, jinja2
tw4l Mar 28, 2024
b6e4037
Temporarily comment out bad content length tests
tw4l Mar 28, 2024
44e2532
Pin gevent to 22.10.1 for now
tw4l Mar 28, 2024
2f5d169
More dependency pinning
tw4l Mar 28, 2024
b6e8d7f
Assert TestInputReq.app exists
tw4l Mar 28, 2024
82ae625
Remove assert
tw4l Mar 28, 2024
ed25b0a
Call tests with pytest rather than py.test
tw4l Mar 28, 2024
63560e0
Unpin WebTest
tw4l Mar 28, 2024
543849f
Revert combining if lang statements
tw4l Mar 28, 2024
60fd7b2
Remove flask
tw4l Mar 29, 2024
1181f2e
Unpin redis
tw4l Mar 29, 2024
575b2e5
Rename pytest's deprecated setup to setup_method in test classes
tw4l Mar 29, 2024
f4ccdfc
Update force https test for new behavior
tw4l Mar 29, 2024
2e3342c
Switch some requirements to >= to get minor/patch updates
tw4l Mar 29, 2024
d69bffd
Enforce Python>=3.8 required in setup.py
tw4l Mar 29, 2024
930c901
Ensure greenlet 2 not 3 is used with pinned gevent
tw4l Mar 29, 2024
ea05caa
Drop werkzeug version to support Python 3.7-3.11
tw4l Apr 1, 2024
b51c0bb
Drop gevent to 22.10.2 to support Python 3.7
tw4l Apr 1, 2024
3b554fb
Revert spacing changes for older 3.7-supporting werkzeug
tw4l Apr 1, 2024
7b5544d
More spacing test fixes
tw4l Apr 1, 2024
8e1cd43
Pin markupsafe>=2.1.1
tw4l Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 3
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- name: checkout
Expand Down
8 changes: 4 additions & 4 deletions pywb/apps/frontendapp.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from gevent.monkey import patch_all; patch_all()

from werkzeug.routing import Map, Rule, RequestRedirect, Submount
from werkzeug.wsgi import pop_path_info
from wsgiref.util import shift_path_info
from six.moves.urllib.parse import urljoin, parse_qsl
from six import iteritems
from warcio.utils import to_native_str
Expand Down Expand Up @@ -558,9 +558,9 @@ def setup_paths(self, environ, coll, record=False):
return

if coll != '$root':
pop_path_info(environ)
shift_path_info(environ)
if record:
pop_path_info(environ)
shift_path_info(environ)

paths = [self.warcserver.root_dir]

Expand Down Expand Up @@ -669,7 +669,7 @@ def handle_request(self, environ, start_response):

lang = args.pop('lang', '')
if lang:
pop_path_info(environ)
shift_path_info(environ)

if lang:
environ['pywb_lang'] = lang
Expand Down
2 changes: 1 addition & 1 deletion pywb/apps/rewriterapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, framed_replay=False, jinja_env=None, config=None, paths=None)

if not jinja_env:
jinja_env = JinjaEnv(globals={'static_path': 'static'},
extensions=['jinja2.ext.i18n', 'jinja2.ext.with_'])
extensions=['jinja2.ext.i18n'])
jinja_env.jinja_env.install_null_translations()

self.jinja_env = jinja_env
Expand Down
10 changes: 5 additions & 5 deletions pywb/rewrite/templateview.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from six.moves.urllib.parse import urlsplit, quote

from jinja2 import Environment, TemplateNotFound, contextfunction, select_autoescape
from jinja2 import Environment, TemplateNotFound, pass_context, select_autoescape
from jinja2 import FileSystemLoader, PackageLoader, ChoiceLoader

from webassets.ext.jinja2 import AssetsExtension
Expand Down Expand Up @@ -139,7 +139,7 @@ def get_translate(context):
return loc_map.get(loc)

def override_func(jinja_env, name):
@contextfunction
@pass_context
def get_override(context, text):
translate = get_translate(context)
if not translate:
Expand All @@ -158,7 +158,7 @@ def get_override(context, text):

# Special _Q() function to return %-encoded text, necessary for use
# with text in banner
@contextfunction
@pass_context
def quote_gettext(context, text):
translate = get_translate(context)
if not translate:
Expand All @@ -171,7 +171,7 @@ def quote_gettext(context, text):
self.jinja_env.globals['_Q'] = quote_gettext
self.jinja_env.globals['default_locale'] = default_locale

@contextfunction
@pass_context
def switch_locale(context, locale):
environ = context.get('env')
curr_loc = environ.get('pywb_lang', '')
Expand All @@ -188,7 +188,7 @@ def switch_locale(context, locale):

return app_prefix + '/' + locale + request_uri

@contextfunction
@pass_context
def get_locale_prefixes(context):
environ = context.get('env')
locale_prefixes = {}
Expand Down
2 changes: 1 addition & 1 deletion pywb/warcserver/test/test_inputreq.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __call__(self, environ, start_response):

#=============================================================================
class TestInputReq(object):
def setup(self):
def setup_method(self):
self.app = InputReqApp()
self.testapp = webtest.TestApp(self.app)

Expand Down
2 changes: 1 addition & 1 deletion pywb/warcserver/test/test_upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class TestUpstream(LiveServerTests, HttpBinLiveTests, BaseTestClass):
def setup(self):
def setup_method(self):
app = BaseWarcServer()

base_url = 'http://localhost:{0}'.format(self.server.port)
Expand Down
11 changes: 6 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
six
warcio>=1.7.1
requests
redis<3.0
jinja2<3.0.0
redis
jinja2>=3.1.2
surt>=0.3.1
brotlipy
pyyaml
werkzeug
werkzeug==2.2.3
webencodings
gevent==21.12.0
gevent==22.10.2
greenlet>=2.0.2,<3.0
webassets==2.0
portalocker
wsgiprox>=1.5.1
fakeredis<1.0
tldextract
python-dateutil
markupsafe<2.1.0
markupsafe>=2.1.1
ua_parser
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get_package_data():
"translate_toolkit"
],
},
python_requires='>=3.7,<3.12',
tests_require=load_requirements("test_requirements.txt"),
cmdclass={'test': PyTest},
test_suite='',
Expand All @@ -131,16 +132,12 @@ def get_package_data():
'Environment :: Web Environment',
'License :: OSI Approved :: GNU General Public License (GPL)',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Internet :: Proxy Servers',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: WSGI',
Expand Down
3 changes: 1 addition & 2 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ WebTest
pytest-cov
mock
urllib3
httpbin==0.5.0
flask<2.0
ujson
lxml
httpbin>=0.10.2
2 changes: 1 addition & 1 deletion tests/test_force_https.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ def test_force_https_root_replay_1(self, fmod):
resp = self.get('/20140128051539{0}/http://www.iana.org/domains/example', fmod,
headers={'X-Forwarded-Proto': 'https'})

assert resp.headers['Location'] == 'https://localhost:80/20140128051539{0}/http://www.iana.org/domains/reserved'.format(fmod)
assert resp.headers['Location'] == 'https://localhost:80/20140128051539{0}/http://www.iana.org/help/example-domains'.format(fmod)


41 changes: 22 additions & 19 deletions tests/test_live_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,28 @@ def test_live_head(self, fmod_sl):
resp = self.head('/live/{0}httpbin.org/get?foo=bar', fmod_sl)
assert resp.status_int == 200

@pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
def test_live_bad_content_length(self, fmod_sl):
resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl, status=200)
assert resp.headers['Content-Length'] == '149'

resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl, status=200)
assert resp.headers['Content-Length'] == '90'

@pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
def test_live_bad_content_length_with_range(self, fmod_sl):
resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl,
headers={'Range': 'bytes=0-'}, status=206)
assert resp.headers['Content-Length'] == '149'
assert resp.headers['Content-Range'] == 'bytes 0-148/149'

resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl,
headers={'Range': 'bytes=0-'}, status=206)
assert resp.headers['Content-Length'] == '90'
assert resp.headers['Content-Range'] == 'bytes 0-89/90'
# Following tests are temporarily commented out because latest version of PSF httpbin
# now returns 400 if content-length header isn't parsable as an int

# @pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
# def test_live_bad_content_length(self, fmod_sl):
# resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl, status=200)
# assert resp.headers['Content-Length'] == '149'

# resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl, status=200)
# assert resp.headers['Content-Length'] == '90'

# @pytest.mark.skipif(sys.version_info < (3,0), reason='does not respond in 2.7')
# def test_live_bad_content_length_with_range(self, fmod_sl):
# resp = self.get('/live/{0}httpbin.org/response-headers?content-length=149,149', fmod_sl,
# headers={'Range': 'bytes=0-'}, status=206)
# assert resp.headers['Content-Length'] == '149'
# assert resp.headers['Content-Range'] == 'bytes 0-148/149'

# resp = self.get('/live/{0}httpbin.org/response-headers?Content-Length=xyz', fmod_sl,
# headers={'Range': 'bytes=0-'}, status=206)
# assert resp.headers['Content-Length'] == '90'
# assert resp.headers['Content-Range'] == 'bytes 0-89/90'

def test_custom_unicode_header(self, fmod_sl):
value = u'⛄'
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ testpaths =
tests

[tox]
envlist = py36, py37, py38, py39, py310
envlist = py37, py38, py39, py310, py311

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[testenv]
setenv = PYWB_NO_VERIFY_SSL = 1
Expand All @@ -22,6 +22,6 @@ deps =
-rrequirements.txt
-rextra_requirements.txt
commands =
py.test --cov-config .coveragerc --cov pywb -v --doctest-modules ./pywb/ tests/
pytest --cov-config .coveragerc --cov pywb -v --doctest-modules ./pywb/ tests/


Loading