Skip to main content

Utilities for the National Archives Caselaw project

Project description

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_selectable() # returns a list of all courts that are whitelisted to
                        # appear as searchable options

courts.get_listable_groups() # returns a grouped list of courts that are whitelisted to
                             # be listed publicly

courts.get_listable_courts() # returns a list of all *courts* (ie not tribunals)
                             # which are whitelisted to be listed publicly

courts.get_listable_tribunals() # return a list of all *tribunals*  which are
                                # whitelisted to be listed publicly

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 to expose this court publicly as selectable in search filters:
      selectable: true
      # Whether to expose this court publicly in listings:
      listable: 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

Releasing

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ds_caselaw_utils-2.7.1.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ds_caselaw_utils-2.7.1-py3-none-any.whl (55.2 kB view details)

Uploaded Python 3

File details

Details for the file ds_caselaw_utils-2.7.1.tar.gz.

File metadata

  • Download URL: ds_caselaw_utils-2.7.1.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ds_caselaw_utils-2.7.1.tar.gz
Algorithm Hash digest
SHA256 bdc1450a2f49bcb97bf99a4a0d95a04a2770947d2fdccc2935b69f340f699b09
MD5 d94aa364238c9e36b5ee1c7ac4a4ee61
BLAKE2b-256 f7e8b2f3417574753e8d152f8ad6ba9b74b265f8a7ff5252dbeec4a1f3c5de56

See more details on using hashes here.

Provenance

The following attestation bundles were made for ds_caselaw_utils-2.7.1.tar.gz:

Publisher: publish.yml on nationalarchives/ds-caselaw-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ds_caselaw_utils-2.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ds_caselaw_utils-2.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3f081d585b75b2f69bde1f6ade10a928a106412255646a6f1d5d340673983ace
MD5 289bac0015a873b33ec5b804fa63732b
BLAKE2b-256 6734f9e3818d61a48e9173ad67800bd82bf48c6b430c83c1241909376f5d5ee3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ds_caselaw_utils-2.7.1-py3-none-any.whl:

Publisher: publish.yml on nationalarchives/ds-caselaw-utils

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page