# The National Archives: Find Case Law
This repository is part of the [Find Case Law](https://caselaw.nationalarchives.gov.uk/) project at [The National Archives](https://www.nationalarchives.gov.uk/). For more information on the project, check [the documentation](https://github.com/nationalarchives/ds-find-caselaw-docs).
# Python Utilities
![PyPI](https://img.shields.io/pypi/v/ds-caselaw-utils) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/ds-caselaw-utils)
This repository predominantly contains information about [the courts in the Find Case Law project](courts.md).
pypi name: [ds-caselaw-utils](https://pypi.org/project/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
```
## Testing
```bash
$ poetry shell
$ cd src/ds_caselaw_utils
$ python -m unittest
```
## Building
```bash
$ rm -rf dist
$ poetry build
$ python3 -m twine upload --repository testpypi dist/* --verbose
```
## Releasing
When making a new release, update the [changelog](CHANGELOG.md) 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:
0. Update the version number in `pyproject.toml`
1. Create a branch `release/v{major}.{minor}.{patch}`
2. Update `CHANGELOG.md` and `pyproject.toml` for the release
3. Commit and push
4. Open a PR from that branch to main
5. Get approval on the PR
6. Tag the HEAD of the PR `v{major}.{minor}.{patch}` and push the tag
7. Merge the PR to main and push
8. Add a new release to Github for that tag for consistency's sake
Raw data
{
"_id": null,
"home_page": "https://github.com/nationalarchives/ds-caselaw-utils",
"name": "ds-caselaw-utils",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "national archives, caselaw",
"author": "Nick Jackson",
"author_email": "nick@dxw.com",
"download_url": "https://files.pythonhosted.org/packages/98/54/e752da0d8e7fe423b70c6605bd2f85eb1c23ecced521d431ca567558c656/ds_caselaw_utils-2.0.0.tar.gz",
"platform": null,
"description": "# The National Archives: Find Case Law\n\nThis repository is part of the [Find Case Law](https://caselaw.nationalarchives.gov.uk/) project at [The National Archives](https://www.nationalarchives.gov.uk/). For more information on the project, check [the documentation](https://github.com/nationalarchives/ds-find-caselaw-docs).\n\n# Python Utilities\n\n![PyPI](https://img.shields.io/pypi/v/ds-caselaw-utils) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/pypi/ds-caselaw-utils)\n\nThis repository predominantly contains information about [the courts in the Find Case Law project](courts.md).\n\npypi name: [ds-caselaw-utils](https://pypi.org/project/ds-caselaw-utils)\npython import name: `ds_caselaw_utils`\n\n## Examples\n\n```\nfrom ds_caselaw_utils import neutral_url\nneutral_url(\"[2022] EAT 1\") # '/eat/2022/4'\n\nfrom ds_caselaw_utils import courts\n\ncourts.get_all() # return a list of all courts\n\ncourts.get_by_param(\"ewhc/ch\") # get a court by its parameter value\n\ncourts.get_selectable() # returns a list of all courts that are whitelisted to\n # appear as searchable options\n\ncourts.get_listable_groups() # returns a grouped list of courts that are whitelisted to\n # be listed publicly\n\ncourts.get_listable_courts() # returns a list of all *courts* (ie not tribunals)\n # which are whitelisted to be listed publicly\n\ncourts.get_listable_tribunals() # return a list of all *tribunals* which are\n # whitelisted to be listed publicly\n\n\n```\n\nThe list of courts is defined in `src/ds_caselaw_utils/data/court_names.yml`. The format is as follows:\n\n```\n- name: high_court # Internal name of a group of courts to be displayed together\n display_name: \"High Court\" # An optional public facing name for this group.\n is_tribunal: false # Whether this group contains courts or tribunals\n courts: # List of courts to be displayed under this group\n -\n # An internal code for this court:\n code: EWHC-SeniorCourtsCosts\n # The public facing name of the court:\n name: High Court (Senior Courts Costs Office)\n # An optional alternative wording for use when displayed in grouped format (defaults to 'name'):\n grouped_name: Senior Court Costs Office\n # A URL to link to for more information on this court:\n link: https://www.gov.uk/courts-tribunals/senior-courts-costs-office\n # A regex matching neutral citations for this court's judgments:\n ncn: \\[(\\d{4})\\] (EWHC) (\\d+) \\((SCCO)\\)\n # The canonical parameter value used in searches for this court:\n param: 'ewhc/scco'\n # Any additional parameter aliases which display judgments from this court:\n extra_params: ['ewhc/costs']\n # The year of the first judgment we have on file for this court:\n start_year: 2003\n # The year of the last judgment we have on file for this court\n # (optional, defaults to current year):\n end_year: ~\n # Whether to expose this court publicly as selectable in search filters:\n selectable: true\n # Whether to expose this court publicly in listings:\n listable: true\n```\n\n## Testing\n\n```bash\n$ poetry shell\n$ cd src/ds_caselaw_utils\n$ python -m unittest\n```\n\n## Building\n\n```bash\n$ rm -rf dist\n$ poetry build\n$ python3 -m twine upload --repository testpypi dist/* --verbose\n```\n\n## Releasing\n\nWhen making a new release, update the [changelog](CHANGELOG.md) in the release\npull request.\n\nThe package will **only** be released to PyPI if a new tag is created. A merge\nto main alone will **not** trigger a release to PyPI.\n\nIf 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.\n\nTo create a release:\n\n0. Update the version number in `pyproject.toml`\n1. Create a branch `release/v{major}.{minor}.{patch}`\n2. Update `CHANGELOG.md` and `pyproject.toml` for the release\n3. Commit and push\n4. Open a PR from that branch to main\n5. Get approval on the PR\n6. Tag the HEAD of the PR `v{major}.{minor}.{patch}` and push the tag\n7. Merge the PR to main and push\n8. Add a new release to Github for that tag for consistency's sake\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Utilities for the National Archives Caselaw project",
"version": "2.0.0",
"project_urls": {
"Homepage": "https://github.com/nationalarchives/ds-caselaw-utils"
},
"split_keywords": [
"national archives",
" caselaw"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b9dadc9ac88380a62be3a656761f4aed9f20af53600a61827f96c6a4623f9a7b",
"md5": "8d895cc79d0467cc1824d4f62a3bf37d",
"sha256": "e1db77069ad668aff88db5aa3835419bdc8c57fed92a70e72ede2524167b6073"
},
"downloads": -1,
"filename": "ds_caselaw_utils-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8d895cc79d0467cc1824d4f62a3bf37d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 16932,
"upload_time": "2024-10-02T13:08:44",
"upload_time_iso_8601": "2024-10-02T13:08:44.397888Z",
"url": "https://files.pythonhosted.org/packages/b9/da/dc9ac88380a62be3a656761f4aed9f20af53600a61827f96c6a4623f9a7b/ds_caselaw_utils-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9854e752da0d8e7fe423b70c6605bd2f85eb1c23ecced521d431ca567558c656",
"md5": "281596e4c4e7892a16cb67665899975b",
"sha256": "0d5f494c3cfc3f5772ea45ebab4601358fdf09082bc2134eb02ca4e6cf953935"
},
"downloads": -1,
"filename": "ds_caselaw_utils-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "281596e4c4e7892a16cb67665899975b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 15115,
"upload_time": "2024-10-02T13:08:45",
"upload_time_iso_8601": "2024-10-02T13:08:45.678157Z",
"url": "https://files.pythonhosted.org/packages/98/54/e752da0d8e7fe423b70c6605bd2f85eb1c23ecced521d431ca567558c656/ds_caselaw_utils-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-02 13:08:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nationalarchives",
"github_project": "ds-caselaw-utils",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ds-caselaw-utils"
}