unic


Nameunic JSON
Version 0.4.3 PyPI version JSON
download
home_pagehttps://github.com/subretu/unic
SummaryPython package for converting various units.
upload_time2024-02-09 13:35:28
maintainerSubretu
docs_urlNone
authorSubretu
requires_python>=3.8,<4.0
licenseMIT
keywords unit convert time timestamp length
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Python minimum version](https://img.shields.io/badge/Python-3.8%2B-brightgreen)
[![pytest](https://github.com/subretu/unic/actions/workflows/pytest.yml/badge.svg)](https://github.com/subretu/unic/actions/workflows/pytest.yml)
[![black](https://github.com/subretu/unic/actions/workflows/format.yml/badge.svg)](https://github.com/subretu/unic/actions/workflows/format.yml)

# unic
  `unic` is a python package that can convert various units.

## Conversion Targets
- The current available conversion targets are as follows.

  <details>
  <summary>Time Unit</summary>

    - TimeModel
      - minute / second / milisecond → hour
      - hour / second / milisecond → minute
      - hour / minute / milisecond → second
      - hour / minute / second → milisecond
    - DatetimeModel
      - unixtime / unixtime+timezone → datetime.datetime
      - unixtime / unixtime+timezone → datetime.date
    - UnixtimeModel
      - string(yyyy-mm-dd hh:mm:ss) / string(yyyy-mm-dd hh:mm:ss)+timezone → unixtime
  </details>

  <details>
  <summary>Length Unit</summary>

    - MetricSystemModel
      -  Target Metric System Units

         ```
         nm, um*, mm, cm, m, km, Mm, Gm, Tm
         ```
         ※ um represents ㎛.
       -  The target metric system units are can be converted to each other.

  </details>

## Installing

  ```
  pip install unic
  ```

## How to
- See the [UserGuide](docs/UserGuide.md).

## Example
### Time Unit
#### TimeModel

```python
import unic


convert_model = unic.load_model("time")
# Convert hour to minute
convert_min = convert_model.convert(2, from_unit="hour", to_unit="min")
```

#### DatetimeModel

```python
import unic


convert_model = unic.load_model("datetime")
# Convert to datatime
convert_datetime = convert_model.convert(1577841753, format="datetime")
# Convert to date
convert_datetime = convert_model.convert(1577841753, format="date")
```

#### UnixtimeModel

```python
import unic


convert_model = unic.load_model("unixtime")
# Specify time zone
convert_unixtime = convert_model.convert("2023-05-12 10:15:20", tz="Asia/Tokyo")
```

### Length Unit
#### MetricSystemModel

```python
import unic


convert_model = unic.load_model("metric_system")
# Convert cm to m
convert_min = convert_model.convert(20, from_unit="cm", to_unit="m")
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/subretu/unic",
    "name": "unic",
    "maintainer": "Subretu",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "unit,convert,time,timestamp,length",
    "author": "Subretu",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ac/93/585a6c603cd7986de053637be9f550d6641c5725e8c577fd08ecaa76125b/unic-0.4.3.tar.gz",
    "platform": null,
    "description": "![Python minimum version](https://img.shields.io/badge/Python-3.8%2B-brightgreen)\n[![pytest](https://github.com/subretu/unic/actions/workflows/pytest.yml/badge.svg)](https://github.com/subretu/unic/actions/workflows/pytest.yml)\n[![black](https://github.com/subretu/unic/actions/workflows/format.yml/badge.svg)](https://github.com/subretu/unic/actions/workflows/format.yml)\n\n# unic\n  `unic` is a python package that can convert various units.\n\n## Conversion Targets\n- The current available conversion targets are as follows.\n\n  <details>\n  <summary>Time Unit</summary>\n\n    - TimeModel\n      - minute / second / milisecond \u2192 hour\n      - hour / second / milisecond \u2192 minute\n      - hour / minute / milisecond \u2192 second\n      - hour / minute / second \u2192 milisecond\n    - DatetimeModel\n      - unixtime / unixtime+timezone \u2192 datetime.datetime\n      - unixtime / unixtime+timezone \u2192 datetime.date\n    - UnixtimeModel\n      - string(yyyy-mm-dd hh:mm:ss) / string(yyyy-mm-dd hh:mm:ss)+timezone \u2192 unixtime\n  </details>\n\n  <details>\n  <summary>Length Unit</summary>\n\n    - MetricSystemModel\n      -  Target Metric System Units\n\n         ```\n         nm, um*, mm, cm, m, km, Mm, Gm, Tm\n         ```\n         \u203b um represents \u339b.\n       -  The target metric system units are can be converted to each other.\n\n  </details>\n\n## Installing\n\n  ```\n  pip install unic\n  ```\n\n## How to\n- See the [UserGuide](docs/UserGuide.md).\n\n## Example\n### Time Unit\n#### TimeModel\n\n```python\nimport unic\n\n\nconvert_model = unic.load_model(\"time\")\n# Convert hour to minute\nconvert_min = convert_model.convert(2, from_unit=\"hour\", to_unit=\"min\")\n```\n\n#### DatetimeModel\n\n```python\nimport unic\n\n\nconvert_model = unic.load_model(\"datetime\")\n# Convert to datatime\nconvert_datetime = convert_model.convert(1577841753, format=\"datetime\")\n# Convert to date\nconvert_datetime = convert_model.convert(1577841753, format=\"date\")\n```\n\n#### UnixtimeModel\n\n```python\nimport unic\n\n\nconvert_model = unic.load_model(\"unixtime\")\n# Specify time zone\nconvert_unixtime = convert_model.convert(\"2023-05-12 10:15:20\", tz=\"Asia/Tokyo\")\n```\n\n### Length Unit\n#### MetricSystemModel\n\n```python\nimport unic\n\n\nconvert_model = unic.load_model(\"metric_system\")\n# Convert cm to m\nconvert_min = convert_model.convert(20, from_unit=\"cm\", to_unit=\"m\")\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python package for converting various units.",
    "version": "0.4.3",
    "project_urls": {
        "Homepage": "https://github.com/subretu/unic",
        "Repository": "https://github.com/subretu/unic"
    },
    "split_keywords": [
        "unit",
        "convert",
        "time",
        "timestamp",
        "length"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d41ed41f105eaf9bbf12c71688c186115f048eb456382619d02a7d7b2f9a06a7",
                "md5": "fe58f87288955139280ca395f514291d",
                "sha256": "a5341adf476e1625c2f91442942fdc09caad6f2b17d953a771030b553b777b5f"
            },
            "downloads": -1,
            "filename": "unic-0.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fe58f87288955139280ca395f514291d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 9647,
            "upload_time": "2024-02-09T13:35:27",
            "upload_time_iso_8601": "2024-02-09T13:35:27.124144Z",
            "url": "https://files.pythonhosted.org/packages/d4/1e/d41f105eaf9bbf12c71688c186115f048eb456382619d02a7d7b2f9a06a7/unic-0.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac93585a6c603cd7986de053637be9f550d6641c5725e8c577fd08ecaa76125b",
                "md5": "70cd812bc87014aa7db8efc920b2eebb",
                "sha256": "9a19182265f077173aa9b319f2dfa61ef9f3a04b39b50920b4fd645a8be90b85"
            },
            "downloads": -1,
            "filename": "unic-0.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "70cd812bc87014aa7db8efc920b2eebb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 7008,
            "upload_time": "2024-02-09T13:35:28",
            "upload_time_iso_8601": "2024-02-09T13:35:28.251590Z",
            "url": "https://files.pythonhosted.org/packages/ac/93/585a6c603cd7986de053637be9f550d6641c5725e8c577fd08ecaa76125b/unic-0.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-09 13:35:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "subretu",
    "github_project": "unic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "unic"
}
        
Elapsed time: 0.21577s