Skip to main content

Literal Enum

Project description

kwix

Developer Guide

Setup

# create conda environment
$ mamba env create -f env.yml

# update conda environment
$ mamba env update -n kwix --file env.yml

Install

pip install -e .

# install from pypi
pip install kwix

nbdev

# 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

# 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:

$ pip install git+https://github.com/dsm-72/kwix.git

or from conda

$ conda install -c dsm-72 kwix

or from pypi

$ pip install kwix

Documentation

Documentation can be found hosted on GitHub repository pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

Toy Inheritance

@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
@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 can make it easy to know what these parameters are and easy to pass them accordingly

@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
@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
clstmap = SeabornClustermap()
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}
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'}
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}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kwix-0.0.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

kwix-0.0.5-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file kwix-0.0.5.tar.gz.

File metadata

  • Download URL: kwix-0.0.5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for kwix-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a4ca439e2f7bc7d8ce18e0a9bb8eb546a976ec583ff018a62cf56a93e275d16f
MD5 fd94e20b581d29ef4ab13cd22c9ba861
BLAKE2b-256 34ebe06da86431667e1c0bfb5736234aaf51e505f8e8c901d8c55fce92487a11

See more details on using hashes here.

File details

Details for the file kwix-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: kwix-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for kwix-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c034066dbd28651d8323dc35e8fd280b610e7adb4689a0e8607ecc7a2dd5d924
MD5 54b8898255662e99e704d1ae0040738d
BLAKE2b-256 2a2fc191b7fea0a6203576a3c78e8c9c5c41c44976e4a94d656ea131ce743e02

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page