Package: ds-caselaw-utils
The National Archives: Find Case LawThis repository is part of theFind Case Lawproject atThe National Archives. For more information on the project, checkthe documentation.Python UtilitiesThis repository contains common functions used throughout the National Archives Caselaw project, reducing duplication and complexity.pypi name:ds-caselaw-utilspython import name:ds_caselaw_utilsExamplesfrom 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 publiclyThe list of courts is defined insrc/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: trueTesting$poetryshell
$cdsrc/ds_caselaw_utils
$python-munittestBuilding$rm-rfdist
$poetrybuild
$python3-mtwineupload--repositorytestpypidist/*--verboseReleasingWhen making a new release, update thechangelogin the release
pull request.The package willonlybe released to PyPI if the branch is tagged. A merge
to main alone willnottrigger a release to PyPI.To create a release:Update the version number inpyproject.tomlCreate a branchrelease/v{major}.{minor}.{patch}UpdateCHANGELOG.mdandpyproject.tomlfor the releaseCommit and pushOpen a PR from that branch to mainGet approval on the PRTag the HEAD of the PRv{major}.{minor}.{patch}and push the tagMerge the PR to main and pushAdd a new release to Github for that tag for consistency's sake