ds-caselaw-utils


Nameds-caselaw-utils JSON
Version 2.6.0 PyPI version JSON
download
home_pagehttps://github.com/nationalarchives/ds-caselaw-utils
SummaryUtilities for the National Archives Caselaw project
upload_time2025-08-18 13:25:56
maintainerNone
docs_urlNone
authorNick Jackson
requires_python<4.0,>=3.9
licenseMIT
keywords national archives caselaw
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```python
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:

```yaml
- 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.9` (as the project is pinned to python 3.9)
- `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`.

```bash
$ poetry shell
$ poetry install
```

## Testing

While in a poetry shell:

```bash
$ poetry run pytest
```

## 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/f4/99/a1535a85de7947c70f5601806e6fd2589f2d21510cf291f4fba32809173c/ds_caselaw_utils-2.6.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```python\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\nThe list of courts is defined in `src/ds_caselaw_utils/data/court_names.yml`. The format is as follows:\n\n```yaml\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    - # 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## Requirements\n\nThe environment you develop this repo in requires the following to be installed:\n\n- `python 3.9` (as the project is pinned to python 3.9)\n- `poetry` (as this is used for depdenency management and virtual environment management)\n- `pre-commit` (to install git hooks defined in `.pre-commit-config.yaml`)\n\n## Getting set up\n\n- Run `pre-commit install` inside the root directory of the repo to install the git hooks defined in `.pre-commit-config.yaml`.\n\n```bash\n$ poetry shell\n$ poetry install\n```\n\n## Testing\n\nWhile in a poetry shell:\n\n```bash\n$ poetry run pytest\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.6.0",
    "project_urls": {
        "Homepage": "https://github.com/nationalarchives/ds-caselaw-utils"
    },
    "split_keywords": [
        "national archives",
        " caselaw"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d5143fdc0f0523320b4247448665538a9327356c7106cf84e0a8ce8d8956e201",
                "md5": "3e63116b1e0743d944a968541f3f3ed7",
                "sha256": "6e38cea84f565bc0a28588f8d5cf0b085d59a77107dc9d7db5923fa03ef06ee4"
            },
            "downloads": -1,
            "filename": "ds_caselaw_utils-2.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e63116b1e0743d944a968541f3f3ed7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 54388,
            "upload_time": "2025-08-18T13:25:54",
            "upload_time_iso_8601": "2025-08-18T13:25:54.596573Z",
            "url": "https://files.pythonhosted.org/packages/d5/14/3fdc0f0523320b4247448665538a9327356c7106cf84e0a8ce8d8956e201/ds_caselaw_utils-2.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f499a1535a85de7947c70f5601806e6fd2589f2d21510cf291f4fba32809173c",
                "md5": "8bd151966c7cce1995b43ef88ceb6882",
                "sha256": "efdf5c5fbb8e6ed2c31f7338549d7e5a1246e0950fe2f54348725e9ec0a2f14b"
            },
            "downloads": -1,
            "filename": "ds_caselaw_utils-2.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8bd151966c7cce1995b43ef88ceb6882",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 27467,
            "upload_time": "2025-08-18T13:25:56",
            "upload_time_iso_8601": "2025-08-18T13:25:56.313784Z",
            "url": "https://files.pythonhosted.org/packages/f4/99/a1535a85de7947c70f5601806e6fd2589f2d21510cf291f4fba32809173c/ds_caselaw_utils-2.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-18 13:25:56",
    "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"
}
        
Elapsed time: 0.97343s