Skip to main content

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

PyPI Libraries.io dependency status for latest release

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 install inside 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:

  1. Update the version number in pyproject.toml
  2. Create a branch release/v{major}.{minor}.{patch}
  3. Update CHANGELOG.md and pyproject.toml for the release
  4. Commit and push
  5. Open a PR from that branch to main
  6. Get approval on the PR
  7. Tag the HEAD of the PR v{major}.{minor}.{patch} and push the tag
  8. Merge the PR to main and push
  9. Add a new release to Github for that tag for consistency's sake

Metadata

Release files for ds-caselaw-utils 5.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ds-caselaw-utils 5.1.0
File Size Uploaded
ds_caselaw_utils-5.1.0.tar.gz 28.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ds-caselaw-utils 5.1.0
File Interpreter ABI Platform
ds_caselaw_utils-5.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 61.1 kB

Release files / ds_caselaw_utils-5.1.0.tar.gz

Download URL ds_caselaw_utils-5.1.0.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
101f2532442f95f752371a3544b1ab1fba23a4181dd58db0296defc8855bccbd
BLAKE2b-256 checksum
How to use checksums
aaf9a1f9d3077c24740b126e3ae327fe2942719f01287c576d0ab76e07718429
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 28, 2026.

Transparency log

Release files / ds_caselaw_utils-5.1.0-py3-none-any.whl

Download URL ds_caselaw_utils-5.1.0-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50e45f7942b32a0457deefd79e495cd0c449f23ad87f90c44356c866c73a16b0
BLAKE2b-256 checksum
How to use checksums
e1e86099829a654fe26e1bce3934612f4b413a252a715889c443c795ca0abbac
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 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.1.0 This release

2 release files

5.0.0

2 release files

4.9.0

2 release files

4.8.0

2 release files

4.7.0

2 release files

4.6.0

2 release files

4.5.2

2 release files

4.5.0

2 release files

4.4.0

2 release files

4.3.1

2 release files

4.3.0

2 release files

4.2.1

2 release files

4.2.0

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.9.0

2 release files

2.8.2

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.1

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.7

2 release files

2.4.6

2 release files

2.4.5

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page