nbmask


Namenbmask JSON
Version 0.0.4 PyPI version JSON
download
home_page
SummaryIPython extension to mask sensitive data
upload_time2024-01-14 02:38:29
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords extension ipython notebook privacy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # IPython extension to mask sensitive data

Simple ipython extension to mask the username or other sensitive data
from notebook cell outputs.  It may be useful when printing
or displaying sensitive information in public notebooks.
The extension modifies the ipython display system to mask textual outputs
from printing, logging and the native display system.

## Usage

To load the extension use the magic command `%load_ext nbmask`. The extension will automatically
mask the notebook display textual outputs without any further magic commands. By default the
extension will mask the username.

```python
import os
import logging

from pathlib import Path

from IPython.display import display

logging.basicConfig(level="DEBUG", force=True)

%load_ext nbmask

username = os.getenv('USER')

print("My name is {username}!")
# >>> My name is ...!

documents = Path(f"/Users/{username}/Documents")
print(documents)
# >>> PosixPath('/Users/.../Documents')
```


You can add more secrets with the `%nbmask` magic line command
using the ipython automatic `$name` variable expansion.


```python
TOKEN = my_secret_token()

%nbmask "$TOKEN"

credentials = dict(user=username, token=TOKEN)

print(credentials)
# >>> {'user': '...', 'token': '...'}

logging.debug("Token is %s", TOKEN)
# >>> DEBUG:root:Token is ...

```

To mask `print` or `pprint` outputs the extension include a `%%masked` cell magic
but is is no longer and it will be removed.


## Example

See nbmask-tests.ipynb in `extras`

## Installation

You can install the current version of this package with pip

```console
pip install nbmask
```

## Changelog

### 0.0.4
- Cell magic `%%masked` is no longer needed. Will be removed

### 0.0.3
- Masking pattern is cached

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "nbmask",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "extension,ipython,notebook,privacy",
    "author": "",
    "author_email": "furechan <furechan@xsmail.com>",
    "download_url": "",
    "platform": null,
    "description": "# IPython extension to mask sensitive data\n\nSimple ipython extension to mask the username or other sensitive data\nfrom notebook cell outputs.  It may be useful when printing\nor displaying sensitive information in public notebooks.\nThe extension modifies the ipython display system to mask textual outputs\nfrom printing, logging and the native display system.\n\n## Usage\n\nTo load the extension use the magic command `%load_ext nbmask`. The extension will automatically\nmask the notebook display textual outputs without any further magic commands. By default the\nextension will mask the username.\n\n```python\nimport os\nimport logging\n\nfrom pathlib import Path\n\nfrom IPython.display import display\n\nlogging.basicConfig(level=\"DEBUG\", force=True)\n\n%load_ext nbmask\n\nusername = os.getenv('USER')\n\nprint(\"My name is {username}!\")\n# >>> My name is ...!\n\ndocuments = Path(f\"/Users/{username}/Documents\")\nprint(documents)\n# >>> PosixPath('/Users/.../Documents')\n```\n\n\nYou can add more secrets with the `%nbmask` magic line command\nusing the ipython automatic `$name` variable expansion.\n\n\n```python\nTOKEN = my_secret_token()\n\n%nbmask \"$TOKEN\"\n\ncredentials = dict(user=username, token=TOKEN)\n\nprint(credentials)\n# >>> {'user': '...', 'token': '...'}\n\nlogging.debug(\"Token is %s\", TOKEN)\n# >>> DEBUG:root:Token is ...\n\n```\n\nTo mask `print` or `pprint` outputs the extension include a `%%masked` cell magic\nbut is is no longer and it will be removed.\n\n\n## Example\n\nSee nbmask-tests.ipynb in `extras`\n\n## Installation\n\nYou can install the current version of this package with pip\n\n```console\npip install nbmask\n```\n\n## Changelog\n\n### 0.0.4\n- Cell magic `%%masked` is no longer needed. Will be removed\n\n### 0.0.3\n- Masking pattern is cached\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "IPython extension to mask sensitive data",
    "version": "0.0.4",
    "project_urls": {
        "homepage": "https://github.com/furechan/nbmask"
    },
    "split_keywords": [
        "extension",
        "ipython",
        "notebook",
        "privacy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c95f928229ca6627138db3467028452499fddbd4b2315efe3b22e4bca0b062b6",
                "md5": "3f371fdad997f3d7a061846137d2587e",
                "sha256": "e144338ad6817fc0b85847ff767af01d835cca1b9881704e7c03a566e085eccc"
            },
            "downloads": -1,
            "filename": "nbmask-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f371fdad997f3d7a061846137d2587e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4098,
            "upload_time": "2024-01-14T02:38:29",
            "upload_time_iso_8601": "2024-01-14T02:38:29.792641Z",
            "url": "https://files.pythonhosted.org/packages/c9/5f/928229ca6627138db3467028452499fddbd4b2315efe3b22e4bca0b062b6/nbmask-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-14 02:38:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "furechan",
    "github_project": "nbmask",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nbmask"
}
        
Elapsed time: 0.17192s