The National Archives: Find Case Law
This repository is part of the Find Case Law project at The National Archives. For more information on the project, check the documentation.
Python Utilities
This repository predominantly contains information about the courts in the Find Case Law project.
pypi name: ds-caselaw-utils
python import name: ds_caselaw_utils
Examples
from ds_caselaw_utils import neutral_url
neutral_url("[2022] EAT 1") # '/eat/2022/4'
from ds_caselaw_utils import courts
courts.get_all() # return a list of all courts
courts.get_by_param("ewhc/ch") # get a court by its parameter value
courts.get_show_in_search_filters() # returns a list of all courts that appear as
# searchable options
courts.get_show_in_search_filters_groups() # returns a grouped list of all courts and tribunals
# that appear as search-filter options
courts.get_grouped_show_in_search_filters_courts() # returns show_in_search_filters courts grouped for display
courts.get_grouped_show_in_search_filters_tribunals() # returns show_in_search_filters tribunals grouped for display
courts.get_show_in_public_directory() # returns a list of courts included in the public directory
courts.get_show_in_public_directory_groups() # returns public-directory courts grouped by category
courts.get_grouped_show_in_public_directory_courts() # returns public-directory courts grouped for display
courts.get_grouped_show_in_public_directory_tribunals() # returns public-directory tribunals grouped for display
courts.get_show_to_editors_groups() # returns a grouped list of courts visible to editors
courts.get_grouped_show_to_editors_courts() # returns courts visible to editors grouped for display
courts.get_grouped_show_to_editors_tribunals() # returns tribunals visible to editors grouped for display
courts.get_show_to_editors_courts() # returns a list of all *courts* (ie not tribunals)
# visible to editors
courts.get_show_to_editors_tribunals() # returns a list of all *tribunals* visible to editors
The list of courts is defined in src/ds_caselaw_utils/data/court_names.yml. The format is as follows:
- name: high_court # Internal name of a group of courts to be displayed together
display_name: "High Court" # An optional public facing name for this group.
is_tribunal: false # Whether this group contains courts or tribunals
courts: # List of courts to be displayed under this group
- # An internal code for this court:
code: EWHC-SeniorCourtsCosts
# The public facing name of the court:
name: High Court (Senior Courts Costs Office)
# An optional alternative wording for use when displayed in grouped format (defaults to 'name'):
grouped_name: Senior Court Costs Office
# A URL to link to for more information on this court:
link: https://www.gov.uk/courts-tribunals/senior-courts-costs-office
# A regex matching neutral citations for this court's judgments:
ncn: \[(\d{4})\] (EWHC) (\d+) \((SCCO)\)
# The canonical parameter value used in searches for this court:
param: "ewhc/scco"
# Any additional parameter aliases which display judgments from this court:
extra_params: ["ewhc/costs"]
# The year of the first judgment we have on file for this court:
start_year: 2003
# The year of the last judgment we have on file for this court
# (optional, defaults to current year):
end_year: ~
# Whether this court appears as an option in search filters:
show_in_search_filters: true
# Whether to include this court in the public directory:
show_in_public_directory: true
# Whether this court is visible to editors:
show_to_editors: true
# Whether this court has ended yet
ended: false
# Whether this court is a court of record (optional):
court_of_record: true
Requirements
The environment you develop this repo in requires the following to be installed:
python 3.12(as the project is pinned to python 3.12)poetry(as this is used for depdenency management and virtual environment management)pre-commit(to install git hooks defined in.pre-commit-config.yaml)
Getting set up
- Run
pre-commit installinside the root directory of the repo to install the git hooks defined in.pre-commit-config.yaml.
$ poetry shell
$ poetry install
Testing
While in a poetry shell:
$ poetry run pytest
Building
$ rm -rf dist
$ poetry build
$ python3 -m twine upload --repository testpypi dist/* --verbose
Release process
When making a new release, update the changelog in the release pull request.
The package will only be released to PyPI if a new tag is created. A merge to main alone will not trigger a release to PyPI.
If the release fails to push to PyPI, you can delete the tag with git pull, git push --delete origin v1.2.3 and try again.
To create a release:
- Update the version number in
pyproject.toml - Create a branch
release/v{major}.{minor}.{patch} - Update
CHANGELOG.mdandpyproject.tomlfor the release - Commit and push
- Open a PR from that branch to main
- Get approval on the PR
- Tag the HEAD of the PR
v{major}.{minor}.{patch}and push the tag - Merge the PR to main and push
- Add a new release to Github for that tag for consistency's sake
Metadata
Release files for ds-caselaw-utils 5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ds_caselaw_utils-5.0.0.tar.gz | 28.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ds_caselaw_utils-5.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.5 kB
Release files / ds_caselaw_utils-5.0.0.tar.gz
| Download URL | ds_caselaw_utils-5.0.0.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
024a05954f3f0392171cd36f4762ff0ed2c4624119fea9d671a487fdb1ea76f9
|
|
BLAKE2b-256 checksum How to use checksums |
96d99d68f14af0bca47a7ea74b24470ec70b3691709ace2a3bda4d56681773af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency logRelease files / ds_caselaw_utils-5.0.0-py3-none-any.whl
| Download URL | ds_caselaw_utils-5.0.0-py3-none-any.whl |
|---|---|
| Size | 32.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b7ed5f7dacba36921667d422987ce946a775b078159ad1a629ed3f1b29d7686
|
|
BLAKE2b-256 checksum How to use checksums |
61f4f013c5ec69a39e3a327509f66f410a84e1706b21fa7bb5d3a11283685aed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.
Transparency log