From 07545bcbe02a20bfa75db4a2eaf2f921fc7764c8 Mon Sep 17 00:00:00 2001 From: Adrian Stachlewski Date: Tue, 20 Mar 2018 22:40:11 +0100 Subject: [PATCH] setup.py --- README.md | 8 ++++---- setup.py | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 setup.py diff --git a/README.md b/README.md index 27b97dc..f95492c 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![codecov](https://codecov.io/gh/starhel/dataslots/branch/master/graph/badge.svg)](https://codecov.io/gh/starhel/dataslots) ## Decorator for adding __slots__ -In python3.7 there is dataclasses module ([PEP 557](https://www.python.org/dev/peps/pep-0557/)). Unfortunately there's -no support for \_\_slots__ ([dataclasses #28][dataclasses_issue]). **dataslots** package adds with_slots decorator to -create new class with proper \_\_slots__. +Python3.7 provides dataclasses module for faster class creation ([PEP 557](https://www.python.org/dev/peps/pep-0557/)). +Unfortunately there's no support for \_\_slots__. If you want to create more memory efficient instances, you need to +do it by yourself or use dataslots.with_slots decorator. ## Usage #### Simple example @@ -64,7 +64,7 @@ for attribute or use typing.ClassVar to declare one. @dataclass class A: x = 5 - y: ClassVar[Set] = set() + y: ClassVar[set] = set() ``` ## More about \_\_slots__ diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..8e4623c --- /dev/null +++ b/setup.py @@ -0,0 +1,27 @@ +from setuptools import setup +import os + + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + + +setup( + name='dataslots', + packages=['dataslots'], + version='1.0.0', + description='Decorator to add __slots__ in dataclasses', + long_description=read('README.md'), + long_description_content_type='text/markdown', + author='Adrian Stachlewski', + author_email='starhel.github@gmail.com', + url='https://github.com/starhel/dataslots', + keywords=['dataslots', 'slots', 'dataclasses'], + classifiers=[ + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.7", + "Intended Audience :: Developers" + ], + python_requires='>=3.7' +)