# kwix
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Developer Guide
### Setup
``` sh
# create conda environment
$ mamba env create -f env.yml
# update conda environment
$ mamba env update -n kwix --file env.yml
```
### Install
``` sh
pip install -e .
# install from pypi
pip install kwix
```
### nbdev
``` sh
# activate conda environment
$ conda activate kwix
# make sure the kwix package is installed in development mode
$ pip install -e .
# make changes under nbs/ directory
# ...
# compile to have changes apply to the kwix package
$ nbdev_prepare
```
### Publishing
``` sh
# publish to pypi
$ nbdev_pypi
# publish to conda
$ nbdev_conda --build_args '-c conda-forge'
$ nbdev_conda --mambabuild --build_args '-c conda-forge -c dsm-72'
```
# Usage
## Installation
Install latest from the GitHub
[repository](https://github.com/dsm-72/kwix):
``` sh
$ pip install git+https://github.com/dsm-72/kwix.git
```
or from [conda](https://anaconda.org/dsm-72/kwix)
``` sh
$ conda install -c dsm-72 kwix
```
or from [pypi](https://pypi.org/project/kwix/)
``` sh
$ pip install kwix
```
## Documentation
Documentation can be found hosted on GitHub
[repository](https://github.com/dsm-72/kwix)
[pages](https://dsm-72.github.io/kwix/). Additionally you can find
package manager specific guidelines on
[conda](https://anaconda.org/dsm-72/kwix) and
[pypi](https://pypi.org/project/kwix/) respectively.
## Toy Inheritance
``` python
@dataclass
class Foo(KWix):
_: KW_ONLY
a: int = 1
b: int = 2
c: int = 3
@dataclass
class Qux(KWix):
_: KW_ONLY
q: str = -2
u: str = -1
x: int = 0
```
``` python
@dataclass
class Bar(Foo):
_: KW_ONLY
x: int = 7
y: int = 8
z: int = 9
@dataclass
class Baz(Bar, Qux):
_: KW_ONLY
a: int = 6
b: int = 7
q: int = 0
@dataclass
class Auz(Bar):
_: KW_ONLY
```
## Seaborn
Since Seaborn Clustermap passes all extra keyword-arguments to Heatmap
using [`KWix`](https://dsm-72.github.io/kwix/mixs.html#kwix) can make it
easy to know what these parameters are and easy to pass them accordingly
``` python
@dataclass
class SeabornHeatmap(KWix):
_: KW_ONLY
# heatmap parameters
vmin: Optional[float] = None
vmax: Optional[float] = None
cmap: Optional[str] = 'inferno'
center: Optional[float] = None
robust: bool = True
annot: Optional[bool] = None
fmt: Optional[str] = '.2g'
annot_kws: Optional[dict] = None
linewidths: Optional[float] = 0
linecolor: Optional[str] = 'white'
cbar: bool = True
cbar_kws: Optional[dict] = None
cbar_ax: Optional['Axes'] = None
square: bool = False
xticklabels: Union[bool, list, str, bool] = 'auto'
yticklabels: Union[bool, list, str, bool] = 'auto'
mask: Optional[Union['NPArray', 'DataFrame']] = None
ax: Optional['Axes'] = None
```
``` python
@dataclass
class SeabornClustermap(SeabornHeatmap, KWix):
_: KW_ONLY
# clustermap parameters
pivot_kws: Optional[dict] = None
method: 'LinkageMethod' = 'SINGLE'
metric: 'PDistMetric' = 'CORRELATION'
z_score: Optional[int] = 0
standard_scale: Optional[int] = None
figsize: Tuple[int, int] = (10, 10)
cbar_kws: Optional[dict] = None
row_cluster: bool = True
col_cluster: bool = True
row_linkage: Optional[dict] = None
col_linkage: Optional[dict] = None
row_colors: Optional[dict] = None
col_colors: Optional[dict] = None
mask: Optional[dict] = None
dendrogram_ratio: float = 0.2
colors_ratio: float = 0.03
cbar_pos: 'CBarPos' = (0.02, 0.8, 0.05, 0.18)
tree_kws: Optional[dict] = None
```
``` python
clstmap = SeabornClustermap()
```
``` python
clstmap.curvals()
```
{'cbar_kws': None,
'cbar_pos': (0.02, 0.8, 0.05, 0.18),
'col_cluster': True,
'col_colors': None,
'col_linkage': None,
'colors_ratio': 0.03,
'dendrogram_ratio': 0.2,
'figsize': (10, 10),
'mask': None,
'method': 'SINGLE',
'metric': 'CORRELATION',
'pivot_kws': None,
'row_cluster': True,
'row_colors': None,
'row_linkage': None,
'standard_scale': None,
'tree_kws': None,
'z_score': 0}
``` python
clstmap.inhvals()
```
{'annot': None,
'annot_kws': None,
'ax': None,
'cbar': True,
'cbar_ax': None,
'center': None,
'cmap': 'inferno',
'fmt': '.2g',
'linecolor': 'white',
'linewidths': 0,
'robust': True,
'square': False,
'vmax': None,
'vmin': None,
'xticklabels': 'auto',
'yticklabels': 'auto'}
``` python
clstmap.allvals()
```
{'annot': None,
'annot_kws': None,
'ax': None,
'cbar': True,
'cbar_ax': None,
'cbar_kws': None,
'cbar_pos': (0.02, 0.8, 0.05, 0.18),
'center': None,
'cmap': 'inferno',
'col_cluster': True,
'col_colors': None,
'col_linkage': None,
'colors_ratio': 0.03,
'dendrogram_ratio': 0.2,
'figsize': (10, 10),
'fmt': '.2g',
'linecolor': 'white',
'linewidths': 0,
'mask': None,
'method': 'SINGLE',
'metric': 'CORRELATION',
'pivot_kws': None,
'robust': True,
'row_cluster': True,
'row_colors': None,
'row_linkage': None,
'square': False,
'standard_scale': None,
'tree_kws': None,
'vmax': None,
'vmin': None,
'xticklabels': 'auto',
'yticklabels': 'auto',
'z_score': 0}
Raw data
{
"_id": null,
"home_page": "https://github.com/dsm-72/kwix",
"name": "kwix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "nbdev jupyter notebook python",
"author": "dsm-72",
"author_email": "sumner.magruder@yale.edu",
"download_url": "https://files.pythonhosted.org/packages/34/eb/e06da86431667e1c0bfb5736234aaf51e505f8e8c901d8c55fce92487a11/kwix-0.0.5.tar.gz",
"platform": null,
"description": "# kwix\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Developer Guide\n\n### Setup\n\n``` sh\n# create conda environment\n$ mamba env create -f env.yml\n\n# update conda environment\n$ mamba env update -n kwix --file env.yml\n```\n\n### Install\n\n``` sh\npip install -e .\n\n# install from pypi\npip install kwix\n```\n\n### nbdev\n\n``` sh\n# activate conda environment\n$ conda activate kwix\n\n# make sure the kwix package is installed in development mode\n$ pip install -e .\n\n# make changes under nbs/ directory\n# ...\n\n# compile to have changes apply to the kwix package\n$ nbdev_prepare\n```\n\n### Publishing\n\n``` sh\n# publish to pypi\n$ nbdev_pypi\n\n# publish to conda\n$ nbdev_conda --build_args '-c conda-forge'\n$ nbdev_conda --mambabuild --build_args '-c conda-forge -c dsm-72'\n```\n\n# Usage\n\n## Installation\n\nInstall latest from the GitHub\n[repository](https://github.com/dsm-72/kwix):\n\n``` sh\n$ pip install git+https://github.com/dsm-72/kwix.git\n```\n\nor from [conda](https://anaconda.org/dsm-72/kwix)\n\n``` sh\n$ conda install -c dsm-72 kwix\n```\n\nor from [pypi](https://pypi.org/project/kwix/)\n\n``` sh\n$ pip install kwix\n```\n\n## Documentation\n\nDocumentation can be found hosted on GitHub\n[repository](https://github.com/dsm-72/kwix)\n[pages](https://dsm-72.github.io/kwix/). Additionally you can find\npackage manager specific guidelines on\n[conda](https://anaconda.org/dsm-72/kwix) and\n[pypi](https://pypi.org/project/kwix/) respectively.\n\n## Toy Inheritance\n\n``` python\n@dataclass\nclass Foo(KWix):\n _: KW_ONLY\n a: int = 1\n b: int = 2\n c: int = 3\n\n@dataclass\nclass Qux(KWix):\n _: KW_ONLY\n q: str = -2\n u: str = -1\n x: int = 0\n```\n\n``` python\n@dataclass\nclass Bar(Foo):\n _: KW_ONLY\n x: int = 7\n y: int = 8\n z: int = 9\n\n@dataclass\nclass Baz(Bar, Qux):\n _: KW_ONLY\n a: int = 6\n b: int = 7\n q: int = 0\n\n@dataclass\nclass Auz(Bar):\n _: KW_ONLY\n```\n\n## Seaborn\n\nSince Seaborn Clustermap passes all extra keyword-arguments to Heatmap\nusing [`KWix`](https://dsm-72.github.io/kwix/mixs.html#kwix) can make it\neasy to know what these parameters are and easy to pass them accordingly\n\n``` python\n@dataclass\nclass SeabornHeatmap(KWix):\n _: KW_ONLY \n # heatmap parameters\n vmin: Optional[float] = None\n vmax: Optional[float] = None\n cmap: Optional[str] = 'inferno'\n center: Optional[float] = None\n robust: bool = True\n annot: Optional[bool] = None\n fmt: Optional[str] = '.2g'\n annot_kws: Optional[dict] = None\n linewidths: Optional[float] = 0\n linecolor: Optional[str] = 'white'\n cbar: bool = True\n cbar_kws: Optional[dict] = None\n cbar_ax: Optional['Axes'] = None\n square: bool = False\n xticklabels: Union[bool, list, str, bool] = 'auto'\n yticklabels: Union[bool, list, str, bool] = 'auto'\n mask: Optional[Union['NPArray', 'DataFrame']] = None\n ax: Optional['Axes'] = None\n```\n\n``` python\n@dataclass\nclass SeabornClustermap(SeabornHeatmap, KWix):\n _: KW_ONLY \n # clustermap parameters\n pivot_kws: Optional[dict] = None\n method: 'LinkageMethod' = 'SINGLE'\n metric: 'PDistMetric' = 'CORRELATION'\n z_score: Optional[int] = 0\n standard_scale: Optional[int] = None\n figsize: Tuple[int, int] = (10, 10)\n cbar_kws: Optional[dict] = None\n row_cluster: bool = True\n col_cluster: bool = True\n row_linkage: Optional[dict] = None\n col_linkage: Optional[dict] = None\n row_colors: Optional[dict] = None\n col_colors: Optional[dict] = None\n mask: Optional[dict] = None\n dendrogram_ratio: float = 0.2\n colors_ratio: float = 0.03\n cbar_pos: 'CBarPos' = (0.02, 0.8, 0.05, 0.18)\n tree_kws: Optional[dict] = None\n```\n\n``` python\nclstmap = SeabornClustermap()\n```\n\n``` python\nclstmap.curvals()\n```\n\n {'cbar_kws': None,\n 'cbar_pos': (0.02, 0.8, 0.05, 0.18),\n 'col_cluster': True,\n 'col_colors': None,\n 'col_linkage': None,\n 'colors_ratio': 0.03,\n 'dendrogram_ratio': 0.2,\n 'figsize': (10, 10),\n 'mask': None,\n 'method': 'SINGLE',\n 'metric': 'CORRELATION',\n 'pivot_kws': None,\n 'row_cluster': True,\n 'row_colors': None,\n 'row_linkage': None,\n 'standard_scale': None,\n 'tree_kws': None,\n 'z_score': 0}\n\n``` python\nclstmap.inhvals()\n```\n\n {'annot': None,\n 'annot_kws': None,\n 'ax': None,\n 'cbar': True,\n 'cbar_ax': None,\n 'center': None,\n 'cmap': 'inferno',\n 'fmt': '.2g',\n 'linecolor': 'white',\n 'linewidths': 0,\n 'robust': True,\n 'square': False,\n 'vmax': None,\n 'vmin': None,\n 'xticklabels': 'auto',\n 'yticklabels': 'auto'}\n\n``` python\nclstmap.allvals()\n```\n\n {'annot': None,\n 'annot_kws': None,\n 'ax': None,\n 'cbar': True,\n 'cbar_ax': None,\n 'cbar_kws': None,\n 'cbar_pos': (0.02, 0.8, 0.05, 0.18),\n 'center': None,\n 'cmap': 'inferno',\n 'col_cluster': True,\n 'col_colors': None,\n 'col_linkage': None,\n 'colors_ratio': 0.03,\n 'dendrogram_ratio': 0.2,\n 'figsize': (10, 10),\n 'fmt': '.2g',\n 'linecolor': 'white',\n 'linewidths': 0,\n 'mask': None,\n 'method': 'SINGLE',\n 'metric': 'CORRELATION',\n 'pivot_kws': None,\n 'robust': True,\n 'row_cluster': True,\n 'row_colors': None,\n 'row_linkage': None,\n 'square': False,\n 'standard_scale': None,\n 'tree_kws': None,\n 'vmax': None,\n 'vmin': None,\n 'xticklabels': 'auto',\n 'yticklabels': 'auto',\n 'z_score': 0}\n",
"bugtrack_url": null,
"license": "Apache Software License 2.0",
"summary": "Literal Enum",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/dsm-72/kwix"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a2fc191b7fea0a6203576a3c78e8c9c5c41c44976e4a94d656ea131ce743e02",
"md5": "54b8898255662e99e704d1ae0040738d",
"sha256": "c034066dbd28651d8323dc35e8fd280b610e7adb4689a0e8607ecc7a2dd5d924"
},
"downloads": -1,
"filename": "kwix-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54b8898255662e99e704d1ae0040738d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 10317,
"upload_time": "2024-03-24T17:09:21",
"upload_time_iso_8601": "2024-03-24T17:09:21.858138Z",
"url": "https://files.pythonhosted.org/packages/2a/2f/c191b7fea0a6203576a3c78e8c9c5c41c44976e4a94d656ea131ce743e02/kwix-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "34ebe06da86431667e1c0bfb5736234aaf51e505f8e8c901d8c55fce92487a11",
"md5": "fd94e20b581d29ef4ab13cd22c9ba861",
"sha256": "a4ca439e2f7bc7d8ce18e0a9bb8eb546a976ec583ff018a62cf56a93e275d16f"
},
"downloads": -1,
"filename": "kwix-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "fd94e20b581d29ef4ab13cd22c9ba861",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 10851,
"upload_time": "2024-03-24T17:09:23",
"upload_time_iso_8601": "2024-03-24T17:09:23.273003Z",
"url": "https://files.pythonhosted.org/packages/34/eb/e06da86431667e1c0bfb5736234aaf51e505f8e8c901d8c55fce92487a11/kwix-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-24 17:09:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dsm-72",
"github_project": "kwix",
"github_not_found": true,
"lcname": "kwix"
}