From 9ab953ed23df16d4b5685e2029e4e73dd662d09b Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 09:19:59 -0400 Subject: [PATCH 1/9] Use extlinks for changelog. --- docs/conf.py | 7 +++++ docs/history.rst | 82 +++++++++++++++++++----------------------------- 2 files changed, 39 insertions(+), 50 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 89ed2dc..d33ee0d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,6 +4,7 @@ needs_sphinx = '1.0' extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx', + 'sphinx.ext.extlinks', 'sphinxcontrib.autohttp.tornado'] master_doc = 'index' project = 'sprockets.mixins.mediatype' @@ -32,3 +33,9 @@ intersphinx_mapping = { 'sprockets': ('https://sprockets.readthedocs.org/en/latest/', None), 'tornado': ('http://tornadoweb.org/en/latest/', None), } + +# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html +extlinks = { + 'compare': ('https://github.com/sprockets/sprockets.mixins.mediatype' + '/compare/%s', '%s') +} diff --git a/docs/history.rst b/docs/history.rst index 403f425..1f6d6cd 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -1,59 +1,59 @@ Version History =============== -`3.0.4`_ (2 Nov 2020) ---------------------- +:compare:`3.0.4 <3.0.3...3.0.4>` (2 Nov 2020) +--------------------------------------------- - Return a "400 Bad Request" when an invalid Content-Type header is received instead of failing with an internal server error -`3.0.3`_ (14 Sep 2020) ----------------------- +:compare:`3.0.3 <3.0.2...3.0.3>` (14 Sep 2020) +---------------------------------------------- - Import from collections.abc instead of collections (thanks @nullsvm) -`3.0.2`_ (4 May 2020) ---------------------- +:compare:`3.0.2 <3.0.1...3.0.2>` (4 May 2020) +--------------------------------------------- - Do not log tracebacks when decoding the request body fails -`3.0.1`_ (5 Mar 2019) ---------------------- +:compare:`3.0.1 <3.0.0...3.0.1>` (5 Mar 2019) +--------------------------------------------- - Set Tornado PIN to >=5, <7 - Remove setuptools_scm -`3.0.0`_ (4 Dec 2018) ---------------------- +:compare:`3.0.0 <2.2.2...3.0.0>` (4 Dec 2018) +--------------------------------------------- - Add MessagePack dependencies to package extras (eg. `pip install sprockets.mixins.mediatype[msgpack]`) - Update to minimum of ietfparse 1.5.1 - Drop support for Python < 3.7 - Drop support for Tornado < 5 - Remove deprecated :meth:`sprockets.mixins.mediatype.content.ContentSettings.from_application`. -`2.2.2`_ (7 Apr 2018) ---------------------- +:compare:`2.2.2 <2.2.1...2.2.2>` (7 Apr 2018) +--------------------------------------------- - Add support for Python 3.5 through 3.7 - Add support for Tornado < 6 -`2.2.1`_ (12 Apr 2018) ----------------------- +:compare:`2.2.1 <2.2.0...2.2.1>` (12 Apr 2018) +---------------------------------------------- - Pin :mod:`ietfparse` to avoid breakages introduced in 1.5.0. -`2.2.0`_ (7 Jun 2017) ---------------------- +:compare:`2.2.0 <2.1.0...2.2.0>` (7 Jun 2017) +--------------------------------------------- - Add :func:`sprockets.mixins.mediatype.content.install`. - Add :func:`sprockets.mixins.mediatype.content.get_settings`. - Deprecate :meth:`sprockets.mixins.mediatype.content.ContentSettings.from_application`. - Update to ietfparse 1.4. -`2.1.0`_ (16 Mar 2016) ----------------------- +:compare:`2.1.0 <2.0.1...2.1.0>` (16 Mar 2016) +---------------------------------------------- - Set the :http:header:`Vary` header if we are setting the content type. -`2.0.1`_ (29 Feb 2016) ----------------------- +:compare:`2.0.1 <2.0.0...2.0.1>` (29 Feb 2016) +---------------------------------------------- - Removed deprecation wrapper since it seems to cause really interesting problems including the much feared meta-class error. -`2.0.0`_ (24 Feb 2016) ----------------------- +:compare:`2.0.0 <1.0.4...2.0.0>` (24 Feb 2016) +---------------------------------------------- - Repackage from a module into a package. Distributing raw modules inside of a namespace package is unreliable and questionably correct. - Add :func:`sprockets.mixins.mediatype.content.add_transcoder`. @@ -63,41 +63,23 @@ Version History - Normalize registered MIME types. - Raise a 400 status when content body decoding fails. -`1.0.4`_ (14 Sep 2015) ----------------------- +:compare:`1.0.4 <1.0.3...1.0.4>` (14 Sep 2015) +---------------------------------------------- - Support using the default_content_type in the settings if request does not contain the Accept header -`1.0.3`_ (10 Sep 2015) ----------------------- +:compare:`1.0.3 <1.0.2...1.0.3>` (10 Sep 2015) +---------------------------------------------- - Update installation files -`1.0.2`_ (9 Sep 2015) ---------------------- +:compare:`1.0.2 <1.0.1...1.0.2>` (9 Sep 2015) +--------------------------------------------- - Rename package to mediatype -`1.0.1`_ (9 Sep 2015) ---------------------- +:compare:`1.0.1 <1.0.0...1.0.1>` (9 Sep 2015) +--------------------------------------------- - Repackaged for Travis-CI configuration. -`1.0.0`_ (9 Sep 2015) ---------------------- +:compare:`1.0.0 <0.0.0...1.0.0>` (9 Sep 2015) +--------------------------------------------- - Initial Release - -.. _Next Release: https://github.com/sprockets/sprockets.mixins.mediatype/compare/3.0.4...HEAD -.. _3.0.4: https://github.com/sprockets/sprockets.mixins.mediatype/compare/3.0.3...3.0.4 -.. _3.0.3: https://github.com/sprockets/sprockets.mixins.mediatype/compare/3.0.2...3.0.3 -.. _3.0.2: https://github.com/sprockets/sprockets.mixins.mediatype/compare/3.0.1...3.0.2 -.. _3.0.1: https://github.com/sprockets/sprockets.mixins.mediatype/compare/3.0.0...3.0.1 -.. _3.0.0: https://github.com/sprockets/sprockets.mixins.mediatype/compare/2.2.2...3.0.0 -.. _2.2.2: https://github.com/sprockets/sprockets.mixins.mediatype/compare/2.2.1...2.2.2 -.. _2.2.1: https://github.com/sprockets/sprockets.mixins.mediatype/compare/2.2.0...2.2.1 -.. _2.2.0: https://github.com/sprockets/sprockets.mixins.mediatype/compare/2.1.0...2.2.0 -.. _2.1.0: https://github.com/sprockets/sprockets.mixins.mediatype/compare/2.0.1...2.1.0 -.. _2.0.1: https://github.com/sprockets/sprockets.mixins.mediatype/compare/2.0.0...2.0.1 -.. _2.0.0: https://github.com/sprockets/sprockets.mixins.mediatype/compare/1.0.4...2.0.0 -.. _1.0.4: https://github.com/sprockets/sprockets.mixins.mediatype/compare/1.0.3...1.0.4 -.. _1.0.3: https://github.com/sprockets/sprockets.mixins.mediatype/compare/1.0.2...1.0.3 -.. _1.0.2: https://github.com/sprockets/sprockets.mixins.mediatype/compare/1.0.1...1.0.2 -.. _1.0.1: https://github.com/sprockets/sprockets.mixins.mediatype/compare/1.0.0...1.0.1 -.. _1.0.0: https://github.com/sprockets/sprockets.mixins.mediatype/compare/0.0.0...1.0.0 From 3a6b98eb1cd353eb1e44bd4f82a98672cda4c291 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 09:20:47 -0400 Subject: [PATCH 2/9] Update development toolchain. --- requires/docs.txt | 2 +- requires/testing.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requires/docs.txt b/requires/docs.txt index 12ea570..3c555e5 100644 --- a/requires/docs.txt +++ b/requires/docs.txt @@ -1,2 +1,2 @@ -sphinx==3.2.1 +sphinx==4.2.0 sphinxcontrib-httpdomain==1.7.0 diff --git a/requires/testing.txt b/requires/testing.txt index 77da697..c6e57f6 100644 --- a/requires/testing.txt +++ b/requires/testing.txt @@ -1,3 +1,3 @@ -coverage==5.3 -flake8==3.8.3 -tox==3.20.0 +coverage==5.5 +flake8==3.9.2 +tox==3.24.3 From 66f3bfbca31e8d594d2de6b89f7a0a8774c37890 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 09:21:13 -0400 Subject: [PATCH 3/9] Bump LICENSE date. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index c896130..733aa9d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2015-2020 AWeber Communications +Copyright (c) 2015-2021 AWeber Communications All rights reserved. Redistribution and use in source and binary forms, with or without modification, From c6551e8024001c9958e8e9396ddbf992d6b77304 Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 09:41:32 -0400 Subject: [PATCH 4/9] Stop using the tornado reloader in tests. This causes some interesting warnings. --- tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests.py b/tests.py index 5b735e5..5331448 100644 --- a/tests.py +++ b/tests.py @@ -63,7 +63,7 @@ def pack_bytes(payload): class SendResponseTests(testing.AsyncHTTPTestCase): def get_app(self): - return examples.make_application(debug=True) + return examples.make_application() def test_that_content_type_default_works(self): response = self.fetch('/', method='POST', body='{}', @@ -119,7 +119,7 @@ class GetRequestBodyTests(testing.AsyncHTTPTestCase): super().setUp() def get_app(self): - self.app = examples.make_application(debug=True) + self.app = examples.make_application() return self.app def test_that_request_with_unhandled_type_results_in_415(self): From 665eb71436291643194d900296b8d7ebc15124ce Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 09:42:16 -0400 Subject: [PATCH 5/9] Seperate linting requirements. This will ease implementing Github actions. --- requires/development.txt | 1 + requires/lint.txt | 1 + requires/testing.txt | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 requires/lint.txt diff --git a/requires/development.txt b/requires/development.txt index 7c77917..f6ea5a6 100644 --- a/requires/development.txt +++ b/requires/development.txt @@ -1,3 +1,4 @@ -e .[msgpack] -r docs.txt +-r lint.txt -r testing.txt diff --git a/requires/lint.txt b/requires/lint.txt new file mode 100644 index 0000000..694f7a4 --- /dev/null +++ b/requires/lint.txt @@ -0,0 +1 @@ +flake8==3.9.2 diff --git a/requires/testing.txt b/requires/testing.txt index c6e57f6..1500af8 100644 --- a/requires/testing.txt +++ b/requires/testing.txt @@ -1,3 +1,2 @@ coverage==5.5 -flake8==3.9.2 tox==3.24.3 From 77ecc360263309348fb232796d692123fee7641d Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 18:23:22 -0400 Subject: [PATCH 6/9] Enforce 95% code coverage, --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index fbd2545..3eac929 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,6 +9,7 @@ warning-is-error = 1 strict = 1 [coverage:report] +fail_under = 95 show_missing = 1 [coverage:run] From 9993a81e519b7da78de19ea8a72ebda3c60f94dd Mon Sep 17 00:00:00 2001 From: Dave Shawley Date: Sun, 12 Sep 2021 09:43:28 -0400 Subject: [PATCH 7/9] Add first draft of Github CI pipeline. --- .github/workflows/testing.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/testing.yml diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..214a54d --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,53 @@ +name: Run tests +on: + push: + branches: ["*"] + tags-ignore: ["*"] + pull_request: + branches: ["*"] + +jobs: + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install -r requires/lint.txt + - name: Flake8 + run: | + flake8 sprockets tests.py + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.7, 3.8, 3.9] + steps: + - uses: actions/checkout@v2 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install -r requires/testing.txt . + - name: Run tests + run: | + coverage run -m unittest tests.py + coverage report + coverage xml -o ./coverage.xml + - name: Send coverage data to codecov.io + uses: codecov/codecov-action@v1.3.2 + if: github.event_name == 'push' + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unittests + fail_ci_if_error: true From 9df7604012a073575269219026830b74b5e47a74 Mon Sep 17 00:00:00 2001 From: dave-shawley Date: Mon, 13 Sep 2021 06:50:04 -0400 Subject: [PATCH 8/9] Update testing.yml will be squashed away in the future --- .github/workflows/testing.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 214a54d..2251c27 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -37,7 +37,10 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools - python -m pip install -r requires/testing.txt . + python -m pip install -r requires/testing.txt + python -m pip install -e . + - name: Dump packages + run: python -m pip freeze - name: Run tests run: | coverage run -m unittest tests.py From 85686397d6b64a702bdc25e9e2fcaeb95e9ac0c4 Mon Sep 17 00:00:00 2001 From: dave-shawley Date: Mon, 13 Sep 2021 06:52:56 -0400 Subject: [PATCH 9/9] Update testing.yml to be squishy squashed --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2251c27..cbbb741 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -38,7 +38,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools python -m pip install -r requires/testing.txt - python -m pip install -e . + python -m pip install -e '.[msgpack]' - name: Dump packages run: python -m pip freeze - name: Run tests