Repository: NaturalHistoryMuseum/ckanext-doi (language: python)

Issue:
Standardisation
Part of work to standardise package metadata for NHM extensions.

- switch to pyproject.toml
- use custom docker image
- enable readthedocs/mkdocs
- use conventional commits w/ commitizen
- adds precommit hooks
Standardisation
Part of work to standardise package metadata for NHM extensions.

- switch to pyproject.toml
- use custom docker image
- enable readthedocs/mkdocs
- use conventional commits w/ commitizen
- adds precommit hooks


Discussion / hints:

Fix patch:
diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md
index e5153be..4148d18 100644
--- a/.github/SUPPORT.md
+++ b/.github/SUPPORT.md
@@ -2,9 +2,14 @@
 
 ## Documentation
 - [Our API documentation](https://naturalhistorymuseum.github.io/dataportal-docs)
-- [CKAN documentation](http://docs.ckan.org/en/latest)
+- [Official CKAN documentation](http://docs.ckan.org/en/latest)
+
+## Issues
+- [The NHM on Github](https://github.com/NaturalHistoryMuseum)
+- [General issue tracker](https://github.com/NaturalHistoryMuseum/data-portal-issues/issues)
+- [Our CKAN extensions](https://github.com/search?q=topic%3Ackan+org%3ANaturalHistoryMuseum&type=repositories) (for more specific issues)
 
 ## Contact Us
 - [Gitter](https://gitter.im/nhm-data-portal/lobby)
 - [Email _data@nhm.ac.uk_](mailto:data@nhm.ac.uk)
-- [Twitter](https://twitter.com/nhm_data)
\ No newline at end of file
+- [Twitter](https://twitter.com/nhm_data)
diff --git a/.github/nhm-logo.svg b/.github/nhm-logo.svg
index d60d8ee..0fd9545 100644
--- a/.github/nhm-logo.svg
+++ b/.github/nhm-logo.svg
@@ -55,4 +55,4 @@
          d="m 0,0 v 43.253 c 0,1.998 -0.109,3.268 -0.363,4.395 -1.271,5.704 -5.722,8.756 -13.006,8.756 h -2.416 V 32.153 L -32.298,56.404 H -48.447 V 13.152 c 0,-1.998 0.109,-3.271 0.363,-4.397 C -46.812,3.053 -42.361,0 -35.078,0 h 2.416 V 24.614 L -15.931,0 Z m -45.794,53.751 h 12.06 l 20.6,-30.207 v 30.353 h 0.492 c 5.067,0 8.465,-2.251 9.59,-6.576 0.273,-1.053 0.4,-2.252 0.4,-4.305 V 2.651 H -14.514 L -35.313,33.279 V 2.506 h -0.491 c -5.068,0 -8.465,2.254 -9.592,6.578 -0.271,1.053 -0.398,2.252 -0.398,4.305 z M 40.818,19.909 c 0,-3.595 1.562,-5.775 5.104,-5.775 3.543,0 5.104,2.18 5.104,5.775 0,3.597 -1.561,5.778 -5.104,5.778 -3.542,0 -5.104,-2.181 -5.104,-5.778 m 21.491,-5.52 c -0.51,-0.076 -0.945,-0.111 -1.327,-0.111 -1.508,0 -2.052,0.582 -2.471,1.453 l -1.381,2.834 h -1.379 v -4.176 h -2.836 v 11.044 h 4.579 c 2.779,0 4.16,-1.38 4.16,-3.473 0,-1.433 -0.563,-2.414 -1.853,-2.994 z M 53.68,28.847 c -0.455,-0.054 -0.836,-0.073 -1.163,-0.073 -1.544,0 -1.908,0.509 -2.271,1.436 l -1.072,2.815 H 47.922 V 28.847 H 45.16 v 11.045 h 4.323 c 2.78,0 4.161,-1.381 4.161,-3.488 0,-1.435 -0.655,-2.508 -1.89,-3.015 z m -41.545,4.25 c -0.309,0.836 -0.891,2.108 -1.526,3.162 L 9.356,38.348 C 8.629,39.565 8.193,39.892 7.104,39.892 H 5.813 V 28.847 h 2.543 v 6.885 H 8.393 C 8.702,34.878 9.356,33.534 9.992,32.48 l 1.362,-2.27 c 0.618,-1.036 1.09,-1.363 2.162,-1.363 h 1.199 v 11.045 h -2.543 v -6.795 z m 0.291,-18.708 v 4.612 H 8.646 V 14.389 H 5.813 v 11.044 h 2.833 v -4.27 h 3.78 v 4.27 h 2.833 V 14.389 Z m 10.645,14.458 -0.491,1.926 h -3.306 l -0.418,-1.926 h -2.779 l 2.834,11.045 h 3.742 l 3.233,-11.045 z m 38.256,0 -0.453,1.926 h -3.326 l -0.436,-1.926 h -2.779 l 2.978,11.045 h 3.744 L 64.143,28.847 Z M 40.328,39.892 h 2.761 V 32.48 c 0,-2.997 -2.071,-3.888 -4.304,-3.888 -2.235,0 -4.306,0.891 -4.306,3.888 v 7.412 h 0.652 c 1.581,0 2.109,-0.745 2.109,-2.217 v -5.122 c 0,-1.199 0.509,-1.744 1.545,-1.744 1.034,0 1.543,0.545 1.543,1.744 z M 26.705,14.134 c -1.601,0 -3.163,0.434 -4.525,1.526 l 1.146,1.907 c 0.762,-0.654 1.924,-1.29 3.252,-1.29 1.034,0 1.87,0.254 1.87,1.072 0,1.943 -5.777,1.017 -5.777,4.941 0,2.308 1.981,3.397 4.142,3.397 1.617,0 2.96,-0.49 3.996,-1.344 l -1.017,-1.908 c -0.854,0.671 -1.926,1.109 -2.979,1.109 -0.908,0 -1.418,-0.347 -1.418,-0.946 0,-1.925 5.778,-1.018 5.778,-4.959 0,-2.198 -1.907,-3.505 -4.468,-3.505 M 14.733,9.211 V 0 h 1.471 V 11.045 H 14.188 L 11.009,3.741 7.831,11.045 H 5.813 V 0 H 7.284 V 9.211 H 7.322 C 7.466,8.666 7.757,7.793 8.265,6.632 l 2.307,-5.177 h 0.872 l 2.307,5.177 c 0.527,1.161 0.8,2.034 0.945,2.579 z m 52.662,11.517 2.053,4.705 h 3.089 l -3.762,-7.375 v -3.669 h -2.797 v 3.669 l -3.762,7.375 h 3.089 l 2.053,-4.705 z M 34.713,14.389 v 8.808 h -2.778 v 2.236 h 8.503 v -0.529 c 0,-1.197 -0.473,-1.707 -1.981,-1.707 h -0.909 v -8.808 z m -6.755,14.458 v 8.811 H 25.36 v 2.234 h 8.066 v -0.527 c 0,-1.198 -0.473,-1.707 -1.981,-1.707 h -0.726 v -8.811 z m 37.437,0 v 11.045 h 2.762 v -8.81 H 72.1 V 28.847 Z M 55.623,9.863 c 0,0.82 0.346,1.182 1.163,1.182 h 0.308 v -7.32 c 0,-2.924 -2.178,-3.978 -4.141,-3.978 -1.961,0 -4.141,1.054 -4.141,3.978 v 7.32 h 1.471 V 3.797 c 0,-2.053 1.289,-2.761 2.67,-2.761 1.38,0 2.67,0.708 2.67,2.761 z m -35.277,0 c 0,0.82 -0.345,1.182 -1.163,1.182 h -0.308 v -7.32 c 0,-2.924 2.18,-3.978 4.141,-3.978 1.962,0 4.142,1.054 4.142,3.978 v 7.32 H 25.687 V 3.797 c 0,-2.053 -1.29,-2.761 -2.671,-2.761 -1.38,0 -2.67,0.708 -2.67,2.761 z m 9.138,-1.634 c 0,-3.852 6.031,-2.543 6.031,-5.359 0,-1.235 -1.036,-1.89 -2.652,-1.89 -1.327,0 -2.4,0.509 -3.217,1.364 L 28.793,1.271 c 1.035,-0.998 2.38,-1.524 4.105,-1.524 2.289,0 4.233,1.016 4.233,3.232 0,3.869 -6.157,2.782 -6.157,5.359 0,1.053 0.836,1.727 2.178,1.727 1.218,0 2.272,-0.473 3.016,-1.253 l 0.909,0.908 c -0.981,1.016 -2.254,1.578 -3.905,1.578 -2.381,0 -3.688,-1.272 -3.688,-3.069 M 41.056,5.231 h 4.648 V 6.43 h -4.648 v 3.417 h 4.248 c 0.854,0 1.182,0.344 1.182,0.999 v 0.199 H 39.582 V 0 h 7.157 V 1.199 H 41.056 Z M 17.675,25.433 H 20.51 V 14.389 h -2.835 z m 30.391,-5.524 c 0,-2.342 -0.509,-3.542 -2.144,-3.542 -1.635,0 -2.143,1.2 -2.143,3.542 0,2.345 0.508,3.543 2.143,3.543 1.635,0 2.144,-1.198 2.144,-3.543 m 7.685,3.381 v -2.636 h 1.56 c 1.165,0 1.508,0.672 1.508,1.364 0,0.69 -0.418,1.272 -1.542,1.272 z m -7.829,14.458 v -2.634 h 1.453 c 1.162,0 1.506,0.673 1.506,1.362 0,0.691 -0.416,1.272 -1.543,1.272 z M 20.8,37.803 19.746,32.935 h 2.29 l -1.2,4.868 z m 38.365,0 -1.106,-4.868 h 2.286 l -1.143,4.868 z M 68.701,9.211 V 0 h 1.473 v 11.045 h -2.017 l -3.178,-7.304 -3.18,7.304 H 59.783 V 0 h 1.472 v 9.211 h 0.037 c 0.143,-0.545 0.435,-1.418 0.943,-2.579 l 2.307,-5.177 h 0.872 l 2.308,5.177 c 0.527,1.161 0.799,2.034 0.944,2.579 h 0.035"
          style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
          id="path3850"
-         inkscape:connector-curvature="0" /></g></g></svg>
\ No newline at end of file
+         inkscape:connector-curvature="0" /></g></g></svg>
diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml
new file mode 100644
index 0000000..8b17261
--- /dev/null
+++ b/.github/workflows/bump.yml
@@ -0,0 +1,31 @@
+name: Bump version
+
+on:
+  push:
+    branches:
+      - main
+
+jobs:
+  bump-version:
+    if: "!startsWith(github.event.head_commit.message, 'bump:')"
+    runs-on: ubuntu-latest
+    name: "Bump version and create changelog"
+    steps:
+      - name: Check out
+        uses: actions/checkout@v3
+        with:
+          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+          fetch-depth: 0
+      - name: Create bump and changelog
+        uses: commitizen-tools/commitizen-action@master
+        with:
+          github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+          changelog_increment_filename: CURRENT.md
+          extra_requirements: "cz-nhm"
+      - name: Release
+        uses: softprops/action-gh-release@v1
+        with:
+          body_path: "CURRENT.md"
+          tag_name: v${{ env.REVISION }}
+        env:
+          GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5ca44ae..ec0870e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -6,20 +6,16 @@ on:
 
 jobs:
   test:
-    runs-on: ubuntu-18.04
+    runs-on: ubuntu-latest
 
     steps:
       - name: Checkout source code
-        uses: actions/checkout@v2
+        uses: actions/checkout@v3
 
       - name: Build images
         run: docker-compose build
 
       - name: Run tests
-        run: docker-compose run ckan
-
-      - name: Run coveralls
         env:
-          COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        run: docker-compose run -e COVERALLS_REPO_TOKEN ckan coveralls --service=github
-
+          COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
+        run: docker-compose run -e COVERALLS_REPO_TOKEN ckan bash /opt/scripts/run-tests.sh -c ckanext.doi
diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml
new file mode 100644
index 0000000..6866a49
--- /dev/null
+++ b/.github/workflows/pypi-publish.yml
@@ -0,0 +1,35 @@
+name: Upload Python Package
+
+on:
+  push:
+    tags:
+      - "*"
+
+permissions:
+  contents: read
+
+jobs:
+  deploy:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out
+        uses: actions/checkout@v3
+        with:
+          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+          fetch-depth: 0
+      - name: Set up Python
+        uses: actions/setup-python@v3
+        with:
+          python-version: '3.x'
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install build
+      - name: Build package
+        run: python -m build
+      - name: Publish package
+        uses: pypa/gh-action-pypi-publish@release/v1
+        with:
+          user: __token__
+          password: ${{ secrets.PYPI_API_TOKEN }}
+          skip_existing: true
diff --git a/.gitignore b/.gitignore
index d2342e8..f0abdeb 100755
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,9 @@
-__pycache__/
-*.py[cod]
-*$py.class
-*.egg-info/
-pip-log.txt
-pip-delete-this-directory.txt
-htmlcov/
+*.egg-info
+*.pyc
+.noseids
+.pytest_cache
 .coverage
-.pytest_cache/
+build/
+dist/
 .idea
+**/node_modules/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..ad689f8
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,27 @@
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.3.0
+    hooks:
+      - id: check-merge-conflict
+      - id: detect-private-key
+      - id: end-of-file-fixer
+      - id: name-tests-test
+        args: ["--pytest-test-first"]
+        exclude: ^tests/helpers/
+      - id: trailing-whitespace
+  - repo: https://github.com/commitizen-tools/commitizen
+    rev: v2.37.0
+    hooks:
+      - id: commitizen
+        additional_dependencies: ["cz-nhm"]
+  - repo: https://github.com/psf/black
+    rev: 22.10.0
+    hooks:
+      - id: black
+  - repo: https://github.com/PyCQA/docformatter
+    rev: v1.5.0
+    hooks:
+      - id: docformatter
+        # these can't be pulled directly from the config atm, not sure why
+        args: ["-i", "--wrap-summaries=88", "--wrap-descriptions=88",
+               "--pre-summary-newline", "--make-summary-multi-line"]
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644
index 0000000..c5cc704
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,8 @@
+version: 2
+
+python:
+  install:
+    - requirements: docs/requirements.txt
+
+mkdocs:
+  configuration: mkdocs.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a36c8fd..825c32f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,53 +1,1 @@
 # Changelog
-
-(This file may not be historically complete, as it is a recent addition to the project).
-
-## Roadmap
-
-Features planned for development.
-
-1. DOI versioning - allow option to create a new DOI on update (or if core metadata fields are updated).  This new DOI will be linked to the master/original DOI.
-
-2. Embargoed for set length of time. User can select date on which the dataset is to be made public, and the DOI submitted to DataCite.
-
-3. Tests. There are no tests.
-
-## [2.0.0-alpha] - 2020-11-12
-
-- Refactored to organise the code better and align with similar extensions like [`ckanext-query-dois`](https://github.com/NaturalHistoryMuseum/ckanext-query-dois)
-- Now uses [datacite](https://github.com/inveniosoftware/datacite) Python library
-- Uses Datacite [schema 4.2](https://schema.datacite.org/meta/kernel-4.2)
-- Breaking `IDoi` interface changes:
-    - `build_metadata` changed to `build_metadata_dict`
-    - `build_metadata_dict` has additional `errors` parameter and return value (a dict of metadata keys and any errors encountered while attempting to retrieve a value)
-    - `metadata_to_xml` changed to `build_xml_dict` (because it wasn't actually creating any xml)
-    - `build_xml_dict` parameters rearranged (to better match `build_metadata_dict`)
-    - the dict used is now the `package_show` dict instead of the `package_update` dict because it has more information
-- Changes in metadata are checked directly against the xml stored in Datacite
-- New command for updating datacite metadata without updating the package: `update-doi`
-
-
-## [1.0.0-alpha] - 2019-07-23
-
-- Updated to work with CKAN 2.9.0a, e.g.:
-    - uses toolkit wherever possible
-    - references to Pylons removed
-- Standardised README, CHANGELOG, setup.py and .github files to match other Museum extensions
-
-
-## 0.2
-
-- A DOI will be created regardless of Dataset status.
-  - Only when a dataset is active and public will the DOI and MetaData be published to DataCite.
-- Removed locking of DOI metadata fields after 10 days.  This is an interim solution before implementing DOI versioning.
-- Added build_metadata interface (and moved custom NHM metadata fields to ckanext-nhm).
-- Added schema migration command.r
-
-### Upgrade notes
-
-Requires a schema change 001 & 002 - adds DOI published date and removes DOI created columns. See ckanext.doi.migration
-
-
-## 0.1
-
-- Initial release
diff --git a/LICENCE b/LICENCE
deleted file mode 100644
index 3db8cec..0000000
--- a/LICENCE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Philippe Duchesne
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.
diff --git a/README.md b/README.md
index f715092..ceceb21 100644
--- a/README.md
+++ b/README.md
@@ -1,18 +1,24 @@
+<!--header-start-->
 <img src=".github/nhm-logo.svg" align="left" width="150px" height="100px" hspace="40"/>
 
 # ckanext-doi
 
-[![Tests](https://github.com/NaturalHistoryMuseum/ckanext-doi/actions/workflows/main.yml/badge.svg)](https://github.com/NaturalHistoryMuseum/ckanext-doi/actions/workflows/main.yml)
-[![Coveralls](https://img.shields.io/coveralls/github/NaturalHistoryMuseum/ckanext-doi/master.svg?style=flat-square)](https://coveralls.io/github/NaturalHistoryMuseum/ckanext-doi)
+[![Tests](https://img.shields.io/github/workflow/status/NaturalHistoryMuseum/ckanext-doi/Tests?style=flat-square)](https://github.com/NaturalHistoryMuseum/ckanext-doi/actions/workflows/main.yml)
+[![Coveralls](https://img.shields.io/coveralls/github/NaturalHistoryMuseum/ckanext-doi/main?style=flat-square)](https://coveralls.io/github/NaturalHistoryMuseum/ckanext-doi)
 [![CKAN](https://img.shields.io/badge/ckan-2.9.1-orange.svg?style=flat-square)](https://github.com/ckan/ckan)
 [![Python](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8-blue.svg?style=flat-square)](https://www.python.org/)
+[![Docs](https://img.shields.io/readthedocs/ckanext-doi?style=flat-square)](https://ckanext-doi.readthedocs.io)
 
-_A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service._
+_A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite
+DOI service._
 
+<!--header-end-->
 
 # Overview
 
-This extension assigns a digital object identifier (DOI) to datasets, using the DataCite DOI service.
+<!--overview-start-->
+This extension assigns a digital object identifier (DOI) to datasets, using the DataCite DOI
+service.
 
 When a new dataset is created it is assigned a new DOI. This DOI will be in the format:
 
@@ -20,15 +26,18 @@ When a new dataset is created it is assigned a new DOI. This DOI will be in the
 
 If the new dataset is active and public, the DOI and metadata will be registered with DataCite.
 
-If the dataset is draft or private, the DOI will not be registered with DataCite.  When the dataset is made active & public, the DOI will be submitted.
+If the dataset is draft or private, the DOI will not be registered with DataCite. When the dataset
+is made active & public, the DOI will be submitted.
 This allows datasets to be embargoed, but still provides a DOI to be referenced in publications.
 
 You will need an account with a DataCite DOI service provider to use this extension.
 
 ## DOI Metadata
+
 Uses [DataCite Metadata Schema v4.2](https://schema.datacite.org/meta/kernel-4.2/index.html).
 
-Dataset package fields and CKAN config settings are mapped to the DataCite Schema with default values, but these can be overwritten by implementing `IDoi` interface methods.
+Dataset package fields and CKAN config settings are mapped to the DataCite Schema with default
+values, but these can be overwritten by implementing `IDoi` interface methods.
 
 ### Required fields
 
@@ -42,9 +51,13 @@ Dataset package fields and CKAN config settings are mapped to the DataCite Schem
 
 See [`metadata.py`](./ckanext/doi/lib/metadata.py) for full mapping details.
 
+<!--overview-end-->
+
 # Installation
 
+<!--installation-start-->
 Path variables used below:
+
 - `$INSTALL_FOLDER` (i.e. where CKAN is installed), e.g. `/usr/lib/ckan/default`
 - `$CONFIG_FILE`, e.g. `/etc/ckan/default/development.ini`
 
@@ -87,10 +100,16 @@ Path variables used below:
  ckan -c $CONFIG_FILE doi initdb
  ```
 
+7. This extension will only work if you have signed up for an account
+   with [DataCite](https://datacite.org). You will need a development/test account to use this
+   plugin in test mode, and a live account to mint active DOIs.
+
+<!--installation-end-->
 
 # Configuration
 
-There are a number of options that can be specified in your .ini config file.
+<!--configuration-start-->
+These are the options that can be specified in your .ini config file.
 
 ## DateCite Credentials **[REQUIRED]**
 
@@ -104,7 +123,8 @@ ckanext.doi.prefix = DATACITE-PREFIX
 
 ## Institution Name **[REQUIRED]**
 
-You also need to provide the name of the institution publishing the DOIs (e.g. Natural History Museum).
+You also need to provide the name of the institution publishing the DOIs (e.g. Natural History
+Museum).
 
 ```ini
 ckanext.doi.publisher = PUBLISHING-INSTITUTION
@@ -125,16 +145,11 @@ Name|Description|Default
 `ckanext.doi.site_url`|Used to build the link back to the dataset|`ckan.site_url`
 `ckanext.doi.site_title`|Site title to use in the citation|
 
-
-# Further Setup
-
-This extension will only work if you have signed up for an account with [DataCite](https://datacite.org).
-
-You will need a development/test account to use this plugin in test mode, and a live account to mint active DOIs.
-
+<!--configuration-end-->
 
 # Usage
 
+<!--usage-start-->
 ## Commands
 
 ### `doi`
@@ -151,15 +166,22 @@ You will need a development/test account to use this plugin in test mode, and a
 
 ## Interfaces
 
-The `IDoi` interface allows plugins to extend the `build_metadata_dict` and `build_xml_dict` methods.
+The `IDoi` interface allows plugins to extend the `build_metadata_dict` and `build_xml_dict`
+methods.
 
 ### `build_metadata_dict(pkg_dict, metadata_dict, errors)`
+
 **Breaking changes from v1:**
+
 1. previously called `build_metadata`
 2. new parameter: `errors`
 3. new return value: tuple of `metadata_dict`, `errors`
 
-Extracts metadata from a pkg_dict for use in generating datacite DOIs. The base method from this extension is run first, then the metadata dict is passed through all the implementations of this method. After running these, if any of the required values (see above) are still in the `errors` dict (i.e. they still could not be handled by any other extension), a `DOIMetadataException` will be thrown.
+Extracts metadata from a pkg_dict for use in generating datacite DOIs. The base method from this
+extension is run first, then the metadata dict is passed through all the implementations of this
+method. After running these, if any of the required values (see above) are still in the `errors`
+dict (i.e. they still could not be handled by any other extension), a `DOIMetadataException` will be
+thrown.
 
 Parameter|Description
 ---------|-----------
@@ -167,44 +189,48 @@ Parameter|Description
 `metadata_dict`|The current metadata dict, created by the ckanext-doi extension and any previous plugins implementing IDoi.
 `errors`|A dictionary of metadata keys and errors generated by previous plugins; this method should remove any keys that it successfully processes and overwrites.
 
-
 ### `build_xml_dict(metadata_dict, xml_dict)`
+
 **Breaking changes from v1:**
+
 1. previously called `metadata_to_xml`
 2. parameters rearranged (previously `xml_dict`, `metadata`)
 
-Converts the metadata_dict into an xml_dict that can be passed to the datacite library's schema42.tostring() and schema42.validate() methods. The base method from this extension is run first, then the xml dict is passed through all the implementations of this method.
+Converts the metadata_dict into an xml_dict that can be passed to the datacite library's
+schema42.tostring() and schema42.validate() methods. The base method from this extension is run
+first, then the xml dict is passed through all the implementations of this method.
 
 Parameter|Description
 ---------|-----------
 `metadata_dict`|The original metadata dictionary from which the xml attributes are extracted.
 `xml_dict`|The current xml dict, created by the ckanext-doi extension and any previous plugins implementing IDoi.
 
-
 ## Templates
 
 ### Package citation snippet
+
 ```html+jinja
 {% snippet "doi/snippets/package_citation.html", pkg_dict=g.pkg_dict %}
 ```
 
 ### Resource citation snippet
+
 ```html+jinja
 {% snippet "doi/snippets/resource_citation.html", pkg_dict=g.pkg_dict, res=res %}
 ```
 
+<!--usage-end-->
 
 # Testing
-_Test coverage is currently extremely limited._
 
-To run the tests in this extension, there is a Docker compose configuration available in this
-repository to make it easy.
+<!--testing-start-->
+There is a Docker compose configuration available in this repository to make it easier to run tests.
 
 To run the tests against ckan 2.9.x on Python3:
 
 1. Build the required images
+
 ```bash
-# first build the containers
 docker-compose build
 ```
 
@@ -212,11 +238,13 @@ docker-compose build
    The root of the repository is mounted into the ckan container as a volume by the Docker compose
    configuration, so you should only need to rebuild the ckan image if you change the extension's
    dependencies.
+
 ```bash
 docker-compose run ckan
 ```
 
-The ckan image uses the Dockerfile in the `docker/` folder which is based on `openknowledge/ckan-dev:2.9`.
-
+The ckan image uses the Dockerfile in the `docker/` folder.
 Note that currently the tests mock the Datacite API and therefore don't require an internet
 connection nor your Datacite credentials to run.
+
+<!--testing-end-->
diff --git a/ckanext/__init__.py b/ckanext/__init__.py
index 847e407..1ee7831 100644
--- a/ckanext/__init__.py
+++ b/ckanext/__init__.py
@@ -6,7 +6,9 @@
 
 try:
     import pkg_resources
+
     pkg_resources.declare_namespace(__name__)
 except ImportError:
     import pkgutil
+
     __path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/ckanext/doi/__init__.py b/ckanext/doi/__init__.py
index 847e407..1ee7831 100644
--- a/ckanext/doi/__init__.py
+++ b/ckanext/doi/__init__.py
@@ -6,7 +6,9 @@
 
 try:
     import pkg_resources
+
     pkg_resources.declare_namespace(__name__)
 except ImportError:
     import pkgutil
+
     __path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/ckanext/doi/cli.py b/ckanext/doi/cli.py
index 6cd5e07..f3a8c48 100644
--- a/ckanext/doi/cli.py
+++ b/ckanext/doi/cli.py
@@ -23,7 +23,9 @@ def doi():
 @doi.command(name='initdb')
 def init_db():
     if not model.package_table.exists():
-        click.secho('Package table must exist before initialising the DOI table', fg='red')
+        click.secho(
+            'Package table must exist before initialising the DOI table', fg='red'
+        )
         raise click.Abort()
 
     if doi_model.doi_table.exists():
@@ -35,11 +37,12 @@ def init_db():
 
 @doi.command(name='delete-dois')
 def delete_dois():
-    '''
+    """
     Delete all DOIs from the database.
-    '''
+    """
     to_delete = Session.query(DOI).filter(
-        DOI.identifier.like(f'%{DataciteClient.get_prefix()}%'))
+        DOI.identifier.like(f'%{DataciteClient.get_prefix()}%')
+    )
     doi_count = to_delete.count()
     if doi_count == 0:
         click.secho('Nothing to delete', fg='green')
@@ -51,11 +54,13 @@ def delete_dois():
 
 
 @doi.command(name='update-doi')
-@click.option('-p', '--package_id', 'package_ids', multiple=True, help='Package id(s) to update')
+@click.option(
+    '-p', '--package_id', 'package_ids', multiple=True, help='Package id(s) to update'
+)
 def update_doi(package_ids):
-    '''
+    """
     Update either all DOIs in the system or the ones associated with the given packages.
-    '''
+    """
     if not package_ids:
         dois_to_update = Session.query(DOI).all()
     else:
@@ -66,15 +71,17 @@ def update_doi(package_ids):
         return
 
     for record in dois_to_update:
-        pkg_dict = toolkit.get_action('package_show')({}, {
-            'id': record.package_id
-        })
+        pkg_dict = toolkit.get_action('package_show')({}, {'id': record.package_id})
         title = pkg_dict.get('title', record.package_id)
 
         if record.published is None:
-            click.secho(f'"{title}" does not have a published DOI; ignoring', fg='yellow')
+            click.secho(
+                f'"{title}" does not have a published DOI; ignoring', fg='yellow'
+            )
             continue
-        if pkg_dict.get('state', 'active') != 'active' or pkg_dict.get('private', False):
+        if pkg_dict.get('state', 'active') != 'active' or pkg_dict.get(
+            'private', False
+        ):
             click.secho(f'"{title}" is inactive or private; ignoring', fg='yellow')
             continue
 
@@ -89,7 +96,9 @@ def update_doi(package_ids):
                 client.set_metadata(record.identifier, xml_dict)
                 click.secho(f'Updated "{title}"', fg='green')
             except DataCiteError as e:
-                click.secho(f'Error while updating "{title}" (DOI {record.identifier}): {e})',
-                            fg='red')
+                click.secho(
+                    f'Error while updating "{title}" (DOI {record.identifier}): {e})',
+                    fg='red',
+                )
         else:
             click.secho(f'"{title}" is already up to date', fg='green')
diff --git a/ckanext/doi/interfaces.py b/ckanext/doi/interfaces.py
index df48574..cde632c 100644
--- a/ckanext/doi/interfaces.py
+++ b/ckanext/doi/interfaces.py
@@ -8,11 +8,14 @@
 
 
 class IDoi(interfaces.Interface):
-    '''Hook into IDoi'''
+    """
+    Hook into IDoi.
+    """
 
     def build_metadata_dict(self, pkg_dict, metadata_dict, errors):
-        '''Extracts metadata from a pkg_dict for use in generating datacite DOIs. Extends the
-        build_metadata_dict method from ckanext-doi.
+        """
+        Extracts metadata from a pkg_dict for use in generating datacite DOIs. Extends
+        the build_metadata_dict method from ckanext-doi.
 
         :param pkg_dict: package dictionary
         :param metadata_dict: the current metadata dict, created by the ckanext-doi extension and
@@ -21,16 +24,17 @@ def build_metadata_dict(self, pkg_dict, metadata_dict, errors):
                        this method should remove any keys that it successfully processes and
                        overwrites
         :returns: metadata_dict, errors
-        '''
+        """
         return metadata_dict, errors
 
     def build_xml_dict(self, metadata_dict, xml_dict):
-        '''Converts the metadata_dict into an xml_dict that can be passed to the datacite
+        """
+        Converts the metadata_dict into an xml_dict that can be passed to the datacite
         library's schema42.tostring() and schema42.validate() methods. Extends the
         build_xml_dict() method from ckanext-doi.
 
         :param metadata_dict: the metadata dict generated from build_metadata_dict
         :param xml_dict: XML dict to pass to schema42.validate()
         :returns: xml_dict
-        '''
+        """
         return xml_dict
diff --git a/ckanext/doi/lib/api.py b/ckanext/doi/lib/api.py
index b8ebb1a..c452b00 100644
--- a/ckanext/doi/lib/api.py
+++ b/ckanext/doi/lib/api.py
@@ -33,7 +33,7 @@ def __init__(self):
             'username': self.username,
             'password': self.password,
             'prefix': self.prefix,
-            'test_mode': self.test_mode
+            'test_mode': self.test_mode,
         }
         if self.test_mode:
             # temporary fix because datacite 1.0.1 isn't updated for the test prefix deprecation
@@ -42,33 +42,42 @@ def __init__(self):
 
     @property
     def test_mode(self):
-        '''Whether to run in test mode. Defaults to true.
+        """
+        Whether to run in test mode.
+
+        Defaults to true.
         :return: test mode enabled as boolean (true=enabled)
-        '''
+        """
         if self._test_mode is None:
             self._test_mode = asbool(toolkit.config.get('ckanext.doi.test_mode', True))
         return self._test_mode
 
     @classmethod
     def get_prefix(cls):
-        '''Get the prefix to use for DOIs.
+        """
+        Get the prefix to use for DOIs.
+
         :return: config prefix setting
-        '''
+        """
         prefix = toolkit.config.get('ckanext.doi.prefix')
         if prefix is None:
             raise TypeError('You must set the ckanext.doi.prefix config value')
         if prefix == DEPRECATED_TEST_PREFIX:
-            raise ValueError(f'The test prefix {DEPRECATED_TEST_PREFIX} has been retired; use a '
-                             f'prefix defined in your datacite test account')
+            raise ValueError(
+                f'The test prefix {DEPRECATED_TEST_PREFIX} has been retired; use a '
+                f'prefix defined in your datacite test account'
+            )
         return prefix
 
     def generate_doi(self):
-        '''
-        Generate a new DOI which isn't currently in use. The database is checked for previous
+        """
+        Generate a new DOI which isn't currently in use.
+
+        The database is checked for previous
         usage, as is Datacite itself. Use whatever value is retuned from this function quickly to
         avoid double use as this function uses no locking.
         :return: the full, unique DOI
-        '''
+        """
         # the list of valid characters is larger than just lowercase and the digits but we don't
         # need that many options and URLs with just alphanumeric characters in them are nicer. We
         # just use lowercase characters to avoid any issues with case being ignored
@@ -88,17 +97,20 @@ def generate_doi(self):
                 except DataCiteNotFoundError:
                     return doi
                 except DataCiteError as e:
-                    log.warning(f'Error whilst checking new DOIs with DataCite. DOI: {doi}, '
-                                f'error: {e}')
+                    log.warning(
+                        f'Error whilst checking new DOIs with DataCite. DOI: {doi}, '
+                        f'error: {e}'
+                    )
             attempts -= 1
         raise Exception('Failed to generate a DOI')
 
     def mint_doi(self, doi, package_id):
-        '''
+        """
         Mints the given DOI on datacite. Does not add metadata, just creates the DOI.
+
         :param doi: the doi (full, prefix and suffix)
         :param package_id: the id of the package this doi is for
-        '''
+        """
 
         # create the URL the DOI will point to, i.e. the package page
         site = toolkit.config.get('ckan.site_url')
@@ -115,16 +127,14 @@ def mint_doi(self, doi, package_id):
         DOIQuery.update_doi(doi, published=dt.now())
 
     def set_metadata(self, doi, xml_dict):
-        '''
+        """
         Update or create the metadata for a given DOI on datacite.
+
         :param doi: the DOI to update the metadata for
         :param xml_dict: the metadata as an xml dict (generated from build_xml_dict)
         :return:
-        '''
-        xml_dict['identifiers'] = [{
-            'identifierType': 'DOI',
-            'identifier': doi
-        }]
+        """
+        xml_dict['identifiers'] = [{'identifierType': 'DOI', 'identifier': doi}]
 
         # check that the data is valid, this will raise a JSON schema exception if there are issues
         schema42.validator.validate(xml_dict)
@@ -134,11 +144,12 @@ def set_metadata(self, doi, xml_dict):
         self.client.metadata_post(xml_doc)
 
     def get_metadata(self, doi):
-        '''
+        """
         Retrieve metadata for a given DOI on datacite.
+
         :param doi: the DOI for which to retrieve the stored metadata
         :return:
-        '''
+        """
         try:
             metadata = self.client.metadata_get(doi)
         except DataCiteNotFoundError:
@@ -146,12 +157,13 @@ def get_metadata(self, doi):
         return metadata
 
     def check_for_update(self, doi, xml_dict):
-        '''
+        """
         Compare generated xml_dict against the one already posted on datacite.
+
         :param doi: the DOI of the package
         :param xml_dict: the xml_dict generated by build_xml_dict
         :return: True if the two are the same, False if not
-        '''
+        """
         posted_xml = self.get_metadata(doi)
         if posted_xml is None or posted_xml.strip() == '':
             return False
@@ -161,10 +173,14 @@ def check_for_update(self, doi, xml_dict):
             del posted_xml_dict['identifier']
         has_dates = 'dates' in posted_xml_dict and 'date' in posted_xml_dict['dates']
         if has_dates:
-            posted_xml_dict['dates']['date'] = [d for d in posted_xml_dict['dates']['date']
-                                                if d['@dateType'] != 'Updated']
-            new_xml_dict['dates']['date'] = [d for d in new_xml_dict['dates']['date']
-                                             if d['@dateType'] != 'Updated']
+            posted_xml_dict['dates']['date'] = [
+                d
+                for d in posted_xml_dict['dates']['date']
+                if d['@dateType'] != 'Updated'
+            ]
+            new_xml_dict['dates']['date'] = [
+                d for d in new_xml_dict['dates']['date'] if d['@dateType'] != 'Updated'
+            ]
             return posted_xml_dict == new_xml_dict
         else:
             # if the original doesn't have any dates, it's definitely different
diff --git a/ckanext/doi/lib/errors.py b/ckanext/doi/lib/errors.py
index 43c86c0..31d95b1 100644
--- a/ckanext/doi/lib/errors.py
+++ b/ckanext/doi/lib/errors.py
@@ -6,5 +6,4 @@
 
 
 class DOIMetadataException(Exception):
-    ''' '''
     pass
diff --git a/ckanext/doi/lib/helpers.py b/ckanext/doi/lib/helpers.py
index 70490c3..22bdaec 100644
--- a/ckanext/doi/lib/helpers.py
+++ b/ckanext/doi/lib/helpers.py
@@ -11,11 +11,11 @@
 
 
 def package_get_year(pkg_dict):
-    '''
-    Helper function to return the package year published
+    """
+    Helper function to return the package year published.
 
     :param pkg_dict: return:
-    '''
+    """
     if not isinstance(pkg_dict['metadata_created'], datetime):
         pkg_dict['metadata_created'] = parser.parse(pkg_dict['metadata_created'])
 
@@ -23,30 +23,33 @@ def package_get_year(pkg_dict):
 
 
 def get_site_title():
-    '''
-    Helper function to return the config site title, if it exists
+    """
+    Helper function to return the config site title, if it exists.
 
     :returns: str site title
-    '''
+    """
     return toolkit.config.get('ckanext.doi.site_title')
 
 
 def get_site_url():
-    '''
-    Get the site URL. Try and use ckanext.doi.site_url but if that's not set use ckan.site_url.
-    '''
-    site_url = toolkit.config.get('ckanext.doi.site_url',
-                                  toolkit.config.get('ckan.site_url', ''))
+    """
+    Get the site URL.
+
+    Try and use ckanext.doi.site_url but if that's not set use ckan.site_url.
+    """
+    site_url = toolkit.config.get(
+        'ckanext.doi.site_url', toolkit.config.get('ckan.site_url', '')
+    )
     return site_url.rstrip('/')
 
 
 def date_or_none(date_object_or_string):
-    '''
+    """
     Try and convert the given object into a datetime; if not possible, return None.
 
     :param date_object_or_string: a datetime or date string
     :return: datetime or None
-    '''
+    """
     if isinstance(date_object_or_string, datetime):
         return date_object_or_string
     elif isinstance(date_object_or_string, str):
diff --git a/ckanext/doi/lib/metadata.py b/ckanext/doi/lib/metadata.py
index 38deced..4d9b2dd 100644
--- a/ckanext/doi/lib/metadata.py
+++ b/ckanext/doi/lib/metadata.py
@@ -19,10 +19,11 @@
 
 
 def build_metadata_dict(pkg_dict):
-    '''
+    """
     Build/extract a basic dict of metadata that can then be passed to build_xml_dict.
+
     :param pkg_dict: dict of package details
-    '''
+    """
     metadata_dict = {}
 
     # collect errors instead of throwing them immediately; some data may not be correctly handled
@@ -35,7 +36,7 @@ def build_metadata_dict(pkg_dict):
         'titles': [],
         'publisher': None,
         'publicationYear': None,
-        'resourceType': None
+        'resourceType': None,
     }
 
     def _add_required(key, get_func):
@@ -45,14 +46,10 @@ def _add_required(key, get_func):
             errors[key] = e
 
     # CREATORS
-    _add_required('creators', lambda: [{
-        'full_name': pkg_dict.get('author')
-    }])
+    _add_required('creators', lambda: [{'full_name': pkg_dict.get('author')}])
 
     # TITLES
-    _add_required('titles', lambda: [{
-        'title': pkg_dict.get('title')
-    }])
+    _add_required('titles', lambda: [{'title': pkg_dict.get('title')}])
 
     # PUBLISHER
     _add_required('publisher', lambda: toolkit.config.get('ckanext.doi.publisher'))
@@ -77,15 +74,20 @@ def _add_required(key, get_func):
         'rightsList': [],
         'descriptions': [],
         'geolocations': [],
-        'fundingReferences': []
+        'fundingReferences': [],
     }
 
     # SUBJECTS
     # use the tag list
     try:
         tags = pkg_dict.get('tag_string', '').split(',')
-        tags += [tag['name'] if isinstance(tag, dict) else tag for tag in pkg_dict.get('tags', [])]
-        optional['subjects'] = [{'subject': tag} for tag in sorted({t for t in tags if t != ''})]
+        tags += [
+            tag['name'] if isinstance(tag, dict) else tag
+            for tag in pkg_dict.get('tags', [])
+        ]
+        optional['subjects'] = [
+            {'subject': tag} for tag in sorted({t for t in tags if t != ''})
+        ]
     except Exception as e:
         errors['subjects'] = e
 
@@ -97,39 +99,42 @@ def _add_required(key, get_func):
     maintainer = pkg_dict.get('maintainer')
     if author is not None:
         optional['contributors'].append(
-            {
-                'contributor_type': 'Researcher',
-                'full_name': author
-            })
+            {'contributor_type': 'Researcher', 'full_name': author}
+        )
     if maintainer is not None:
-        optional['contributors'].append({
-            'contributor_type': 'DataManager',
-            'full_name': maintainer
-        })
+        optional['contributors'].append(
+            {'contributor_type': 'DataManager', 'full_name': maintainer}
+        )
 
     # DATES
     # created, updated, and doi publish date
     date_errors = {}
     try:
-        optional['dates'].append({
-            'dateType': 'Created',
-            'date': date_or_none(pkg_dict.get('metadata_created'))
-        })
+        optional['dates'].append(
+            {
+                'dateType': 'Created',
+                'date': date_or_none(pkg_dict.get('metadata_created')),
+            }
+        )
     except Exception as e:
         date_errors['created'] = e
     try:
-        optional['dates'].append({
-            'dateType': 'Updated',
-            'date': date_or_none(pkg_dict.get('metadata_modified'))
-        })
+        optional['dates'].append(
+            {
+                'dateType': 'Updated',
+                'date': date_or_none(pkg_dict.get('metadata_modified')),
+            }
+        )
     except Exception as e:
         date_errors['updated'] = e
     if 'doi_date_published' in pkg_dict:
         try:
-            optional['dates'].append({
-                'dateType': 'Issued',
-                'date': date_or_none(pkg_dict.get('doi_date_published'))
-            })
+            optional['dates'].append(
+                {
+                    'dateType': 'Issued',
+                    'date': date_or_none(pkg_dict.get('doi_date_published')),
+                }
+            )
         except Exception as e:
             date_errors['doi_date_published'] = e
 
@@ -144,10 +149,9 @@ def _add_required(key, get_func):
     # add permalink back to this site
     try:
         permalink = f'{get_site_url()}/dataset/{pkg_dict["id"]}'
-        optional['alternateIdentifiers'] = [{
-            'alternateIdentifierType': 'URL',
-            'alternateIdentifier': permalink
-        }]
+        optional['alternateIdentifiers'] = [
+            {'alternateIdentifierType': 'URL', 'alternateIdentifier': permalink}
+        ]
     except Exception as e:
         errors['alternateIdentifiers'] = e
 
@@ -157,7 +161,9 @@ def _add_required(key, get_func):
     # SIZES
     # sum up given sizes from resources in the package and convert from bytes to kilobytes
     try:
-        resource_sizes = [r.get('size') or 0 for r in pkg_dict.get('resources', []) or []]
+        resource_sizes = [
+            r.get('size') or 0 for r in pkg_dict.get('resources', []) or []
+        ]
         total_size = [f'{int(sum(resource_sizes) / 1024)} kb']
         optional['sizes'] = total_size
     except Exception as e:
@@ -167,7 +173,12 @@ def _add_required(key, get_func):
     # list unique formats from package resources
     try:
         formats = list(
-            set(filter(None, [r.get('format') for r in pkg_dict.get('resources', []) or []])))
+            set(
+                filter(
+                    None, [r.get('format') for r in pkg_dict.get('resources', []) or []]
+                )
+            )
+        )
         optional['formats'] = formats
     except Exception as e:
         errors['formats'] = e
@@ -185,10 +196,7 @@ def _add_required(key, get_func):
             license = license_register.get(license_id)
             if license is not None:
                 optional['rightsList'] = [
-                    {
-                        'url': license.url,
-                        'identifier': license.id
-                    }
+                    {'url': license.url, 'identifier': license.id}
                 ]
     except Exception as e:
         errors['rightsList'] = e
@@ -196,10 +204,7 @@ def _add_required(key, get_func):
     # DESCRIPTIONS
     # use package notes
     optional['descriptions'] = [
-        {
-            'descriptionType': 'Other',
-            'description': pkg_dict.get('notes', '')
-        }
+        {'descriptionType': 'Other', 'description': pkg_dict.get('notes', '')}
     ]
 
     # GEOLOCATIONS
@@ -214,7 +219,9 @@ def _add_required(key, get_func):
     for plugin in PluginImplementations(IDoi):
         # implementations should remove relevant errors from the errors dict if they successfully
         # handle an item
-        metadata_dict, errors = plugin.build_metadata_dict(pkg_dict, metadata_dict, errors)
+        metadata_dict, errors = plugin.build_metadata_dict(
+            pkg_dict, metadata_dict, errors
+        )
 
     for k in required:
         if metadata_dict.get(k) is None and errors.get(k) is None:
@@ -222,8 +229,10 @@ def _add_required(key, get_func):
 
     required_errors = {k: e for k, e in errors.items() if k in required}
     if len(required_errors) > 0:
-        error_msg = f'Could not extract metadata for the following required keys: ' \
-                    f'{", ".join(required_errors)}'
+        error_msg = (
+            f'Could not extract metadata for the following required keys: '
+            f'{", ".join(required_errors)}'
+        )
         log.exception(error_msg)
         for k, e in required_errors.items():
             log.exception(f'{k}: {e}')
@@ -231,8 +240,10 @@ def _add_required(key, get_func):
 
     optional_errors = {k: e for k, e in errors.items() if k in optional}
     if len(required_errors) > 0:
-        error_msg = f'Could not extract metadata for the following optional keys: ' \
-                    f'{", ".join(optional_errors)}'
+        error_msg = (
+            f'Could not extract metadata for the following optional keys: '
+            f'{", ".join(optional_errors)}'
+        )
         log.debug(error_msg)
         for k, e in optional_errors.items():
             log.debug(f'{k}: {e}')
@@ -241,13 +252,15 @@ def _add_required(key, get_func):
 
 
 def build_xml_dict(metadata_dict):
-    '''
-    Builds a dictionary that can be passed directly to datacite.schema42.tostring() to generate xml.
-    Previously named metadata_to_xml but renamed as it's not actually producing any xml,
-    it's just formatting the metadata so a separate function can then generate the xml.
+    """
+    Builds a dictionary that can be passed directly to datacite.schema42.tostring() to
+    generate xml. Previously named metadata_to_xml but renamed as it's not actually
+    producing any xml, it's just formatting the metadata so a separate function can then
+    generate the xml.
+
     :param metadata_dict: a dict of metadata generated from build_metadata_dict
     :return: dict that can be passed directly to datacite.schema42.tostring()
-    '''
+    """
 
     # required fields first (DOI will be added later)
     xml_dict = {
@@ -257,7 +270,7 @@ def build_xml_dict(metadata_dict):
         'publicationYear': str(metadata_dict.get('publicationYear')),
         'types': {
             'resourceType': metadata_dict.get('resourceType'),
-            'resourceTypeGeneral': 'Dataset'
+            'resourceTypeGeneral': 'Dataset',
         },
         'schemaVersion': 'http://datacite.org/schema/kernel-4',
     }
@@ -278,7 +291,7 @@ def build_xml_dict(metadata_dict):
         'rightsList',
         'descriptions',
         'geolocations',
-        'fundingReferences'
+        'fundingReferences',
     ]
 
     for k in optional:
@@ -292,7 +305,9 @@ def build_xml_dict(metadata_dict):
         if k == 'contributors':
             xml_dict['contributors'] = []
             for contributor in v:
-                xml_dict['contributors'].append(xml_utils.create_contributor(**contributor))
+                xml_dict['contributors'].append(
+                    xml_utils.create_contributor(**contributor)
+                )
         elif k == 'dates':
             item = []
             for date_entry in v:
diff --git a/ckanext/doi/lib/xml_utils.py b/ckanext/doi/lib/xml_utils.py
index 99c520f..9f188f8 100644
--- a/ckanext/doi/lib/xml_utils.py
+++ b/ckanext/doi/lib/xml_utils.py
@@ -5,9 +5,16 @@
 # Created by the Natural History Museum in London, UK
 
 
-def create_contributor(full_name=None, family_name=None, given_name=None, is_org=False,
-                       contributor_type=None, affiliations=None, identifiers=None):
-    '''
+def create_contributor(
+    full_name=None,
+    family_name=None,
+    given_name=None,
+    is_org=False,
+    contributor_type=None,
+    affiliations=None,
+    identifiers=None,
+):
+    """
     Create a dictionary representation of a contributing entity (either a person or an
     organisation) for use in an xml_dict.
 
@@ -21,12 +28,14 @@ def create_contributor(full_name=None, family_name=None, given_name=None, is_org
     :param affiliations: affiliations of the contributor, either a string or list of strings
     :param identifiers: a list of dicts with "identifier", "scheme", and (optionally) "scheme_uri"
     :return: a dict
-    '''
+    """
     if is_org and full_name is None:
         raise ValueError('Creator name must be supplied as full_name="Org Name"')
     if full_name is None and (family_name is None or given_name is None):
-        raise ValueError('Creator name must be supplied, either as full_name="FamilyName, '
-                         'GivenName" or separately as family_name and given_name')
+        raise ValueError(
+            'Creator name must be supplied, either as full_name="FamilyName, '
+            'GivenName" or separately as family_name and given_name'
+        )
     if full_name is None:
         full_name = f'{family_name}, {given_name}'
     if (family_name is None or given_name is None) and not is_org:
@@ -42,7 +51,7 @@ def create_contributor(full_name=None, family_name=None, given_name=None, is_org
             given_name = ' '.join(name_parts[0:-1]).strip()
     contributor = {
         'name': full_name,
-        'nameType': 'Organizational' if is_org else 'Personal'
+        'nameType': 'Organizational' if is_org else 'Personal',
     }
     if not is_org:
         contributor['familyName'] = family_name
@@ -60,8 +69,10 @@ def create_contributor(full_name=None, family_name=None, given_name=None, is_org
         for _id in identifiers:
             if 'identifier' not in _id or 'scheme' not in _id:
                 continue
-            id_dict = {'nameIdentifier': _id['identifier'],
-                       'nameIdentifierScheme': _id['scheme']}
+            id_dict = {
+                'nameIdentifier': _id['identifier'],
+                'nameIdentifierScheme': _id['scheme'],
+            }
             if 'scheme_uri' in _id:
                 id_dict['schemeUri'] = _id['scheme_uri']
             contributor['nameIdentifiers'].append(id_dict)
diff --git a/ckanext/doi/model/crud.py b/ckanext/doi/model/crud.py
index 23f5254..ef522ee 100644
--- a/ckanext/doi/model/crud.py
+++ b/ckanext/doi/model/crud.py
@@ -16,37 +16,43 @@ class DOIQuery:
 
     @classmethod
     def create(cls, identifier, package_id, published=None):
-        '''
+        """
         Create a new record in the DOI table.
+
         :param identifier: a new DOI string
         :param package_id: the id of the package this DOI represents
         :param published: when this DOI was published (datetime, nullable)
         :return: the newly created record object
-        '''
-        new_record = DOI(identifier=identifier, package_id=package_id, published=published)
+        """
+        new_record = DOI(
+            identifier=identifier, package_id=package_id, published=published
+        )
         Session.add(new_record)
         Session.commit()
         return new_record
 
     @classmethod
     def read_doi(cls, identifier):
-        '''
+        """
         Retrieve a record with a given DOI.
+
         :param identifier: the DOI string
         :return: the record object
-        '''
+        """
         return Session.query(DOI).get(identifier)
 
     @classmethod
     def read_package(cls, package_id, create_if_none=False):
-        '''
+        """
         Retrieve a record associated with a given package.
+
         :param package_id: the id of the package
         :param create_if_none: generate a new DOI and add a record if no record is found for the
                                given package
         :return: the record object
-        '''
+        """
         from ckanext.doi.lib.api import DataciteClient
+
         record = Session.query(DOI).filter(DOI.package_id == package_id).first()
         if record is None and create_if_none:
             client = DataciteClient()
@@ -56,12 +62,13 @@ def read_package(cls, package_id, create_if_none=False):
 
     @classmethod
     def update_doi(cls, identifier, **kwargs):
-        '''
+        """
         Update the package_id and/or published fields of a record with a given DOI.
+
         :param identifier: the DOI string
         :param kwargs: the values to be updated
         :return: the updated record object
-        '''
+        """
         update_dict = {k: v for k, v in kwargs.items() if k in cls.cols}
         Session.query(DOI).filter(DOI.identifier == identifier).update(update_dict)
         Session.commit()
@@ -69,12 +76,14 @@ def update_doi(cls, identifier, **kwargs):
 
     @classmethod
     def update_package(cls, package_id, **kwargs):
-        '''
-        Update the package_id and/or published fields of a record associated with a given package.
+        """
+        Update the package_id and/or published fields of a record associated with a
+        given package.
+
         :param package_id: the id of the package
         :param kwargs: the values to be updated
         :return: the updated record object
-        '''
+        """
         update_dict = {k: v for k, v in kwargs.items() if k in cls.cols}
         Session.query(DOI).filter(DOI.package_id == package_id).update(update_dict)
         Session.commit()
@@ -82,11 +91,12 @@ def update_package(cls, package_id, **kwargs):
 
     @classmethod
     def delete_doi(cls, identifier):
-        '''
+        """
         Delete the record with a given DOI.
+
         :param identifier: the DOI string
         :return: True if a record was deleted, False if not
-        '''
+        """
         to_delete = cls.read_doi(identifier)
         if to_delete is not None:
             Session.delete(to_delete)
@@ -97,11 +107,12 @@ def delete_doi(cls, identifier):
 
     @classmethod
     def delete_package(cls, package_id):
-        '''
+        """
         Delete the record associated with a given package.
+
         :param package_id: the id of the package
         :return: True if a record was deleted, False if not
-        '''
+        """
         to_delete = cls.read_package(package_id)
         if to_delete is not None:
             Session.delete(to_delete)
diff --git a/ckanext/doi/model/doi.py b/ckanext/doi/model/doi.py
index d197fef..142f8ed 100644
--- a/ckanext/doi/model/doi.py
+++ b/ckanext/doi/model/doi.py
@@ -13,23 +13,34 @@
     'doi',
     meta.metadata,
     Column('identifier', types.UnicodeText, primary_key=True),
-    Column('package_id', types.UnicodeText,
-           ForeignKey('package.id', onupdate='CASCADE', ondelete='CASCADE'),
-           nullable=False, unique=True),
+    Column(
+        'package_id',
+        types.UnicodeText,
+        ForeignKey('package.id', onupdate='CASCADE', ondelete='CASCADE'),
+        nullable=False,
+        unique=True,
+    ),
     # Date DOI was published to DataCite
     Column('published', types.DateTime, nullable=True),
 )
 
 
 class DOI(DomainObject):
-    '''DOI Object'''
+    """
+    DOI Object.
+    """
+
     pass
 
 
-meta.mapper(DOI, doi_table, properties={
-    'dataset': relation(
-        Package,
-        backref=backref('doi', cascade='all, delete-orphan'),
-        primaryjoin=doi_table.c.package_id.__eq__(Package.id)
-    )
-})
+meta.mapper(
+    DOI,
+    doi_table,
+    properties={
+        'dataset': relation(
+            Package,
+            backref=backref('doi', cascade='all, delete-orphan'),
+            primaryjoin=doi_table.c.package_id.__eq__(Package.id),
+        )
+    },
+)
diff --git a/ckanext/doi/plugin.py b/ckanext/doi/plugin.py
index fb509dd..b61c0fd 100644
--- a/ckanext/doi/plugin.py
+++ b/ckanext/doi/plugin.py
@@ -19,7 +19,10 @@
 
 
 class DOIPlugin(SingletonPlugin, toolkit.DefaultDatasetForm):
-    '''CKAN DOI Extension'''
+    """
+    CKAN DOI Extension.
+    """
+
     implements(interfaces.IConfigurer)
     implements(interfaces.IPackageController, inherit=True)
     implements(interfaces.ITemplateHelpers, inherit=True)
@@ -31,34 +34,42 @@ def get_commands(self):
 
     ## IConfigurer
     def update_config(self, config):
-        '''Adds templates.
-        '''
+        """
+        Adds templates.
+        """
         toolkit.add_template_directory(config, 'theme/templates')
 
     ## IPackageController
     def after_create(self, context, pkg_dict):
-        '''A new dataset has been created, so we need to create a new DOI.
+        """
+        A new dataset has been created, so we need to create a new DOI.
+
         NB: This is called after creation of a dataset, before resources have been
         added, so state = draft.
-        '''
+        """
         DOIQuery.read_package(pkg_dict['id'], create_if_none=True)
 
     ## IPackageController
     def after_update(self, context, pkg_dict):
-        '''Dataset has been created/updated. Check status of the dataset to determine if we should
-        publish DOI to datacite network.
-        '''
+        """
+        Dataset has been created/updated.
+
+        Check status of the dataset to determine if we should publish DOI to datacite
+        network.
+        """
         # Is this active and public? If so we need to make sure we have an active DOI
-        if pkg_dict.get('state', 'active') == 'active' and not pkg_dict.get('private', False):
+        if pkg_dict.get('state', 'active') == 'active' and not pkg_dict.get(
+            'private', False
+        ):
             package_id = pkg_dict['id']
 
             # remove user-defined update schemas first (if needed)
             context.pop('schema', None)
 
             # Load the package_show version of the dict
-            pkg_show_dict = toolkit.get_action('package_show')(context, {
-                'id': package_id
-            })
+            pkg_show_dict = toolkit.get_action('package_show')(
+                context, {'id': package_id}
+            )
 
             # Load or create the local DOI (package may not have a DOI if extension was loaded
             # after package creation)
@@ -85,15 +96,17 @@ def after_update(self, context, pkg_dict):
 
     # IPackageController
     def after_show(self, context, pkg_dict):
-        '''Add the DOI details to the pkg_dict so it can be displayed.
-        '''
+        """
+        Add the DOI details to the pkg_dict so it can be displayed.
+        """
         doi = DOIQuery.read_package(pkg_dict['id'])
         if doi:
             pkg_dict['doi'] = doi.identifier
             pkg_dict['doi_status'] = True if doi.published else False
             pkg_dict['domain'] = get_site_url().replace('http://', '')
-            pkg_dict['doi_date_published'] = datetime.strftime(doi.published, '%Y-%m-%d') if \
-                doi.published else None
+            pkg_dict['doi_date_published'] = (
+                datetime.strftime(doi.published, '%Y-%m-%d') if doi.published else None
+            )
             pkg_dict['doi_publisher'] = toolkit.config.get('ckanext.doi.publisher')
 
     # ITemplateHelpers
@@ -101,5 +114,5 @@ def get_helpers(self):
         return {
             'package_get_year': package_get_year,
             'now': datetime.now,
-            'get_site_title': get_site_title
+            'get_site_title': get_site_title,
         }
diff --git a/ckanext/doi/theme/templates/doi/snippets/package_citation.html b/ckanext/doi/theme/templates/doi/snippets/package_citation.html
index b150598..4626f47 100644
--- a/ckanext/doi/theme/templates/doi/snippets/package_citation.html
+++ b/ckanext/doi/theme/templates/doi/snippets/package_citation.html
@@ -58,4 +58,4 @@ <h3>{{ _('Cite this as') }}</h3>
     </div>
 </section>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ckanext/doi/theme/templates/doi/snippets/resource_citation.html b/ckanext/doi/theme/templates/doi/snippets/resource_citation.html
index 235f672..7939eac 100644
--- a/ckanext/doi/theme/templates/doi/snippets/resource_citation.html
+++ b/ckanext/doi/theme/templates/doi/snippets/resource_citation.html
@@ -26,4 +26,4 @@ <h3>{{ _('Cite this as') }}</h3>
             {% endblock %}
         </div>
     </section>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ckanext/doi/theme/templates/package/read.html b/ckanext/doi/theme/templates/package/read.html
index 99bac5d..47eae25 100644
--- a/ckanext/doi/theme/templates/package/read.html
+++ b/ckanext/doi/theme/templates/package/read.html
@@ -32,4 +32,4 @@
         {% snippet "doi/snippets/package_citation.html", pkg_dict=pkg %}
     {% endif %}
     {{ super() }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ckanext/doi/theme/templates/package/read_base.html b/ckanext/doi/theme/templates/package/read_base.html
index 6fcc266..1ac9d63 100644
--- a/ckanext/doi/theme/templates/package/read_base.html
+++ b/ckanext/doi/theme/templates/package/read_base.html
@@ -9,4 +9,4 @@
     <meta name="citation_online_date" content="{{ pkg['doi_date_published'] }}" />
     <meta name="citation_publisher" content="{{ pkg['doi_publisher'] }}" />
     {% endif %}
-{%- endblock -%}
\ No newline at end of file
+{%- endblock -%}
diff --git a/ckanext/doi/theme/templates/package/resource_read.html b/ckanext/doi/theme/templates/package/resource_read.html
index 88b6f41..353adec 100644
--- a/ckanext/doi/theme/templates/package/resource_read.html
+++ b/ckanext/doi/theme/templates/package/resource_read.html
@@ -5,4 +5,4 @@
         {% snippet "doi/snippets/resource_citation.html", pkg_dict=pkg, res=res %}
     {% endif %}
     {{ super() }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ckanext/doi/theme/templates/package/snippets/package_basic_fields.html b/ckanext/doi/theme/templates/package/snippets/package_basic_fields.html
index 84cda75..4ebd79b 100644
--- a/ckanext/doi/theme/templates/package/snippets/package_basic_fields.html
+++ b/ckanext/doi/theme/templates/package/snippets/package_basic_fields.html
@@ -4,4 +4,4 @@
 
         {{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, error=errors.title, classes=['control-full', 'control-large'], attrs={'data-module': 'slug-preview-target'}, is_required=true) }}
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/ckanext/doi/theme/templates/package/snippets/package_metadata_fields.html b/ckanext/doi/theme/templates/package/snippets/package_metadata_fields.html
index bebc48d..6a422ba 100644
--- a/ckanext/doi/theme/templates/package/snippets/package_metadata_fields.html
+++ b/ckanext/doi/theme/templates/package/snippets/package_metadata_fields.html
@@ -14,4 +14,4 @@
 
     {% endblock %}
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/dev_requirements.txt b/dev_requirements.txt
deleted file mode 100644
index fc8c3a2..0000000
--- a/dev_requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-pytest>=4.6.5
-pytest-cov>=2.7.1
diff --git a/docker-compose.yml b/docker-compose.yml
index 979be64..a6bd437 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -13,7 +13,8 @@ services:
       - solr
       - redis
     volumes:
-      - .:/srv/app/src/ckanext-doi
+      - ./ckanext:/base/src/ckanext-doi/ckanext
+      - ./tests:/base/src/ckanext-doi/tests
 
   solr:
     image: ckan/ckan-solr:2.9
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 8abdecf..4478890 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,25 +1,16 @@
-FROM openknowledge/ckan-dev:2.9
+FROM naturalhistorymuseum/ckantest:0.2
 
-# ckan is installed in /srv/app/src/ckan in the ckan-dev image we're basing this image on
-WORKDIR /srv/app/src/ckanext-doi
+WORKDIR /base/src/ckanext-doi
 
-# copy over the ckanext-doi source
+# copy over the source
 COPY . .
 
-# might as well update pip while we're here!
-RUN pip3 install --upgrade pip
-
-# fixes this https://github.com/ckan/ckan/issues/5570
-RUN pip3 install pytest-ckan
-
-# install the dependencies
-RUN python3 setup.py develop && \
-    pip3 install -r requirements.txt && \
-    pip3 install -r dev_requirements.txt
+# install the base + test dependencies
+RUN pip install -e .[test]
 
 # this entrypoint ensures our service dependencies (postgresql, solr and redis) are running before
 # running the cmd
-ENTRYPOINT ["/bin/bash", "docker/entrypoint.sh"]
+ENTRYPOINT ["/bin/bash", "/opt/waits/basic.sh"]
 
 # run the tests with coverage output
-CMD ["pytest", "--cov=ckanext.doi", "--ckan-ini=test.ini", "tests"]
+CMD ["bash", "/opt/scripts/run-tests.sh", "ckanext.doi"]
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
deleted file mode 100644
index 5f18abf..0000000
--- a/docker/entrypoint.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-set -e
-
-echo "Wait for PostgreSQL to start..."
-while ! pg_isready -h db -U ckan; do
-    sleep 1;
-done
-echo "PostgreSQL started"
-
-echo "Wait for Solr to start..."
-while ! curl -s "http://solr:8983/solr/ckan/admin/ping" | grep -q OK; do
-  sleep 1;
-done
-echo "Solr started"
-
-echo "Wait for Redis to start..."
-while ! echo -e "PING" | nc -w 1 redis 6379 | grep -q "+PONG"; do
-  sleep 1;
-done
-echo "Redis started"
-
-echo "All services up, running command"
-
-exec "$@"
diff --git a/docs/_scripts/gen_api_pages.py b/docs/_scripts/gen_api_pages.py
new file mode 100644
index 0000000..c1dcbe5
--- /dev/null
+++ b/docs/_scripts/gen_api_pages.py
@@ -0,0 +1,45 @@
+# !/usr/bin/env python
+# encoding: utf-8
+
+"""
+Generate the code reference pages and navigation.
+
+Adapted from https://mkdocstrings.github.io/recipes.
+"""
+
+from pathlib import Path
+
+import mkdocs_gen_files
+
+nav = mkdocs_gen_files.Nav()
+
+root = 'ckanext'
+
+py_files = sorted(Path(root).rglob('*.py'))
+
+for path in py_files:
+    module_path = path.relative_to(root).with_suffix('')
+    doc_path = path.relative_to(root).with_suffix('.md')
+    full_doc_path = Path('API', doc_path)
+
+    parts = tuple(module_path.parts)
+
+    if parts[-1] == '__init__':
+        if len(parts) == 1:
+            continue
+        parts = parts[:-1]
+        doc_path = doc_path.with_name('index.md')
+        full_doc_path = full_doc_path.with_name('index.md')
+    elif parts[-1] == '__main__':
+        continue
+
+    nav[parts] = doc_path.as_posix()
+
+    with mkdocs_gen_files.open(full_doc_path, "w") as fd:
+        ident = '.'.join(parts)
+        fd.write(f'::: ckanext.{ident}')
+
+    mkdocs_gen_files.set_edit_path(full_doc_path, path)
+
+with mkdocs_gen_files.open('API/index.md', 'w') as nav_file:
+    nav_file.writelines(nav.build_literate_nav())
diff --git a/docs/assets/logo.png b/docs/assets/logo.png
new file mode 100644
index 0000000..118c7d3
Binary files /dev/null and b/docs/assets/logo.png differ
diff --git a/docs/configuration.md b/docs/configuration.md
new file mode 100644
index 0000000..4492849
--- /dev/null
+++ b/docs/configuration.md
@@ -0,0 +1,5 @@
+{%
+    include-markdown "../README.md"
+    start="<!--configuration-start-->"
+    end="<!--configuration-end-->"
+%}
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..29aa397
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,7 @@
+# ckanext-doi documentation
+
+{%
+    include-markdown "../README.md"
+    start="<!--overview-start-->"
+    end="<!--overview-end-->"
+%}
diff --git a/docs/installation.md b/docs/installation.md
new file mode 100644
index 0000000..a91e282
--- /dev/null
+++ b/docs/installation.md
@@ -0,0 +1,5 @@
+{%
+    include-markdown "../README.md"
+    start="<!--installation-start-->"
+    end="<!--installation-end-->"
+%}
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100644
index 0000000..310cdc8
--- /dev/null
+++ b/docs/requirements.txt
@@ -0,0 +1,6 @@
+mkdocs
+mkdocstrings[python]
+mkdocs-material
+mkdocs-gen-files
+mkdocs-section-index
+mkdocs-include-markdown-plugin
diff --git a/docs/usage/index.md b/docs/usage/index.md
new file mode 100644
index 0000000..91aff61
--- /dev/null
+++ b/docs/usage/index.md
@@ -0,0 +1,5 @@
+{%
+    include-markdown "../../README.md"
+    start="<!--usage-start-->"
+    end="<!--usage-end-->"
+%}
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 0000000..b2b2881
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,39 @@
+site_name: ckanext-doi
+
+theme:
+  name: material
+  palette:
+    - scheme: default
+      toggle:
+        icon: material/lightbulb
+      primary: green
+      accent: green
+    - scheme: slate
+      toggle:
+        icon: material/lightbulb-outline
+      primary: green
+      accent: green
+  logo: assets/logo.png
+  favicon: assets/logo.png
+
+watch:
+  - ckanext
+
+plugins:
+  - search
+  - mkdocstrings:
+      default_handler: python
+      handlers:
+        python:
+          options:
+            docstring_style: sphinx
+  - gen-files:
+      scripts:
+        - docs/_scripts/gen_api_pages.py
+  - section-index
+  - include-markdown
+
+markdown_extensions:
+  - admonition
+  - pymdownx.details
+  - pymdownx.superfences
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..51a7e78
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,78 @@
+[project]
+name = "ckanext-doi"
+version = "3.0.7"
+description = "A CKAN extension for assigning a digital object identifier (DOI) to datasets, using the DataCite DOI service."
+readme = "README.md"
+requires-python = ">=3.6"
+license = { text = "GPL-3.0-or-later" }
+authors = [
+    { name = "Natural History Museum", email = "data@nhm.ac.uk" }
+]
+keywords = ["CKAN", "data", "doi"]
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+    "Programming Language :: Python",
+    "Programming Language :: Python :: 3 :: Only",
+    "Programming Language :: Python :: 3.6",
+    "Programming Language :: Python :: 3.7",
+    "Programming Language :: Python :: 3.8"
+]
+dependencies = [
+    "jsonschema==3.0.0",
+    "xmltodict==0.12.0",
+    "datacite==1.1.2",
+    "ckantools>=0.3.0"
+]
+
+[project.optional-dependencies]
+test = [
+    "mock",
+    "pytest>=4.6.5",
+    "pytest-cov>=2.7.1",
+    "coveralls"
+]
+
+[project.urls]
+repository = "https://github.com/NaturalHistoryMuseum/ckanext-doi"
+changelog = "https://github.com/NaturalHistoryMuseum/ckanext-doi/blob/main/CHANGELOG.md"
+
+[project.entry-points."ckan.plugins"]
+doi = "ckanext.doi.plugin:DOIPlugin"
+
+
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"
+
+
+[tool]
+[tool.setuptools]
+zip-safe = false
+
+[tool.setuptools.packages.find]
+exclude = ["tests", "docs"]
+
+[tool.commitizen]
+name = "cz_nhm"
+version = "3.0.7"
+tag_format = "v$version"
+update_changelog_on_bump = true
+changelog_incremental = true
+version_files = [
+    "pyproject.toml:version"
+]
+
+[tool.black]
+line-length = 88
+skip_string_normalization = true
+
+[tool.pylint]
+max-line-length = 88
+disable = ["C0114", "R0903"]
+
+[tool.docformatter]
+wrap-summaries = 88
+wrap-descriptions = 88
+pre-summary-newline = true
+make-summary-multi-line = true
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100755
index abd36bd..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# install from setup.py
-.
diff --git a/setup.py b/setup.py
index 9304790..2f45693 100644
--- a/setup.py
+++ b/setup.py
@@ -1,48 +1,10 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
 # encoding: utf-8
 #
 # This file is part of ckanext-doi
 # Created by the Natural History Museum in London, UK
 
-from setuptools import find_packages, setup
+import setuptools
 
-__version__ = '3.0.7'
-
-with open('README.md', 'r') as f:
-    __long_description__ = f.read()
-
-setup(
-    name='ckanext-doi',
-    version=__version__,
-    description='A CKAN extension for assigning a digital object identifier (DOI) to datasets, '
-                'using the DataCite DOI service.',
-    long_description=__long_description__,
-    classifiers=[
-        'Development Status :: 5 - Production/Stable',
-        'License :: OSI Approved :: MIT License',
-        'Programming Language :: Python',
-        'Programming Language :: Python :: 3 :: Only',
-        'Programming Language :: Python :: 3.6',
-        'Programming Language :: Python :: 3.7',
-        'Programming Language :: Python :: 3.8',
-    ],
-    keywords='CKAN data doi',
-    author='Natural History Museum',
-    author_email='data@nhm.ac.uk',
-    url='https://github.com/NaturalHistoryMuseum/ckanext-doi',
-    license='GNU GPLv3',
-    packages=find_packages(exclude=['tests']),
-    namespace_packages=['ckanext', 'ckanext.doi'],
-    include_package_data=True,
-    zip_safe=False,
-    install_requires=[
-        'datacite==1.1.2',
-        'xmltodict==0.12.0',
-        'jsonschema==3.0.0',
-    ],
-    entry_points= \
-        '''
-        [ckan.plugins]
-            doi=ckanext.doi.plugin:DOIPlugin
-        ''',
-)
+if __name__ == "__main__":
+    setuptools.setup()


Test patch:
diff --git a/docs/tests.md b/docs/tests.md
new file mode 100644
index 0000000..e172be0
--- /dev/null
+++ b/docs/tests.md
@@ -0,0 +1,5 @@
+{%
+    include-markdown "../README.md"
+    start="<!--testing-start-->"
+    end="<!--testing-end-->"
+%}
diff --git a/test.ini b/test.ini
index af9d42a..56ddf44 100644
--- a/test.ini
+++ b/test.ini
@@ -5,9 +5,9 @@ port = 5000
 
 [app:main]
 # use a full path to ensure the config is picked up wherever the tests are run from (this covers off
-# both the default setup, where the tests are run from /srv/app/src/ckanext-doi/, and running them
-# from an IDE like PyCharm which will copy the code into /opt/project/ and run it from there
-use = config:/srv/app/src/ckan/test-core.ini
+# both the default setup, where the tests are run from /base/src/ckanext-doi/, and running
+# them from an IDE like PyCharm which will copy the code into /opt/project/ and run it from there
+use = config:/base/src/ckan/test-core.ini
 
 # the hosts referenced here resolve to the other docker containers configured in docker-compose.yml
 sqlalchemy.url = postgresql://ckan:password@db/ckan
diff --git a/tests/helpers/__init__.py b/tests/helpers/__init__.py
new file mode 100644
index 0000000..a88bec1
--- /dev/null
+++ b/tests/helpers/__init__.py
@@ -0,0 +1,2 @@
+# !/usr/bin/env python
+# encoding: utf-8
diff --git a/tests/constants.py b/tests/helpers/constants.py
similarity index 58%
rename from tests/constants.py
rename to tests/helpers/constants.py
index e205a6d..f3c390f 100644
--- a/tests/constants.py
+++ b/tests/helpers/constants.py
@@ -27,19 +27,22 @@
     'type': 'dataset',
     'resources': [],
     'num_resources': 0,
-    'tags': [{
-        'vocabulary_id': None,
-        'state': 'active',
-        'display_name': 'not-a-real-package',
-        'id': 'a3169a9a-e03c-4844-8694-0bd0cfaaaeae',
-        'name': 'not-a-real-package'
-    }, {
-        'vocabulary_id': None,
-        'state': 'active',
-        'display_name': 'testing',
-        'id': 'cbd1ad22-d75e-4641-8d47-d29bbd758e0c',
-        'name': 'testing'
-    }],
+    'tags': [
+        {
+            'vocabulary_id': None,
+            'state': 'active',
+            'display_name': 'not-a-real-package',
+            'id': 'a3169a9a-e03c-4844-8694-0bd0cfaaaeae',
+            'name': 'not-a-real-package',
+        },
+        {
+            'vocabulary_id': None,
+            'state': 'active',
+            'display_name': 'testing',
+            'id': 'cbd1ad22-d75e-4641-8d47-d29bbd758e0c',
+            'name': 'testing',
+        },
+    ],
     'groups': [],
     'creator_user_id': '21ff8eeb-38e5-4348-8c1d-f409b2a9ca03',
     'relationships_as_subject': [],
@@ -62,40 +65,38 @@
         'revision_id': '2b0d57a6-5d2f-46c3-859e-32635bfcf741',
         'type': 'organization',
         'id': '2dc787a8-17c3-4425-bed7-2b97c81789d0',
-        'name': 'test_org_00'
+        'name': 'test_org_00',
     },
     'revision_id': 'c71800fb-60b7-421f-a7f2-56dc8efaf21d',
-    'doi_date_published': None
+    'doi_date_published': None,
 }
 
 METADATA_DICT = {
     'fundingReferences': [],
-    'contributors': [{
-        'full_name': 'Author, Test',
-        'contributor_type': 'Researcher'
-    }, {
-        'full_name': 'Maintainer, Data',
-        'contributor_type': 'DataManager'
-    }],
+    'contributors': [
+        {'full_name': 'Author, Test', 'contributor_type': 'Researcher'},
+        {'full_name': 'Maintainer, Data', 'contributor_type': 'DataManager'},
+    ],
     'geolocations': [],
-    'dates': [{
-        'date': datetime.datetime(2020, 11, 9, 17, 14, 6, 700561),
-        'dateType': 'Created'
-    }, {
-        'date': datetime.datetime(2020, 11, 9, 17, 14, 7, 225364),
-        'dateType': 'Updated'
-    }, {
-        'date': None,
-        'dateType': 'Issued'
-    }],
+    'dates': [
+        {
+            'date': datetime.datetime(2020, 11, 9, 17, 14, 6, 700561),
+            'dateType': 'Created',
+        },
+        {
+            'date': datetime.datetime(2020, 11, 9, 17, 14, 7, 225364),
+            'dateType': 'Updated',
+        },
+        {'date': None, 'dateType': 'Issued'},
+    ],
     'relatedIdentifiers': [],
-    'titles': [{
-        'title': 'Test Package'
-    }],
-    'descriptions': [{
-        'descriptionType': 'Other',
-        'description': 'These are some notes about the package.'
-    }],
+    'titles': [{'title': 'Test Package'}],
+    'descriptions': [
+        {
+            'descriptionType': 'Other',
+            'description': 'These are some notes about the package.',
+        }
+    ],
     'subjects': [],
     'publisher': 'Natural History Museum',
     'publicationYear': 2020,
@@ -103,27 +104,27 @@
     'language': '',
     'sizes': ['0 kb'],
     'resourceType': 'dataset',
-    'alternateIdentifiers': [{
-        'alternateIdentifierType': 'URL',
-        'alternateIdentifier': 'http://data.nhm.ac.uk/dataset/919379ef-ea08-4a5f-b370-7845e24117b4'
-    }],
+    'alternateIdentifiers': [
+        {
+            'alternateIdentifierType': 'URL',
+            'alternateIdentifier': 'http://data.nhm.ac.uk/dataset/919379ef-ea08-4a5f-b370-7845e24117b4',
+        }
+    ],
     'version': '1',
     'formats': [],
-    'creators': [{
-        'full_name': 'Author, Test'
-    }]
+    'creators': [{'full_name': 'Author, Test'}],
 }
 
 # minimal example from https://datacite.readthedocs.io/en/latest
 XML_DICT = {
-    'identifiers': [{
-        'identifierType': 'DOI',
-        'identifier': '10.4124/abcd1234',
-    }],
-    'creators': [
+    'identifiers': [
         {
-            'name': 'Smith, John'
-        },
+            'identifierType': 'DOI',
+            'identifier': '10.4124/abcd1234',
+        }
+    ],
+    'creators': [
+        {'name': 'Smith, John'},
     ],
     'titles': [
         {
@@ -132,9 +133,6 @@
     ],
     'publisher': 'Invenio Software',
     'publicationYear': '2015',
-    'types': {
-        'resourceType': 'Dataset',
-        'resourceTypeGeneral': 'Dataset'
-    },
+    'types': {'resourceType': 'Dataset', 'resourceTypeGeneral': 'Dataset'},
     'schemaVersion': 'http://datacite.org/schema/kernel-4',
 }
diff --git a/tests/test_api.py b/tests/test_api.py
index 53e797c..6d1dc89 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -10,19 +10,20 @@
 from datacite.errors import DataCiteError, DataCiteNotFoundError
 from unittest.mock import patch, MagicMock
 
-from . import constants
+from .helpers import constants
 from ckanext.doi.lib.api import DataciteClient
 
 
 def first_then(first, then):
-    '''
-    Convenience generator which yields the first parameter and then yields the then parameter
-    forever. Handy for MagicMock object side_effects where the first time the function is run first
-    parameter should be return and then the then parameter after that.
+    """
+    Convenience generator which yields the first parameter and then yields the then
+    parameter forever. Handy for MagicMock object side_effects where the first time the
+    function is run first parameter should be return and then the then parameter after
+    that.
 
     :param first: the first value to yield, once
     :param then: the parameter to yield on subsequent next calls, forever
-    '''
+    """
     yield first
     while True:
         yield then
@@ -30,21 +31,27 @@ def first_then(first, then):
 
 @pytest.mark.ckan_config('ckanext.doi.prefix', 'testing')
 class TestGenerateNewDOI:
-    '''
-    In each of these tests we could assert the number of calls to the db and datacite client mocks
-    but this feels like a bit too much of a reach into the internal logic of the function. We care
-    about the result based on the scenario not how it gets there (unless we think we should test
-    that the function checks the db before checking datacite for performance but I don't think this
-    is really needed tbh.
-    '''
+    """
+    In each of these tests we could assert the number of calls to the db and datacite
+    client mocks but this feels like a bit too much of a reach into the internal logic
+    of the function.
+
+    We care about the result based on the scenario not how it gets there (unless we
+    think we should test that the function checks the db before checking datacite for
+    performance but I don't think this is really needed tbh.
+    """
 
     def test_no_existing_dois(self):
         # no dois in datacite
-        mock_client = MagicMock(metadata_get=MagicMock(side_effect=DataCiteNotFoundError()))
+        mock_client = MagicMock(
+            metadata_get=MagicMock(side_effect=DataCiteNotFoundError())
+        )
         # no dois in the database
         mock_read_doi = MagicMock(return_value=None)
 
-        with patch('ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)):
+        with patch(
+            'ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)
+        ):
             with patch('ckanext.doi.lib.api.DOIQuery.read_doi', mock_read_doi):
                 api = DataciteClient()
                 doi = api.generate_doi()
@@ -57,11 +64,15 @@ def test_no_existing_dois(self):
 
     def test_one_existing_db_doi(self):
         # no dois in datacite
-        mock_client = MagicMock(metadata_get=MagicMock(side_effect=DataCiteNotFoundError()))
+        mock_client = MagicMock(
+            metadata_get=MagicMock(side_effect=DataCiteNotFoundError())
+        )
         # one doi in the database that hits the first call, but then the next time is fine
         mock_read_doi = MagicMock(side_effect=first_then(MagicMock(), None))
 
-        with patch('ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)):
+        with patch(
+            'ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)
+        ):
             with patch('ckanext.doi.lib.api.DOIQuery.read_doi', mock_read_doi):
                 api = DataciteClient()
                 doi = api.generate_doi()
@@ -70,11 +81,16 @@ def test_one_existing_db_doi(self):
     def test_one_existing_on_datacite(self):
         # the first call to the datacite client returns a (mock) doi but then the next one succeeds
         mock_client = MagicMock(
-            metadata_get=MagicMock(side_effect=first_then(MagicMock(), DataCiteNotFoundError())))
+            metadata_get=MagicMock(
+                side_effect=first_then(MagicMock(), DataCiteNotFoundError())
+            )
+        )
         # no dois in the db
         mock_read_doi = MagicMock(return_value=None)
 
-        with patch('ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)):
+        with patch(
+            'ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)
+        ):
             with patch('ckanext.doi.lib.api.DOIQuery.read_doi', mock_read_doi):
                 api = DataciteClient()
                 doi = api.generate_doi()
@@ -83,11 +99,16 @@ def test_one_existing_on_datacite(self):
     def test_one_existing_on_datacite_and_one_in_the_db(self):
         # the first call to the datacite client returns a (mock) doi but then the next one succeeds
         mock_client = MagicMock(
-            metadata_get=MagicMock(side_effect=first_then(MagicMock(), DataCiteNotFoundError())))
+            metadata_get=MagicMock(
+                side_effect=first_then(MagicMock(), DataCiteNotFoundError())
+            )
+        )
         # the first call to the db returns a result but then after that we're all good
         mock_read_doi = MagicMock(side_effect=first_then(MagicMock(), None))
 
-        with patch('ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)):
+        with patch(
+            'ckanext.doi.lib.api.DataCiteMDSClient', MagicMock(return_value=mock_client)
+        ):
             with patch('ckanext.doi.lib.api.DOIQuery.read_doi', mock_read_doi):
                 api = DataciteClient()
                 doi = api.generate_doi()
@@ -107,10 +128,12 @@ def test_it_fails_when_it_cannot_generate_a_unique_doi(self):
 
 
 class MockDataciteMDSClient(object):
-    '''
-    Mock client so that we can replicate the functionality of the datacite API without actually
-    calling it. Specifically, you have to post the metadata before you post the doi.
-    '''
+    """
+    Mock client so that we can replicate the functionality of the datacite API without
+    actually calling it.
+
+    Specifically, you have to post the metadata before you post the doi.
+    """
 
     def __init__(self, *args, **kwargs):
         self.metadata = set()
@@ -132,7 +155,6 @@ def metadata_post(self, xml_doc, *args, **kwargs):
 @patch('ckanext.doi.lib.api.DataCiteMDSClient', MockDataciteMDSClient)
 @patch('ckanext.doi.lib.api.DOIQuery')
 class TestMintNewDOI(object):
-
     def test_datacite_api_order(self, mock_crud):
         mock_crud.read_doi = MagicMock(return_value=None)
         mock_crud.read_package = MagicMock(return_value=None)
@@ -213,17 +235,21 @@ def test_both_exist(self, mock_crud):
 @pytest.mark.ckan_config('ckanext.doi.account_password', 'hammocks?')
 @patch('ckanext.doi.lib.api.DataCiteMDSClient')
 class TestDataciteClientCreation(object):
-
     @pytest.mark.ckan_config('ckanext.doi.test_mode', False)
     def test_basics(self, mock_client):
         DataciteClient()
-        assert mock_client.called_once_with(username='goat!', password='hammocks?',
-                                            prefix='testing', test_mode=False)
+        assert mock_client.called_once_with(
+            username='goat!', password='hammocks?', prefix='testing', test_mode=False
+        )
         assert 'url' not in mock_client.call_args.kwargs
 
     @pytest.mark.ckan_config('ckanext.doi.test_mode', True)
     def test_test_mode_true(self, mock_client):
         DataciteClient()
-        assert mock_client.called_once_with(username='goat!', password='hammocks?',
-                                            prefix='testing', test_mode=True,
-                                            url=DataciteClient.test_url)
+        assert mock_client.called_once_with(
+            username='goat!',
+            password='hammocks?',
+            prefix='testing',
+            test_mode=True,
+            url=DataciteClient.test_url,
+        )
diff --git a/tests/test_db.py b/tests/test_db.py
index 7aff492..087196a 100644
--- a/tests/test_db.py
+++ b/tests/test_db.py
@@ -14,9 +14,9 @@
 
 @pytest.fixture
 def with_doi_table(reset_db):
-    '''
+    """
     Simple fixture which resets the database and creates the doi table.
-    '''
+    """
     reset_db()
     doi_table.create(checkfirst=True)
 
@@ -29,7 +29,8 @@ def with_doi_table(reset_db):
 def test_doi_is_created_automatically(mock_client):
     # this test ensures that when a package is created, a DOI is created
     mock_client.return_value = MagicMock(
-        metadata_get=MagicMock(side_effect=DataCiteNotFoundError()))
+        metadata_get=MagicMock(side_effect=DataCiteNotFoundError())
+    )
     package = factories.Dataset()
     found_record = Session.query(DOI).filter(DOI.package_id == package['id']).one()
     assert found_record is not None
diff --git a/tests/test_generate.py b/tests/test_generate.py
index 231cd3b..c8abc0a 100644
--- a/tests/test_generate.py
+++ b/tests/test_generate.py
@@ -9,7 +9,7 @@
 from datacite import schema42
 
 from ckanext.doi.lib.metadata import build_metadata_dict, build_xml_dict
-from . import constants
+from .helpers import constants
 
 
 @pytest.mark.ckan_config('ckanext.doi.publisher', 'Example Publisher')
@@ -30,10 +30,7 @@ def test_extracts_metadata():
 def test_handles_bad_data():
     bad_pkg_dict = {k: v for k, v in constants.PKG_DICT.items()}
     bad_pkg_dict['resources'] = None
-    bad_pkg_dict['author'] = {
-        'given_name': 'Test',
-        'family_name': 'Author'
-    }
+    bad_pkg_dict['author'] = {'given_name': 'Test', 'family_name': 'Author'}
     bad_pkg_dict['license_id'] = None
     build_metadata_dict(bad_pkg_dict)
 
@@ -47,8 +44,7 @@ def test_handles_bad_data():
 def test_generate_xml():
     xml_dict = build_xml_dict(constants.METADATA_DICT)
     # build_xml_dict does not add a DOI
-    xml_dict['identifiers'] = [{
-        'identifierType': 'DOI',
-        'identifier': '10.0000/this-would-be-a-doi'
-    }]
+    xml_dict['identifiers'] = [
+        {'identifierType': 'DOI', 'identifier': '10.0000/this-would-be-a-doi'}
+    ]
     assert schema42.validate(xml_dict)