better-abc


Namebetter-abc JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://www.github.com/shonin/better-abc
SummaryPython ABC plus abstract attributes
upload_time2020-11-10 22:47:31
maintainer
docs_urlNone
authorShonin
requires_python
licenseBSD-3-Clause
keywords python abc better abstract
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Better ABC

https://stackoverflow.com/questions/23831510/abstract-attribute-not-property

## Usage 

```python
from better_abc import ABCMeta, abstract_attribute    # see below

class AbstractFoo(metaclass=ABCMeta):

    @abstract_attribute
    def bar(self):
        pass

class Foo(AbstractFoo):
    def __init__(self):
        self.bar = 3

class BadFoo(AbstractFoo):
    def __init__(self):
        pass
```

```
Foo()     # ok
BadFoo()  # will raise: NotImplementedError: Can't instantiate abstract class BadFoo
# with abstract attributes: bar
```

If you want other features of ABC they need to be imported from the abc module directly.

```python
from abc import abstractmethod
from better_abc import ABCMeta, abstract_attribute
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://www.github.com/shonin/better-abc",
    "name": "better-abc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,abc,better,abstract",
    "author": "Shonin",
    "author_email": "emc@hey.com",
    "download_url": "https://files.pythonhosted.org/packages/8b/72/3d630f781659015357cc08cad32aa636b252e007df0bae31184a3d872427/better-abc-0.0.3.tar.gz",
    "platform": "",
    "description": "# Better ABC\n\nhttps://stackoverflow.com/questions/23831510/abstract-attribute-not-property\n\n## Usage \n\n```python\nfrom better_abc import ABCMeta, abstract_attribute    # see below\n\nclass AbstractFoo(metaclass=ABCMeta):\n\n    @abstract_attribute\n    def bar(self):\n        pass\n\nclass Foo(AbstractFoo):\n    def __init__(self):\n        self.bar = 3\n\nclass BadFoo(AbstractFoo):\n    def __init__(self):\n        pass\n```\n\n```\nFoo()     # ok\nBadFoo()  # will raise: NotImplementedError: Can't instantiate abstract class BadFoo\n# with abstract attributes: bar\n```\n\nIf you want other features of ABC they need to be imported from the abc module directly.\n\n```python\nfrom abc import abstractmethod\nfrom better_abc import ABCMeta, abstract_attribute\n```\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Python ABC plus abstract attributes",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://www.github.com/shonin/better-abc"
    },
    "split_keywords": [
        "python",
        "abc",
        "better",
        "abstract"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d9e87d00a23039ab74c5741736ce05d7700eb6237e83747aac4df07a5bf2d074",
                "md5": "6e9a0ef9b12f8717d011b37f46de7433",
                "sha256": "3ae73b473fbeb536a548f542984976e80b821676ae6e18f14e24d8e180647187"
            },
            "downloads": -1,
            "filename": "better_abc-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6e9a0ef9b12f8717d011b37f46de7433",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3475,
            "upload_time": "2020-11-10T22:47:30",
            "upload_time_iso_8601": "2020-11-10T22:47:30.354455Z",
            "url": "https://files.pythonhosted.org/packages/d9/e8/7d00a23039ab74c5741736ce05d7700eb6237e83747aac4df07a5bf2d074/better_abc-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8b723d630f781659015357cc08cad32aa636b252e007df0bae31184a3d872427",
                "md5": "7d745fa4052046f62d3f1abcc00db0f2",
                "sha256": "a880fd6bc9675da2ec991e8712a555bffa0f12722efed78c739f78343cf989f6"
            },
            "downloads": -1,
            "filename": "better-abc-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7d745fa4052046f62d3f1abcc00db0f2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2852,
            "upload_time": "2020-11-10T22:47:31",
            "upload_time_iso_8601": "2020-11-10T22:47:31.303543Z",
            "url": "https://files.pythonhosted.org/packages/8b/72/3d630f781659015357cc08cad32aa636b252e007df0bae31184a3d872427/better-abc-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-10 22:47:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shonin",
    "github_project": "better-abc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "better-abc"
}
        
Elapsed time: 0.08343s