summaryrefslogtreecommitdiff
path: root/python-instruct.spec
blob: 6146162efc89acf10dc0387bfc69951a0f27ee46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
%global _empty_manifest_terminate_build 0
Name:		python-instruct
Version:	0.7.2
Release:	1
Summary:	please add a summary manually as the author left a blank one
License:	BSD
URL:		https://github.com/autumnjolitz/instruct
Source0:	https://mirrors.aliyun.com/pypi/web/packages/05/d8/8799e697052ca9ea2657ce14cc7127f2790d953a4dd2bb0422e851e26854/instruct-0.7.2.tar.gz
BuildArch:	noarch

Requires:	python3-Jinja2
Requires:	python3-inflection
Requires:	python3-typing-extensions
Requires:	python3-twine
Requires:	python3-pytest
Requires:	python3-pytest-mock
Requires:	python3-pytest
Requires:	python3-pytest-mock

%description
A compact, fast object system that can serve as the basis for a DAO model.
To that end, instruct uses ``__slots__`` to prevent new attribute addition, properties to control types, event listeners and historical changes, and a Jinja2-driven codegen to keep a pure-Python implementation as fast and as light as possible.
I want to basically have a form of strictly typed objects that behave like C structs but can handle automatically coercing incoming values correctly, have primitive events and have fast ``__iter__``, ``__eq__`` while also allowing for one to override it in the final class (and even call super!)
This girl asks for a lot but I like taking metaclassing as far as it can go without diving into using macropy. 😉
Current Capabilities:
    - Support multiple inheritance, chained fields and ``__slots__`` [Done]
    - Support type coercions (via ``_coerce__``) [Done]
    - Strictly-typed ability to define fixed data objects [Done]
    - Ability to drop all of the above type checks [Done]
    - Track changes made to the object as well as reset [Done]
    - Fast ``__iter__`` [Done]
    - Native support of pickle [Done]/json [Done]
    - Support List[type] declarations and initializations [Done]
    - optionally data class annotation-like behavior [Done]
    - ``_asdict``, ``_astuple``, ``_aslist`` functions like in a NamedTuple [Done]
    - ``get``, ``keys``, ``values``, ``item`` functions available in the module and in a mixin named ``mapping=True``
        + This effectively allows access like other packages e.g. ``attrs.keys(item_instance)``
    - ``bytes``/``bytearray`` are urlsafe base64 encoded by default, can override per field via a class level ``BINARY_JSON_ENCODERS = {key: encoding_function}`` [Done]
    - Allow ``__coerce__`` to have a tuple of field names to avoid repetition on ``__coerce__`` definitions [Done]
    - Allow use of ``Literal`` in the type (exact match of a value to a vector of values) [Done]
    - Allow subtraction of properties like ``(F - {"a", "b"}).keys() == F_without_a_b.keys()`` [Done]
        + This will allow one to slim down a class to a restricted subtype, like for use in a DAO system to load/hold less data.
    - Allow subtraction of properties like ``(F - {"a": {"b"}).keys() == F_a_without_b.keys()`` [Done]
        + This allows for one to remove fields that are unused prior to class initialization.
    - Allow subtraction of properties via an inclusive list like ``(F & {"a", "b"}).keys() == F_with_only_a_and_b.keys()`` [Done]
    - Allow subtraction to propagate to embedded Instruct classes like ``(F - {"a.b", "a.c"}).a.keys() == (F_a.keys() - {"b", "c"))`` [Done]
        + This would really allow for complex trees of properties to be rendered down to thin SQL column selects, thus reducing data load.
    - Replace references to an embedded class in a ``__coerce__`` function with the subtracted form in case of embedded property subtractions [Done]
    - Allow use of Annotated i.e. ``field: Annotated[int, NoJSON, NoPickle]`` and have ``to_json`` and ``pickle.dumps(...)`` skip "field" [Done]
        + Would grant a more powerful interface to controlling code-gen'ed areas via ``cls._annotated_metadata`` (maps field -> what's inside the ``Annotation``)
Next Goals:
    - Allow Generics i.e. ``class F(instruct.Base, T): ...`` -> ``F[str](...)``
        + Would be able to allow specialized subtypes
    - ``CStruct``-Base class that operates on an ``_cvalue`` cffi struct.
    - Cython compatibility

%package -n python3-instruct
Summary:	please add a summary manually as the author left a blank one
Provides:	python-instruct
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-instruct
A compact, fast object system that can serve as the basis for a DAO model.
To that end, instruct uses ``__slots__`` to prevent new attribute addition, properties to control types, event listeners and historical changes, and a Jinja2-driven codegen to keep a pure-Python implementation as fast and as light as possible.
I want to basically have a form of strictly typed objects that behave like C structs but can handle automatically coercing incoming values correctly, have primitive events and have fast ``__iter__``, ``__eq__`` while also allowing for one to override it in the final class (and even call super!)
This girl asks for a lot but I like taking metaclassing as far as it can go without diving into using macropy. 😉
Current Capabilities:
    - Support multiple inheritance, chained fields and ``__slots__`` [Done]
    - Support type coercions (via ``_coerce__``) [Done]
    - Strictly-typed ability to define fixed data objects [Done]
    - Ability to drop all of the above type checks [Done]
    - Track changes made to the object as well as reset [Done]
    - Fast ``__iter__`` [Done]
    - Native support of pickle [Done]/json [Done]
    - Support List[type] declarations and initializations [Done]
    - optionally data class annotation-like behavior [Done]
    - ``_asdict``, ``_astuple``, ``_aslist`` functions like in a NamedTuple [Done]
    - ``get``, ``keys``, ``values``, ``item`` functions available in the module and in a mixin named ``mapping=True``
        + This effectively allows access like other packages e.g. ``attrs.keys(item_instance)``
    - ``bytes``/``bytearray`` are urlsafe base64 encoded by default, can override per field via a class level ``BINARY_JSON_ENCODERS = {key: encoding_function}`` [Done]
    - Allow ``__coerce__`` to have a tuple of field names to avoid repetition on ``__coerce__`` definitions [Done]
    - Allow use of ``Literal`` in the type (exact match of a value to a vector of values) [Done]
    - Allow subtraction of properties like ``(F - {"a", "b"}).keys() == F_without_a_b.keys()`` [Done]
        + This will allow one to slim down a class to a restricted subtype, like for use in a DAO system to load/hold less data.
    - Allow subtraction of properties like ``(F - {"a": {"b"}).keys() == F_a_without_b.keys()`` [Done]
        + This allows for one to remove fields that are unused prior to class initialization.
    - Allow subtraction of properties via an inclusive list like ``(F & {"a", "b"}).keys() == F_with_only_a_and_b.keys()`` [Done]
    - Allow subtraction to propagate to embedded Instruct classes like ``(F - {"a.b", "a.c"}).a.keys() == (F_a.keys() - {"b", "c"))`` [Done]
        + This would really allow for complex trees of properties to be rendered down to thin SQL column selects, thus reducing data load.
    - Replace references to an embedded class in a ``__coerce__`` function with the subtracted form in case of embedded property subtractions [Done]
    - Allow use of Annotated i.e. ``field: Annotated[int, NoJSON, NoPickle]`` and have ``to_json`` and ``pickle.dumps(...)`` skip "field" [Done]
        + Would grant a more powerful interface to controlling code-gen'ed areas via ``cls._annotated_metadata`` (maps field -> what's inside the ``Annotation``)
Next Goals:
    - Allow Generics i.e. ``class F(instruct.Base, T): ...`` -> ``F[str](...)``
        + Would be able to allow specialized subtypes
    - ``CStruct``-Base class that operates on an ``_cvalue`` cffi struct.
    - Cython compatibility

%package help
Summary:	Development documents and examples for instruct
Provides:	python3-instruct-doc
%description help
A compact, fast object system that can serve as the basis for a DAO model.
To that end, instruct uses ``__slots__`` to prevent new attribute addition, properties to control types, event listeners and historical changes, and a Jinja2-driven codegen to keep a pure-Python implementation as fast and as light as possible.
I want to basically have a form of strictly typed objects that behave like C structs but can handle automatically coercing incoming values correctly, have primitive events and have fast ``__iter__``, ``__eq__`` while also allowing for one to override it in the final class (and even call super!)
This girl asks for a lot but I like taking metaclassing as far as it can go without diving into using macropy. 😉
Current Capabilities:
    - Support multiple inheritance, chained fields and ``__slots__`` [Done]
    - Support type coercions (via ``_coerce__``) [Done]
    - Strictly-typed ability to define fixed data objects [Done]
    - Ability to drop all of the above type checks [Done]
    - Track changes made to the object as well as reset [Done]
    - Fast ``__iter__`` [Done]
    - Native support of pickle [Done]/json [Done]
    - Support List[type] declarations and initializations [Done]
    - optionally data class annotation-like behavior [Done]
    - ``_asdict``, ``_astuple``, ``_aslist`` functions like in a NamedTuple [Done]
    - ``get``, ``keys``, ``values``, ``item`` functions available in the module and in a mixin named ``mapping=True``
        + This effectively allows access like other packages e.g. ``attrs.keys(item_instance)``
    - ``bytes``/``bytearray`` are urlsafe base64 encoded by default, can override per field via a class level ``BINARY_JSON_ENCODERS = {key: encoding_function}`` [Done]
    - Allow ``__coerce__`` to have a tuple of field names to avoid repetition on ``__coerce__`` definitions [Done]
    - Allow use of ``Literal`` in the type (exact match of a value to a vector of values) [Done]
    - Allow subtraction of properties like ``(F - {"a", "b"}).keys() == F_without_a_b.keys()`` [Done]
        + This will allow one to slim down a class to a restricted subtype, like for use in a DAO system to load/hold less data.
    - Allow subtraction of properties like ``(F - {"a": {"b"}).keys() == F_a_without_b.keys()`` [Done]
        + This allows for one to remove fields that are unused prior to class initialization.
    - Allow subtraction of properties via an inclusive list like ``(F & {"a", "b"}).keys() == F_with_only_a_and_b.keys()`` [Done]
    - Allow subtraction to propagate to embedded Instruct classes like ``(F - {"a.b", "a.c"}).a.keys() == (F_a.keys() - {"b", "c"))`` [Done]
        + This would really allow for complex trees of properties to be rendered down to thin SQL column selects, thus reducing data load.
    - Replace references to an embedded class in a ``__coerce__`` function with the subtracted form in case of embedded property subtractions [Done]
    - Allow use of Annotated i.e. ``field: Annotated[int, NoJSON, NoPickle]`` and have ``to_json`` and ``pickle.dumps(...)`` skip "field" [Done]
        + Would grant a more powerful interface to controlling code-gen'ed areas via ``cls._annotated_metadata`` (maps field -> what's inside the ``Annotation``)
Next Goals:
    - Allow Generics i.e. ``class F(instruct.Base, T): ...`` -> ``F[str](...)``
        + Would be able to allow specialized subtypes
    - ``CStruct``-Base class that operates on an ``_cvalue`` cffi struct.
    - Cython compatibility

%prep
%autosetup -n instruct-0.7.2

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-instruct -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri Jun 09 2023 Python_Bot <Python_Bot@openeuler.org> - 0.7.2-1
- Package Spec generated