dynattr


Namedynattr JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/dsm-72/dynattr
SummaryDynamic Attributes Mixin
upload_time2023-09-09 20:20:19
maintainer
docs_urlNone
authordsm-72
requires_python>=3.11
licenseApache Software License 2.0
keywords nbdev jupyter notebook python attr dyn dynattr
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # dynattr

<!-- 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 dynattr --file env.yml
```

### Install

``` sh
pip install -e .

# install from pypi
pip install dynattr
```

### nbdev

``` sh
# activate conda environment
$ conda activate dynattr

# make sure the dynattr package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to the dynattr 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/dynattr):

``` sh
$ pip install git+https://github.com/dsm-72/dynattr.git
```

or from [conda](https://anaconda.org/dsm-72/dynattr)

``` sh
$ conda install -c dsm-72 dynattr
```

or from [pypi](https://pypi.org/project/dynattr/)

``` sh
$ pip install dynattr
```

## Documentation

Documentation can be found hosted on GitHub
[repository](https://github.com/dsm-72/dynattr)
[pages](https://dsm-72.github.io/dynattr/). Additionally you can find
package manager specific guidelines on
[conda](https://anaconda.org/dsm-72/dynattr) and
[pypi](https://pypi.org/project/dynattr/) respectively.

## Example

``` python
from atyp import StrQ
from typing import ClassVar
class Foo(DynamicAttributesMixin):
    X: str = 'X'
    x: str = 'X'
    Z: ClassVar[str] = 'Z'

    toinstname = lambda x: f'_{x}'
    totypename = lambda x: x.upper()

    def __init__(self, x: StrQ = None):
        self.x = (x or self.x)

f, b = Foo(x='x'), Foo()
```

``` python
(f.x, f.X, f.Z), (b.x, b.X, b.Z), (Foo.x, Foo.X, Foo.Z, )
```

    (('x', 'X', 'Z'), ('X', 'X', 'Z'), ('X', 'X', 'Z'))

``` python
f.getinstclsattr('x', toinstname=None, totypename=None)
```

    'X'

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dsm-72/dynattr",
    "name": "dynattr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "nbdev jupyter notebook python attr dyn dynattr",
    "author": "dsm-72",
    "author_email": "sumner.magruder@yale.edu",
    "download_url": "https://files.pythonhosted.org/packages/e5/27/20527c22176c0ee44e88c31350b2a517bfa952d97b5a8391c74a1ce45c2e/dynattr-0.0.5.tar.gz",
    "platform": null,
    "description": "# dynattr\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 dynattr --file env.yml\n```\n\n### Install\n\n``` sh\npip install -e .\n\n# install from pypi\npip install dynattr\n```\n\n### nbdev\n\n``` sh\n# activate conda environment\n$ conda activate dynattr\n\n# make sure the dynattr 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 dynattr 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/dynattr):\n\n``` sh\n$ pip install git+https://github.com/dsm-72/dynattr.git\n```\n\nor from [conda](https://anaconda.org/dsm-72/dynattr)\n\n``` sh\n$ conda install -c dsm-72 dynattr\n```\n\nor from [pypi](https://pypi.org/project/dynattr/)\n\n``` sh\n$ pip install dynattr\n```\n\n## Documentation\n\nDocumentation can be found hosted on GitHub\n[repository](https://github.com/dsm-72/dynattr)\n[pages](https://dsm-72.github.io/dynattr/). Additionally you can find\npackage manager specific guidelines on\n[conda](https://anaconda.org/dsm-72/dynattr) and\n[pypi](https://pypi.org/project/dynattr/) respectively.\n\n## Example\n\n``` python\nfrom atyp import StrQ\nfrom typing import ClassVar\nclass Foo(DynamicAttributesMixin):\n    X: str = 'X'\n    x: str = 'X'\n    Z: ClassVar[str] = 'Z'\n\n    toinstname = lambda x: f'_{x}'\n    totypename = lambda x: x.upper()\n\n    def __init__(self, x: StrQ = None):\n        self.x = (x or self.x)\n\nf, b = Foo(x='x'), Foo()\n```\n\n``` python\n(f.x, f.X, f.Z), (b.x, b.X, b.Z), (Foo.x, Foo.X, Foo.Z, )\n```\n\n    (('x', 'X', 'Z'), ('X', 'X', 'Z'), ('X', 'X', 'Z'))\n\n``` python\nf.getinstclsattr('x', toinstname=None, totypename=None)\n```\n\n    'X'\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Dynamic Attributes Mixin",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/dsm-72/dynattr"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python",
        "attr",
        "dyn",
        "dynattr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63435bb9448dba925fbd572ca979bacecf3d692c2d85c7f24e4b8b44cfa0c389",
                "md5": "63bbc8c288d7a1ba68c157e0975bd297",
                "sha256": "1febf3ec9f1ae1d4d923b86872ee501489bd14355d560abf1fc4c355c68d4b23"
            },
            "downloads": -1,
            "filename": "dynattr-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "63bbc8c288d7a1ba68c157e0975bd297",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 8859,
            "upload_time": "2023-09-09T20:20:17",
            "upload_time_iso_8601": "2023-09-09T20:20:17.455703Z",
            "url": "https://files.pythonhosted.org/packages/63/43/5bb9448dba925fbd572ca979bacecf3d692c2d85c7f24e4b8b44cfa0c389/dynattr-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e52720527c22176c0ee44e88c31350b2a517bfa952d97b5a8391c74a1ce45c2e",
                "md5": "a19f20a661d581c0de82a24b01fd65d1",
                "sha256": "50d7265b51f36f95e28e4d5a80adeadcef58641971516d6e9cb22ed57d4057e4"
            },
            "downloads": -1,
            "filename": "dynattr-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a19f20a661d581c0de82a24b01fd65d1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 9336,
            "upload_time": "2023-09-09T20:20:19",
            "upload_time_iso_8601": "2023-09-09T20:20:19.291149Z",
            "url": "https://files.pythonhosted.org/packages/e5/27/20527c22176c0ee44e88c31350b2a517bfa952d97b5a8391c74a1ce45c2e/dynattr-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-09 20:20:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dsm-72",
    "github_project": "dynattr",
    "github_not_found": true,
    "lcname": "dynattr"
}
        
Elapsed time: 0.10953s