ds-caselaw-utils


Nameds-caselaw-utils JSON
Version 1.3.5 PyPI version JSON
download
home_pagehttps://github.com/nationalarchives/ds-caselaw-utils
SummaryUtilities for the National Archives Caselaw project
upload_time2024-01-22 10:44:23
maintainer
docs_urlNone
authorNick Jackson
requires_python>=3.9,<4.0
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 contains common functions used throughout the National Archives Caselaw project, reducing duplication and complexity.

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 the branch is tagged. A merge
to main alone will **not** trigger a release to PyPI.

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": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "national archives,caselaw",
    "author": "Nick Jackson",
    "author_email": "nick@dxw.com",
    "download_url": "https://files.pythonhosted.org/packages/0e/96/ffba388d8155a75b5ea4ff2ad19134b8395d9b0cb2d37dcef85e0e8540c8/ds_caselaw_utils-1.3.5.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 contains common functions used throughout the National Archives Caselaw project, reducing duplication and complexity.\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 the branch is tagged. A merge\nto main alone will **not** trigger a release to PyPI.\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": "1.3.5",
    "project_urls": {
        "Homepage": "https://github.com/nationalarchives/ds-caselaw-utils"
    },
    "split_keywords": [
        "national archives",
        "caselaw"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06abd53371c3d0b8b560bcc4f16d990d256f5085e23ce1b3daa511005b274b8e",
                "md5": "c483a6f05b1df71f2bab55687956bdcc",
                "sha256": "c21f082fa2297f2e9e9383f32dad418d92f023941896322435881683a744cf8f"
            },
            "downloads": -1,
            "filename": "ds_caselaw_utils-1.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c483a6f05b1df71f2bab55687956bdcc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 11653,
            "upload_time": "2024-01-22T10:44:21",
            "upload_time_iso_8601": "2024-01-22T10:44:21.447108Z",
            "url": "https://files.pythonhosted.org/packages/06/ab/d53371c3d0b8b560bcc4f16d990d256f5085e23ce1b3daa511005b274b8e/ds_caselaw_utils-1.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e96ffba388d8155a75b5ea4ff2ad19134b8395d9b0cb2d37dcef85e0e8540c8",
                "md5": "a7db9538cd9fd1634ac3bf0a05978e0a",
                "sha256": "b0ae7af4490ec5a9b8a0338976ca557a493629b3062a1063ba1e58920da2d55a"
            },
            "downloads": -1,
            "filename": "ds_caselaw_utils-1.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a7db9538cd9fd1634ac3bf0a05978e0a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 10350,
            "upload_time": "2024-01-22T10:44:23",
            "upload_time_iso_8601": "2024-01-22T10:44:23.155324Z",
            "url": "https://files.pythonhosted.org/packages/0e/96/ffba388d8155a75b5ea4ff2ad19134b8395d9b0cb2d37dcef85e0e8540c8/ds_caselaw_utils-1.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-22 10:44:23",
    "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.16672s