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_by_param("ewhc/ch").noun  # "court" (or "tribunal" for tribunal records)

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.2.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.2.0
File Size Uploaded Provenance Actions
ds_caselaw_utils-5.2.0.tar.gz 28.9 kB With provenance Details for ds_caselaw_utils-5.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 62.9 kB

Release files / ds_caselaw_utils-5.2.0.tar.gz

Download URL ds_caselaw_utils-5.2.0.tar.gz
Size 28.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ff881d751c60ed4c4c4e54aa35fc1aeabaabf64ccb653b3721952c0def6dc996
BLAKE2b-256 checksum
How to use checksums
0f1336adea62a5ff9fae41610357a37a3d6f667c694c7e18214d05ff32c41cef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

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

Download URL ds_caselaw_utils-5.2.0-py3-none-any.whl
Size 34.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d80b9cb55fc4bbf389685957ea7eb3869e8705ee2e99e9e37329aff5d8f8249
BLAKE2b-256 checksum
How to use checksums
d1256916d2c6e9cf4d731020c5249288e4132ee3886a45d5b22be1ce42086b1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Security for ds-caselaw-utils 5.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ds_caselaw_utils-5.2.0.tar.gz

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 Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

5.2.0 This release

2 release files Full provenance

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