koozie


Namekoozie JSON
Version 1.2.3 PyPI version JSON
download
home_pagehttps://github.com/bigladder/koozie
SummaryA light-weight wrapper around pint for unit conversions.
upload_time2024-05-02 18:13:19
maintainerNone
docs_urlNone
authorBig Ladder Software
requires_python<4.0,>=3.8
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.8",
    "maintainer_email": null,
    "keywords": "units",
    "author": "Big Ladder Software",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/83/da/e9d0fedaa7e5bc3c34f2f5796dcd66d4a77af50f9e58eee01586a2a2ff51/koozie-1.2.3.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.3",
    "project_urls": {
        "Homepage": "https://github.com/bigladder/koozie",
        "Repository": "https://github.com/bigladder/koozie"
    },
    "split_keywords": [
        "units"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b50eaf49c92838f3dac0eafaf32eba3d9caf211a0189d42985efec26ebf077b8",
                "md5": "b5fea8c63ec09d6dce24433c1860b053",
                "sha256": "bdd9a14e99bdd5c6317dac13f3aca85a72a2fe6dfaa78bf6a7db489332053063"
            },
            "downloads": -1,
            "filename": "koozie-1.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b5fea8c63ec09d6dce24433c1860b053",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 6320,
            "upload_time": "2024-05-02T18:13:18",
            "upload_time_iso_8601": "2024-05-02T18:13:18.072391Z",
            "url": "https://files.pythonhosted.org/packages/b5/0e/af49c92838f3dac0eafaf32eba3d9caf211a0189d42985efec26ebf077b8/koozie-1.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83dae9d0fedaa7e5bc3c34f2f5796dcd66d4a77af50f9e58eee01586a2a2ff51",
                "md5": "2243aed8e325f2c2c633272718132106",
                "sha256": "e61b1eb3f7f8a4c231143a779b759bec2d7ddcaf3b2db3efad9c2cd0a9dd5379"
            },
            "downloads": -1,
            "filename": "koozie-1.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "2243aed8e325f2c2c633272718132106",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 5040,
            "upload_time": "2024-05-02T18:13:19",
            "upload_time_iso_8601": "2024-05-02T18:13:19.550267Z",
            "url": "https://files.pythonhosted.org/packages/83/da/e9d0fedaa7e5bc3c34f2f5796dcd66d4a77af50f9e58eee01586a2a2ff51/koozie-1.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-02 18:13:19",
    "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.26231s