whatis


Namewhatis JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummaryA small Python utility to tell you what an object is
upload_time2023-12-10 16:04:30
maintainer
docs_urlNone
author
requires_python>=3.5
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WhatIs package

Gives a concise summary of any object's structure and avoids accidentally printing a huge object to stdout.

Works with various libraries (NumPy, PyTorch etc.) via duck typing.

## Examples
`whatis` is useful for inspecting large objects quickly:
```python
>> x = list(enumerate(range(7,4129,3)))
>> x
# ... (veeery large output) ...
>> whatis(x)
list len=1374
  ├ tuple len=2
  │  ├ 0: int
  │  └ 7: int
  │
  ├ tuple len=2
  │  ├ 1: int
  │  └ 10: int
  │
  ├ tuple len=2
  │  ├ 2: int
  │  └ 13: int
  │
  ├ tuple len=2
  │  ├ 3: int
  │  └ 16: int
  │
  └ ...
>>
```
And makes it easy to view the format of objects like this
```python
>>> x = np.ones((5, 5))
>>> out = np.linalg.eig(x)
>>> out
# A lot of information...
(array([5.00000000e+00, 5.65333918e-49, 0.00000000e+00, 0.00000000e+00,
       1.73014109e-64]), array([[-4.47213595e-01,  1.13586253e-16,  1.13586253e-16,
         1.38161505e-31, -1.11062157e-16],
       [-4.47213595e-01,  8.66025404e-01,  8.66025404e-01,
         1.05339661e-15, -8.46780726e-01],
       [-4.47213595e-01, -2.88675135e-01, -2.88675135e-01,
        -2.39769783e-16,  1.11088069e-01],
       [-4.47213595e-01, -2.88675135e-01, -2.88675135e-01,
        -7.07106781e-01,  3.67846328e-01],
       [-4.47213595e-01, -2.88675135e-01, -2.88675135e-01,
         7.07106781e-01,  3.67846328e-01]]))

>> whatis(out)
tuple len=2
  ├ ndarray shape=(5,) dtype=float64
  └ ndarray shape=(5, 5) dtype=float64
>>
```
or this
```python
>> x = torch.randn((103, 75))
>> out = torch.topk(x, 5)
# what's the format of the output again..?
>> out
# ... (very large output) ...
>> whatis(out)
topk len=2
  ├ Tensor shape=torch.Size([103, 5]) dtype=torch.float32 device=cpu
  └ Tensor shape=torch.Size([103, 5]) dtype=torch.int64 device=cpu
>>
```

## Usage
```python
from whatis import whatis
```

## Setup
```pip install whatis```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "whatis",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "",
    "author": "",
    "author_email": "Zak Buzzard <zakbuzzard1@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d5/37/3baf1a7c569eacbfa0c6108ab57b1b40c92f0aa57d23386842b05f56f997/whatis-0.0.1.tar.gz",
    "platform": null,
    "description": "# WhatIs package\r\n\r\nGives a concise summary of any object's structure and avoids accidentally printing a huge object to stdout.\r\n\r\nWorks with various libraries (NumPy, PyTorch etc.) via duck typing.\r\n\r\n## Examples\r\n`whatis` is useful for inspecting large objects quickly:\r\n```python\r\n>> x = list(enumerate(range(7,4129,3)))\r\n>> x\r\n# ... (veeery large output) ...\r\n>> whatis(x)\r\nlist len=1374\r\n  \u251c tuple len=2\r\n  \u2502  \u251c 0: int\r\n  \u2502  \u2514 7: int\r\n  \u2502\r\n  \u251c tuple len=2\r\n  \u2502  \u251c 1: int\r\n  \u2502  \u2514 10: int\r\n  \u2502\r\n  \u251c tuple len=2\r\n  \u2502  \u251c 2: int\r\n  \u2502  \u2514 13: int\r\n  \u2502\r\n  \u251c tuple len=2\r\n  \u2502  \u251c 3: int\r\n  \u2502  \u2514 16: int\r\n  \u2502\r\n  \u2514 ...\r\n>>\r\n```\r\nAnd makes it easy to view the format of objects like this\r\n```python\r\n>>> x = np.ones((5, 5))\r\n>>> out = np.linalg.eig(x)\r\n>>> out\r\n# A lot of information...\r\n(array([5.00000000e+00, 5.65333918e-49, 0.00000000e+00, 0.00000000e+00,\r\n       1.73014109e-64]), array([[-4.47213595e-01,  1.13586253e-16,  1.13586253e-16,\r\n         1.38161505e-31, -1.11062157e-16],\r\n       [-4.47213595e-01,  8.66025404e-01,  8.66025404e-01,\r\n         1.05339661e-15, -8.46780726e-01],\r\n       [-4.47213595e-01, -2.88675135e-01, -2.88675135e-01,\r\n        -2.39769783e-16,  1.11088069e-01],\r\n       [-4.47213595e-01, -2.88675135e-01, -2.88675135e-01,\r\n        -7.07106781e-01,  3.67846328e-01],\r\n       [-4.47213595e-01, -2.88675135e-01, -2.88675135e-01,\r\n         7.07106781e-01,  3.67846328e-01]]))\r\n\r\n>> whatis(out)\r\ntuple len=2\r\n  \u251c ndarray shape=(5,) dtype=float64\r\n  \u2514 ndarray shape=(5, 5) dtype=float64\r\n>>\r\n```\r\nor this\r\n```python\r\n>> x = torch.randn((103, 75))\r\n>> out = torch.topk(x, 5)\r\n# what's the format of the output again..?\r\n>> out\r\n# ... (very large output) ...\r\n>> whatis(out)\r\ntopk len=2\r\n  \u251c Tensor shape=torch.Size([103, 5]) dtype=torch.float32 device=cpu\r\n  \u2514 Tensor shape=torch.Size([103, 5]) dtype=torch.int64 device=cpu\r\n>>\r\n```\r\n\r\n## Usage\r\n```python\r\nfrom whatis import whatis\r\n```\r\n\r\n## Setup\r\n```pip install whatis```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A small Python utility to tell you what an object is",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/zzbuzzard/whatis",
        "Issues": "https://github.com/zzbuzzard/whatis/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74987a12621c1986c68731dc86a7cc67e92420219aa6d10274452ddb8dc532af",
                "md5": "5ec1f9cfff452b9a346dc43e09a64662",
                "sha256": "6878854817e3c758975d703f3ccc50c031146a6398fc20b16c3e453f2e5575c4"
            },
            "downloads": -1,
            "filename": "whatis-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5ec1f9cfff452b9a346dc43e09a64662",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 5495,
            "upload_time": "2023-12-10T16:04:29",
            "upload_time_iso_8601": "2023-12-10T16:04:29.134133Z",
            "url": "https://files.pythonhosted.org/packages/74/98/7a12621c1986c68731dc86a7cc67e92420219aa6d10274452ddb8dc532af/whatis-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d5373baf1a7c569eacbfa0c6108ab57b1b40c92f0aa57d23386842b05f56f997",
                "md5": "1f51579cd7b058103299ce06afe1b199",
                "sha256": "05dac2ba6bf06fe9c2879a0c1878119c7338f1f5072a62dcbd36ee51685ea46c"
            },
            "downloads": -1,
            "filename": "whatis-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1f51579cd7b058103299ce06afe1b199",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 6060,
            "upload_time": "2023-12-10T16:04:30",
            "upload_time_iso_8601": "2023-12-10T16:04:30.936699Z",
            "url": "https://files.pythonhosted.org/packages/d5/37/3baf1a7c569eacbfa0c6108ab57b1b40c92f0aa57d23386842b05f56f997/whatis-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-10 16:04:30",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zzbuzzard",
    "github_project": "whatis",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "whatis"
}
        
Elapsed time: 0.15703s