prettyclass


Nameprettyclass JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/sonntagsgesicht/prettyclass
Summarypretty classes - pretty easy. (created by auxilium)
upload_time2024-10-07 17:40:04
maintainerNone
docs_urlNone
authorsonntagsgesicht
requires_pythonNone
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements auxilium
Travis-CI No Travis.
coveralls test coverage No coveralls.
            

.. image:: logo.png


Python Project *prettyclass*
----------------------------


.. image:: https://github.com/sonntagsgesicht/prettyclass/actions/workflows/python-package.yml/badge.svg
    :target: https://github.com/sonntagsgesicht/prettyclass/actions/workflows/python-package.yml
    :alt: GitHubWorkflow

.. image:: https://img.shields.io/readthedocs/prettyclass
   :target: http://prettyclass.readthedocs.io
   :alt: Read the Docs

.. image:: https://img.shields.io/github/license/sonntagsgesicht/prettyclass
   :target: https://github.com/sonntagsgesicht/prettyclass/raw/master/LICENSE
   :alt: GitHub

.. image:: https://img.shields.io/github/release/sonntagsgesicht/prettyclass?label=github
   :target: https://github.com/sonntagsgesicht/prettyclass/releases
   :alt: GitHub release

.. image:: https://img.shields.io/pypi/v/prettyclass
   :target: https://pypi.org/project/prettyclass/
   :alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/prettyclass
   :target: https://pypi.org/project/prettyclass/
   :alt: PyPI - Python Version

.. image:: https://pepy.tech/badge/prettyclass
   :target: https://pypi.org/project/prettyclass/
   :alt: PyPI Downloads


Introduction
------------

To import the project simply type

.. code-block:: python

    >>> import prettyclass

after installation.


.. code-block:: python

    >>> from prettyclass import prettyclass

    >>> @prettyclass()
    ... class ABC:
    ...     def __init__(self, a, *b, c, d=1, e, **f):
    ...         '''creates ABC instance'''

The decorator adds automaticly all argument fields as attributes.

.. code-block:: python

    >>> abc = ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')
    >>> abc.__dict__
    {'a': 1, 'b': (2, [3, 4]), 'c': 5, 'd': 6, 'e': 7, 'f': {'g': 'A', 'h': 'B'}}

    >>> abc.a, abc.b, abc.c, abc.d, abc.e, abc.f
    (1, (2, [3, 4]), 5, 6, 7, {'g': 'A', 'h': 'B'})

and returns a pretty nice representation of an instance

.. code-block:: python

    >>> abc
    ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')

Note the difference between 'str' and 'repr'

.. code-block:: python

    >>> str(abc)
    'ABC(1, 2, [3, 4], c=5, d=6, e=7, g=A, h=B)'

    >>> repr(abc)
    "ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')"

Copy works by default, too.

.. code-block:: python

    >>> from copy import copy
    >>> copy(abc)
    ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')


Note, the string representation commits entries
which coincide with defaults

.. code-block:: python

    >>> ABC(1, 2, [3, 4], c=5, d=1, e=7, g='A', h='B')
    ABC(1, 2, [3, 4], c=5, e=7, g='A', h='B')


Documentation
-------------

More documentation available at
`https://prettyclass.readthedocs.io <https://prettyclass.readthedocs.io>`_


Install
-------

The latest stable version can always be installed or updated via pip:

.. code-block:: bash

    $ pip install prettyclass


License
-------

Code and documentation are available according to the license
(see LICENSE file in repository).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sonntagsgesicht/prettyclass",
    "name": "prettyclass",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "sonntagsgesicht",
    "author_email": "sonntagsgesicht@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/4f/fb/a6325d0374dbf5b2ce2a87bfe7fb03bf7f316de40e8716d6eb0ad7a1e59f/prettyclass-0.1.1.zip",
    "platform": "any",
    "description": "\n\n.. image:: logo.png\n\n\nPython Project *prettyclass*\n----------------------------\n\n\n.. image:: https://github.com/sonntagsgesicht/prettyclass/actions/workflows/python-package.yml/badge.svg\n    :target: https://github.com/sonntagsgesicht/prettyclass/actions/workflows/python-package.yml\n    :alt: GitHubWorkflow\n\n.. image:: https://img.shields.io/readthedocs/prettyclass\n   :target: http://prettyclass.readthedocs.io\n   :alt: Read the Docs\n\n.. image:: https://img.shields.io/github/license/sonntagsgesicht/prettyclass\n   :target: https://github.com/sonntagsgesicht/prettyclass/raw/master/LICENSE\n   :alt: GitHub\n\n.. image:: https://img.shields.io/github/release/sonntagsgesicht/prettyclass?label=github\n   :target: https://github.com/sonntagsgesicht/prettyclass/releases\n   :alt: GitHub release\n\n.. image:: https://img.shields.io/pypi/v/prettyclass\n   :target: https://pypi.org/project/prettyclass/\n   :alt: PyPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/prettyclass\n   :target: https://pypi.org/project/prettyclass/\n   :alt: PyPI - Python Version\n\n.. image:: https://pepy.tech/badge/prettyclass\n   :target: https://pypi.org/project/prettyclass/\n   :alt: PyPI Downloads\n\n\nIntroduction\n------------\n\nTo import the project simply type\n\n.. code-block:: python\n\n    >>> import prettyclass\n\nafter installation.\n\n\n.. code-block:: python\n\n    >>> from prettyclass import prettyclass\n\n    >>> @prettyclass()\n    ... class ABC:\n    ...     def __init__(self, a, *b, c, d=1, e, **f):\n    ...         '''creates ABC instance'''\n\nThe decorator adds automaticly all argument fields as attributes.\n\n.. code-block:: python\n\n    >>> abc = ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')\n    >>> abc.__dict__\n    {'a': 1, 'b': (2, [3, 4]), 'c': 5, 'd': 6, 'e': 7, 'f': {'g': 'A', 'h': 'B'}}\n\n    >>> abc.a, abc.b, abc.c, abc.d, abc.e, abc.f\n    (1, (2, [3, 4]), 5, 6, 7, {'g': 'A', 'h': 'B'})\n\nand returns a pretty nice representation of an instance\n\n.. code-block:: python\n\n    >>> abc\n    ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')\n\nNote the difference between 'str' and 'repr'\n\n.. code-block:: python\n\n    >>> str(abc)\n    'ABC(1, 2, [3, 4], c=5, d=6, e=7, g=A, h=B)'\n\n    >>> repr(abc)\n    \"ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')\"\n\nCopy works by default, too.\n\n.. code-block:: python\n\n    >>> from copy import copy\n    >>> copy(abc)\n    ABC(1, 2, [3, 4], c=5, d=6, e=7, g='A', h='B')\n\n\nNote, the string representation commits entries\nwhich coincide with defaults\n\n.. code-block:: python\n\n    >>> ABC(1, 2, [3, 4], c=5, d=1, e=7, g='A', h='B')\n    ABC(1, 2, [3, 4], c=5, e=7, g='A', h='B')\n\n\nDocumentation\n-------------\n\nMore documentation available at\n`https://prettyclass.readthedocs.io <https://prettyclass.readthedocs.io>`_\n\n\nInstall\n-------\n\nThe latest stable version can always be installed or updated via pip:\n\n.. code-block:: bash\n\n    $ pip install prettyclass\n\n\nLicense\n-------\n\nCode and documentation are available according to the license\n(see LICENSE file in repository).\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "pretty classes - pretty easy.  (created by auxilium)",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/sonntagsgesicht/prettyclass"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4ffba6325d0374dbf5b2ce2a87bfe7fb03bf7f316de40e8716d6eb0ad7a1e59f",
                "md5": "469be41f40ae81b756512c00367b8b40",
                "sha256": "9498d29945e91a77043bda56185991815b1902fa8cab7cea5b0eacb8f5d5bc5e"
            },
            "downloads": -1,
            "filename": "prettyclass-0.1.1.zip",
            "has_sig": false,
            "md5_digest": "469be41f40ae81b756512c00367b8b40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15041,
            "upload_time": "2024-10-07T17:40:04",
            "upload_time_iso_8601": "2024-10-07T17:40:04.085657Z",
            "url": "https://files.pythonhosted.org/packages/4f/fb/a6325d0374dbf5b2ce2a87bfe7fb03bf7f316de40e8716d6eb0ad7a1e59f/prettyclass-0.1.1.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 17:40:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sonntagsgesicht",
    "github_project": "prettyclass",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "auxilium",
            "specs": []
        }
    ],
    "lcname": "prettyclass"
}
        
Elapsed time: 0.34561s