diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index b244d75..38fe945 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Install system dependencies run: | @@ -22,17 +22,17 @@ jobs: run: python3 -m twine check dist/* lint: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - with: - python-version: 3.6 - - - name: Install dependencies - run: pip3 install black flake8 + - uses: actions/checkout@v2 + - name: Install system dependencies + run: | + sudo apt update && sudo apt install -y --no-install-recommends python3-setuptools + pip3 install --upgrade setuptools + pip3 install black flake8 + - name: Flake run: flake8 canonicalwebteam tests @@ -40,13 +40,16 @@ jobs: run: black --line-length 79 --check canonicalwebteam tests test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - with: - python-version: 3.6 + - uses: actions/checkout@v2 + + - name: Install system dependencies + run: | + sudo apt update && sudo apt install -y --no-install-recommends python3-setuptools + pip3 install --upgrade setuptools + pip3 install . - name: Install dependencies run: pip3 install . diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3987c..90df62d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.0.0 (2024-07-04) + +Pin to Flask 2.3.3 +Update dependencies: jinja2, Werkzeug, markupsafe, itsdangerous + # 1.0.6 (2022-08-04) Disable MIME-sniffing with `x-content-type-options: NOSNIFF` ([rationale here](https://github.com/canonical/web-design-systems-squad/issues/77#issuecomment-1205100399)) diff --git a/setup.py b/setup.py index de1b7b0..ae9760e 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name="canonicalwebteam.flask-base", - version="1.1.0", + version="2.0.0", description=( "Flask extension that applies common configurations" "to all of webteam's flask apps." @@ -22,14 +22,14 @@ packages=find_packages(), install_requires=[ "canonicalwebteam.yaml-responses[flask] (>=1,<2)", - "flask==1.1.2", - "jinja2 (>=3,<3.1.0)", + "flask==2.3.3", + "jinja2 >= 3.1.2, < 3.2.0", "gevent==21.12.0", "greenlet==1.1.2", "talisker[gunicorn,gevent,flask,prometheus,raven]", - "Werkzeug (>=1.0.0, <1.2)", - "markupsafe >= 1.0, < 2.1.0", - "itsdangerous >= 0.24, < 2.0", + "Werkzeug >= 2.3.7, < 3.0.0", + "markupsafe >= 1.0, < 2.2.0", + "itsdangerous >= 0.24, < 2.2.0", ], dependency_links=[], include_package_data=True, diff --git a/tests/test_flask_base.py b/tests/test_flask_base.py index 54bfe11..0a417ee 100644 --- a/tests/test_flask_base.py +++ b/tests/test_flask_base.py @@ -200,7 +200,7 @@ def test_favicon_redirect(self): self.assertEqual(302, response.status_code) self.assertEqual( response.headers.get("Location"), - "http://localhost" + local_url, + local_url, ) def test_favicon_serve(self): @@ -266,6 +266,7 @@ def test_clear_trailing_slash(self): def test_static_files(self): flask_app = create_test_app() + flask_app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 31536000 # 1 year with flask_app.test_client() as client: # Check basic serving of static files works @@ -279,7 +280,7 @@ def test_static_files(self): max_age = flask_app.config["SEND_FILE_MAX_AGE_DEFAULT"] if max_age: - self.assertIn(f"max-age={max_age.seconds}", plain_cache) + self.assertIn(f"max-age={max_age}", plain_cache) else: self.assertIn("max-age=60", plain_cache)