koozie


Namekoozie JSON
Version 1.2.4 PyPI version JSON
download
home_pagehttps://github.com/bigladder/koozie
SummaryA light-weight wrapper around pint for unit conversions.
upload_time2024-12-21 00:35:08
maintainerNone
docs_urlNone
authorBig Ladder Software
requires_python<4.0,>=3.10
licenseBSD-3
keywords units
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Release](https://img.shields.io/pypi/v/koozie.svg)](https://pypi.python.org/pypi/koozie)

[![Test](https://github.com/bigladder/koozie/actions/workflows/test.yaml/badge.svg)](https://github.com/bigladder/koozie/actions/workflows/test.yaml)

koozie
======

*koozie* is a light-weight wrapper around [*pint*](https://pint.readthedocs.io/en/stable/) for unit conversions. The intent is to provide much of the functionality without worrying about the setup. It uses quantities internally, but its functions only return floats. This approach reflects the opinion that all calculations should be performed in Standard base SI units, and any conversions can happen via pre- or post-processing for usability. This minimizes additional operations in performance critical code.

*koozie* also defines a few convenient aliases for different units. See the [source code](https://github.com/bigladder/koozie/blob/master/koozie/koozie.py) for details. A list of other available units is defined in [pint's default units definition file](https://github.com/hgrecco/pint/blob/master/pint/default_en.txt).

There are four public functions in *koozie*:

- `fr_u(value, from_units)`: Convert a value (or an iterable container of values) from given units to base SI units
- `to_u(value, to_units)`: Convert a value (or an iterable container of values) from base SI units to given units
- `convert(value, from_units, to_units)`: Convert a value (or an iterable container of values) from any units to another units of the same dimensionality
- `get_dimensionality(units)`: Get a dictionary-like representation of the dimensionality of units. This is useful for checking if two quantities can be converted to common units.

Example usage can be found in the [test file](https://github.com/bigladder/koozie/blob/master/test/test_koozie.py).

*koozie* also provides a command line utility for unit conversions:

```
Usage: koozie [OPTIONS] VALUE FROM_UNITS [TO_UNITS]

  koozie: Convert VALUE from FROM_UNITS to TO_UNITS.

  If TO_UNITS is not specified, VALUE will be converted from FROM_UNITS into
  base SI units.

Options:
  -v, --version    Show the version and exit.
  -l, --list TEXT  Print a list of available units by dimension (e.g.,
                   "power"). Default: list all units.
  -h, --help       Show this message and exit.
```

Example usage:

```
$ koozie 1 inch meter
> 0.0254 m

$ koozie 0 degC degF
> 31.999999999999936 °F

$ koozie 0 degC
> 273.15 K

$ koozie -l flow
> [length] ** 3 / [time] ([volumetric_flow_rate])
  -----------------------------------------------
    - cubic_feet_per_minute (cfm)
    - gallons_per_minute (gpm)

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bigladder/koozie",
    "name": "koozie",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "units",
    "author": "Big Ladder Software",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0f/f8/a89c3ccbd89db125a1c17ee4a1a73c81f93a93463bf1de84450fcbe50b8a/koozie-1.2.4.tar.gz",
    "platform": null,
    "description": "[![Release](https://img.shields.io/pypi/v/koozie.svg)](https://pypi.python.org/pypi/koozie)\n\n[![Test](https://github.com/bigladder/koozie/actions/workflows/test.yaml/badge.svg)](https://github.com/bigladder/koozie/actions/workflows/test.yaml)\n\nkoozie\n======\n\n*koozie* is a light-weight wrapper around [*pint*](https://pint.readthedocs.io/en/stable/) for unit conversions. The intent is to provide much of the functionality without worrying about the setup. It uses quantities internally, but its functions only return floats. This approach reflects the opinion that all calculations should be performed in Standard base SI units, and any conversions can happen via pre- or post-processing for usability. This minimizes additional operations in performance critical code.\n\n*koozie* also defines a few convenient aliases for different units. See the [source code](https://github.com/bigladder/koozie/blob/master/koozie/koozie.py) for details. A list of other available units is defined in [pint's default units definition file](https://github.com/hgrecco/pint/blob/master/pint/default_en.txt).\n\nThere are four public functions in *koozie*:\n\n- `fr_u(value, from_units)`: Convert a value (or an iterable container of values) from given units to base SI units\n- `to_u(value, to_units)`: Convert a value (or an iterable container of values) from base SI units to given units\n- `convert(value, from_units, to_units)`: Convert a value (or an iterable container of values) from any units to another units of the same dimensionality\n- `get_dimensionality(units)`: Get a dictionary-like representation of the dimensionality of units. This is useful for checking if two quantities can be converted to common units.\n\nExample usage can be found in the [test file](https://github.com/bigladder/koozie/blob/master/test/test_koozie.py).\n\n*koozie* also provides a command line utility for unit conversions:\n\n```\nUsage: koozie [OPTIONS] VALUE FROM_UNITS [TO_UNITS]\n\n  koozie: Convert VALUE from FROM_UNITS to TO_UNITS.\n\n  If TO_UNITS is not specified, VALUE will be converted from FROM_UNITS into\n  base SI units.\n\nOptions:\n  -v, --version    Show the version and exit.\n  -l, --list TEXT  Print a list of available units by dimension (e.g.,\n                   \"power\"). Default: list all units.\n  -h, --help       Show this message and exit.\n```\n\nExample usage:\n\n```\n$ koozie 1 inch meter\n> 0.0254 m\n\n$ koozie 0 degC degF\n> 31.999999999999936 \u00b0F\n\n$ koozie 0 degC\n> 273.15 K\n\n$ koozie -l flow\n> [length] ** 3 / [time] ([volumetric_flow_rate])\n  -----------------------------------------------\n    - cubic_feet_per_minute (cfm)\n    - gallons_per_minute (gpm)\n\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3",
    "summary": "A light-weight wrapper around pint for unit conversions.",
    "version": "1.2.4",
    "project_urls": {
        "Homepage": "https://github.com/bigladder/koozie",
        "Repository": "https://github.com/bigladder/koozie"
    },
    "split_keywords": [
        "units"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "13139cfc1d9d3d80c010d05387e891acc450f5c8fcb911eb10728351681664e0",
                "md5": "618aee87c627f73f93669be54aa7bdb0",
                "sha256": "9996206c7ef67d09ad7e4a66271e1e60217a2d97e65431bd3d5ef2d3c3623e25"
            },
            "downloads": -1,
            "filename": "koozie-1.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "618aee87c627f73f93669be54aa7bdb0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 6372,
            "upload_time": "2024-12-21T00:35:06",
            "upload_time_iso_8601": "2024-12-21T00:35:06.716699Z",
            "url": "https://files.pythonhosted.org/packages/13/13/9cfc1d9d3d80c010d05387e891acc450f5c8fcb911eb10728351681664e0/koozie-1.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ff8a89c3ccbd89db125a1c17ee4a1a73c81f93a93463bf1de84450fcbe50b8a",
                "md5": "4e03286070ea5874dbcd00791e20980e",
                "sha256": "53c7f67263e3040b6ed62fcf600ad747f8deb858b08195ad22c77c6746b8e290"
            },
            "downloads": -1,
            "filename": "koozie-1.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "4e03286070ea5874dbcd00791e20980e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 5078,
            "upload_time": "2024-12-21T00:35:08",
            "upload_time_iso_8601": "2024-12-21T00:35:08.449216Z",
            "url": "https://files.pythonhosted.org/packages/0f/f8/a89c3ccbd89db125a1c17ee4a1a73c81f93a93463bf1de84450fcbe50b8a/koozie-1.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-21 00:35:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bigladder",
    "github_project": "koozie",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "koozie"
}
        
Elapsed time: 0.41735s