Utilities for the National Archives Caselaw project
Project description
Caselaw utility functions
pypi name: ds-caselaw-utils
python import name: ds_caselaw_utils
This repo contains functions of general use throughout the National Archives Caselaw project so that we can have a single point of truth potentially across many repositories.
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
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.
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: Senior Courts Costs Office
# An alternative wording for use in listings (optional, defaults to `name`)
list_name: High Court (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
Testing
$ poetry shell
$ cd src/ds_caselaw_utils
$ python -m unittest
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 the branch is tagged. A merge to main alone will not trigger a release to PyPI.
To create a release:
- Update the version number in
pyproject.toml
- Create a branch
release/v{major}.{minor}.{patch}
- Update changelog for 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
Project details
Release history Release notifications | RSS feed
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-0.3.1.tar.gz
(8.7 kB
view hashes)
Built Distribution
Close
Hashes for ds_caselaw_utils-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1181e30355c8be2cac25e8273f2f715c0b79f428c4a9abc53558b3adcf36e3bd |
|
MD5 | ca586d405bd474f33269eb0d07384a0c |
|
BLAKE2b-256 | 73970620d1029931692d4bb6b141645634f3453129ed1672d2f548b4dabe47f3 |