designkit 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- designkit-0.1.0/.gitattributes +14 -0
- designkit-0.1.0/.github/workflows/CI.yml +186 -0
- designkit-0.1.0/.gitignore +74 -0
- designkit-0.1.0/Cargo.lock +132 -0
- designkit-0.1.0/Cargo.toml +14 -0
- designkit-0.1.0/LICENSE +21 -0
- designkit-0.1.0/PKG-INFO +36 -0
- designkit-0.1.0/README.md +3 -0
- designkit-0.1.0/TODO.md +38 -0
- designkit-0.1.0/designkit/__init__.py +6 -0
- designkit-0.1.0/designkit/_designkit.pdb +0 -0
- designkit-0.1.0/designkit/behavioral/cache/__init__.py +3 -0
- designkit-0.1.0/designkit/behavioral/cache/core.py +23 -0
- designkit-0.1.0/designkit/behavioral/cache/lru_cache.py +98 -0
- designkit-0.1.0/designkit/behavioral/cache/models.py +12 -0
- designkit-0.1.0/designkit/behavioral/chain_of_responsibility/__init__.py +2 -0
- designkit-0.1.0/designkit/behavioral/chain_of_responsibility/core.py +59 -0
- designkit-0.1.0/designkit/behavioral/command/__init__.py +15 -0
- designkit-0.1.0/designkit/behavioral/command/commands.py +94 -0
- designkit-0.1.0/designkit/behavioral/command/exceptions.py +26 -0
- designkit-0.1.0/designkit/behavioral/command/invokers.py +166 -0
- designkit-0.1.0/designkit/behavioral/command/models.py +11 -0
- designkit-0.1.0/designkit/behavioral/command/receivers.py +12 -0
- designkit-0.1.0/designkit/behavioral/command/utils.py +22 -0
- designkit-0.1.0/designkit/behavioral/control/__init__.py +0 -0
- designkit-0.1.0/designkit/behavioral/control/core.py +22 -0
- designkit-0.1.0/designkit/behavioral/control/http.py +104 -0
- designkit-0.1.0/designkit/behavioral/control/mathematical.py +37 -0
- designkit-0.1.0/designkit/behavioral/control/promises.py +116 -0
- designkit-0.1.0/designkit/behavioral/control/result.py +63 -0
- designkit-0.1.0/designkit/behavioral/control/validation.py +84 -0
- designkit-0.1.0/designkit/behavioral/imperactive/__init__.py +9 -0
- designkit-0.1.0/designkit/behavioral/imperactive/core.py +767 -0
- designkit-0.1.0/designkit/behavioral/imperactive/exceptions.py +24 -0
- designkit-0.1.0/designkit/behavioral/interpreter/__init__.py +13 -0
- designkit-0.1.0/designkit/behavioral/interpreter/builtin_exprs.py +253 -0
- designkit-0.1.0/designkit/behavioral/interpreter/builtin_stmts.py +14 -0
- designkit-0.1.0/designkit/behavioral/interpreter/builtin_units.py +112 -0
- designkit-0.1.0/designkit/behavioral/interpreter/core.py +95 -0
- designkit-0.1.0/designkit/behavioral/iterator/__init__.py +16 -0
- designkit-0.1.0/designkit/behavioral/iterator/core.py +357 -0
- designkit-0.1.0/designkit/behavioral/iterator/exceptions.py +35 -0
- designkit-0.1.0/designkit/behavioral/iterator/iter_types.py +50 -0
- designkit-0.1.0/designkit/behavioral/iterator/specialized/hashful.py +121 -0
- designkit-0.1.0/designkit/behavioral/iterator/specialized/safeful.py +120 -0
- designkit-0.1.0/designkit/behavioral/matcher/__init__.py +2 -0
- designkit-0.1.0/designkit/behavioral/matcher/core.py +250 -0
- designkit-0.1.0/designkit/behavioral/matcher/exceptions.py +58 -0
- designkit-0.1.0/designkit/behavioral/mediator/__init__.py +5 -0
- designkit-0.1.0/designkit/behavioral/mediator/core.py +15 -0
- designkit-0.1.0/designkit/behavioral/memorable/__init__.py +7 -0
- designkit-0.1.0/designkit/behavioral/memorable/core.py +210 -0
- designkit-0.1.0/designkit/behavioral/memorable/exceptions.py +40 -0
- designkit-0.1.0/designkit/behavioral/policy/__init__.py +7 -0
- designkit-0.1.0/designkit/behavioral/policy/core.py +112 -0
- designkit-0.1.0/designkit/behavioral/policy/exceptions.py +41 -0
- designkit-0.1.0/designkit/behavioral/policy/models.py +41 -0
- designkit-0.1.0/designkit/behavioral/state/__init__.py +15 -0
- designkit-0.1.0/designkit/behavioral/state/core.py +1043 -0
- designkit-0.1.0/designkit/behavioral/state/exceptions.py +132 -0
- designkit-0.1.0/designkit/behavioral/state/flowchartlib.py +1 -0
- designkit-0.1.0/designkit/behavioral/state/fsm_types.py +38 -0
- designkit-0.1.0/designkit/behavioral/state/renderers.py +96 -0
- designkit-0.1.0/designkit/behavioral/state/tools.py +4 -0
- designkit-0.1.0/designkit/behavioral/state/utils.py +18 -0
- designkit-0.1.0/designkit/behavioral/strategy/__int__.py +2 -0
- designkit-0.1.0/designkit/behavioral/strategy/core.py +41 -0
- designkit-0.1.0/designkit/behavioral/strategy/exceptions.py +2 -0
- designkit-0.1.0/designkit/behavioral/strategy/models.py +2 -0
- designkit-0.1.0/designkit/behavioral/template/__init__.py +8 -0
- designkit-0.1.0/designkit/behavioral/template/core.py +44 -0
- designkit-0.1.0/designkit/behavioral/trie/__init__.py +2 -0
- designkit-0.1.0/designkit/behavioral/trie/core.py +212 -0
- designkit-0.1.0/designkit/behavioral/typing/__init__.py +5 -0
- designkit-0.1.0/designkit/behavioral/typing/core.py +370 -0
- designkit-0.1.0/designkit/creational/prototype/__init__.py +8 -0
- designkit-0.1.0/designkit/creational/prototype/core.py +30 -0
- designkit-0.1.0/designkit/creational/singleton/__init__.py +8 -0
- designkit-0.1.0/designkit/creational/singleton/core.py +38 -0
- designkit-0.1.0/designkit/creational/singleton/exceptions.py +7 -0
- designkit-0.1.0/designkit/structural/decorador/__init__.py +2 -0
- designkit-0.1.0/designkit/structural/decorador/core.py +74 -0
- designkit-0.1.0/designkit/structural/decorador/utils.py +20 -0
- designkit-0.1.0/designkit/structural/eventloop/__init__.py +0 -0
- designkit-0.1.0/designkit/structural/eventloop/core.py +0 -0
- designkit-0.1.0/pyproject.toml +71 -0
- designkit-0.1.0/requirements.txt +3 -0
- designkit-0.1.0/rust/designkit/behavional/interpreter/core.rs +30 -0
- designkit-0.1.0/rust/designkit/creational/singleton/null +0 -0
- designkit-0.1.0/rust/lib.rs +13 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# This file is autogenerated by maturin v1.14.1
|
|
2
|
+
# To update, run
|
|
3
|
+
#
|
|
4
|
+
# maturin generate-ci github
|
|
5
|
+
#
|
|
6
|
+
name: CI
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
- master
|
|
13
|
+
tags:
|
|
14
|
+
- '*'
|
|
15
|
+
pull_request:
|
|
16
|
+
workflow_dispatch:
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
linux:
|
|
23
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
24
|
+
strategy:
|
|
25
|
+
matrix:
|
|
26
|
+
platform:
|
|
27
|
+
- runner: ubuntu-22.04
|
|
28
|
+
target: x86_64
|
|
29
|
+
- runner: ubuntu-22.04
|
|
30
|
+
target: x86
|
|
31
|
+
- runner: ubuntu-22.04
|
|
32
|
+
target: aarch64
|
|
33
|
+
- runner: ubuntu-22.04
|
|
34
|
+
target: armv7
|
|
35
|
+
- runner: ubuntu-22.04
|
|
36
|
+
target: s390x
|
|
37
|
+
- runner: ubuntu-22.04
|
|
38
|
+
target: ppc64le
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v6
|
|
41
|
+
- uses: actions/setup-python@v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.x"
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.platform.target }}
|
|
48
|
+
args: --release --out dist --find-interpreter
|
|
49
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
50
|
+
manylinux: auto
|
|
51
|
+
- name: Upload wheels
|
|
52
|
+
uses: actions/upload-artifact@v6
|
|
53
|
+
with:
|
|
54
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
55
|
+
path: dist
|
|
56
|
+
|
|
57
|
+
musllinux:
|
|
58
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
59
|
+
strategy:
|
|
60
|
+
matrix:
|
|
61
|
+
platform:
|
|
62
|
+
- runner: ubuntu-22.04
|
|
63
|
+
target: x86_64
|
|
64
|
+
- runner: ubuntu-22.04
|
|
65
|
+
target: x86
|
|
66
|
+
- runner: ubuntu-22.04
|
|
67
|
+
target: aarch64
|
|
68
|
+
- runner: ubuntu-22.04
|
|
69
|
+
target: armv7
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v6
|
|
72
|
+
- uses: actions/setup-python@v6
|
|
73
|
+
with:
|
|
74
|
+
python-version: "3.x"
|
|
75
|
+
- name: Build wheels
|
|
76
|
+
uses: PyO3/maturin-action@v1
|
|
77
|
+
with:
|
|
78
|
+
target: ${{ matrix.platform.target }}
|
|
79
|
+
args: --release --out dist --find-interpreter
|
|
80
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
81
|
+
manylinux: musllinux_1_2
|
|
82
|
+
- name: Upload wheels
|
|
83
|
+
uses: actions/upload-artifact@v6
|
|
84
|
+
with:
|
|
85
|
+
name: wheels-musllinux-${{ matrix.platform.target }}
|
|
86
|
+
path: dist
|
|
87
|
+
|
|
88
|
+
windows:
|
|
89
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
90
|
+
strategy:
|
|
91
|
+
matrix:
|
|
92
|
+
platform:
|
|
93
|
+
- runner: windows-latest
|
|
94
|
+
target: x64
|
|
95
|
+
python_arch: x64
|
|
96
|
+
- runner: windows-latest
|
|
97
|
+
target: x86
|
|
98
|
+
python_arch: x86
|
|
99
|
+
- runner: windows-11-arm
|
|
100
|
+
target: aarch64
|
|
101
|
+
python_arch: arm64
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v6
|
|
104
|
+
- uses: actions/setup-python@v6
|
|
105
|
+
with:
|
|
106
|
+
python-version: "3.13"
|
|
107
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
108
|
+
- name: Build wheels
|
|
109
|
+
uses: PyO3/maturin-action@v1
|
|
110
|
+
with:
|
|
111
|
+
target: ${{ matrix.platform.target }}
|
|
112
|
+
args: --release --out dist --find-interpreter
|
|
113
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
114
|
+
- name: Upload wheels
|
|
115
|
+
uses: actions/upload-artifact@v6
|
|
116
|
+
with:
|
|
117
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
118
|
+
path: dist
|
|
119
|
+
|
|
120
|
+
macos:
|
|
121
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
122
|
+
strategy:
|
|
123
|
+
matrix:
|
|
124
|
+
platform:
|
|
125
|
+
- runner: macos-15-intel
|
|
126
|
+
target: x86_64
|
|
127
|
+
- runner: macos-latest
|
|
128
|
+
target: aarch64
|
|
129
|
+
steps:
|
|
130
|
+
- uses: actions/checkout@v6
|
|
131
|
+
- uses: actions/setup-python@v6
|
|
132
|
+
with:
|
|
133
|
+
python-version: "3.x"
|
|
134
|
+
- name: Build wheels
|
|
135
|
+
uses: PyO3/maturin-action@v1
|
|
136
|
+
with:
|
|
137
|
+
target: ${{ matrix.platform.target }}
|
|
138
|
+
args: --release --out dist --find-interpreter
|
|
139
|
+
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
140
|
+
- name: Upload wheels
|
|
141
|
+
uses: actions/upload-artifact@v6
|
|
142
|
+
with:
|
|
143
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
144
|
+
path: dist
|
|
145
|
+
|
|
146
|
+
sdist:
|
|
147
|
+
runs-on: ubuntu-latest
|
|
148
|
+
steps:
|
|
149
|
+
- uses: actions/checkout@v6
|
|
150
|
+
- name: Build sdist
|
|
151
|
+
uses: PyO3/maturin-action@v1
|
|
152
|
+
with:
|
|
153
|
+
command: sdist
|
|
154
|
+
args: --out dist
|
|
155
|
+
- name: Upload sdist
|
|
156
|
+
uses: actions/upload-artifact@v6
|
|
157
|
+
with:
|
|
158
|
+
name: wheels-sdist
|
|
159
|
+
path: dist
|
|
160
|
+
|
|
161
|
+
release:
|
|
162
|
+
name: Release
|
|
163
|
+
runs-on: ubuntu-latest
|
|
164
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
165
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
166
|
+
permissions:
|
|
167
|
+
# Use to sign the release artifacts
|
|
168
|
+
id-token: write
|
|
169
|
+
# Used to upload release artifacts
|
|
170
|
+
contents: write
|
|
171
|
+
# Used to generate artifact attestation
|
|
172
|
+
attestations: write
|
|
173
|
+
steps:
|
|
174
|
+
- uses: actions/download-artifact@v7
|
|
175
|
+
- name: Generate artifact attestation
|
|
176
|
+
uses: actions/attest@v4
|
|
177
|
+
with:
|
|
178
|
+
subject-path: 'wheels-*/*'
|
|
179
|
+
- name: Install uv
|
|
180
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
181
|
+
uses: astral-sh/setup-uv@v7
|
|
182
|
+
- name: Publish to PyPI
|
|
183
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
184
|
+
run: uv publish 'wheels-*/*'
|
|
185
|
+
env:
|
|
186
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/target
|
|
2
|
+
/hidden
|
|
3
|
+
/test.py
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
.venv/
|
|
16
|
+
env/
|
|
17
|
+
bin/
|
|
18
|
+
build/
|
|
19
|
+
develop-eggs/
|
|
20
|
+
dist/
|
|
21
|
+
eggs/
|
|
22
|
+
lib/
|
|
23
|
+
lib64/
|
|
24
|
+
parts/
|
|
25
|
+
sdist/
|
|
26
|
+
var/
|
|
27
|
+
include/
|
|
28
|
+
man/
|
|
29
|
+
venv/
|
|
30
|
+
*.egg-info/
|
|
31
|
+
.installed.cfg
|
|
32
|
+
*.egg
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
pip-selfcheck.json
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.coverage
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
|
|
47
|
+
# Translations
|
|
48
|
+
*.mo
|
|
49
|
+
|
|
50
|
+
# Mr Developer
|
|
51
|
+
.mr.developer.cfg
|
|
52
|
+
.project
|
|
53
|
+
.pydevproject
|
|
54
|
+
|
|
55
|
+
# Rope
|
|
56
|
+
.ropeproject
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
.DS_Store
|
|
63
|
+
|
|
64
|
+
# Sphinx documentation
|
|
65
|
+
docs/_build/
|
|
66
|
+
|
|
67
|
+
# PyCharm
|
|
68
|
+
.idea/
|
|
69
|
+
|
|
70
|
+
# VSCode
|
|
71
|
+
.vscode/
|
|
72
|
+
|
|
73
|
+
# Pyenv
|
|
74
|
+
.python-version
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "designkit"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"pyo3",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[[package]]
|
|
13
|
+
name = "heck"
|
|
14
|
+
version = "0.5.0"
|
|
15
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
16
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
17
|
+
|
|
18
|
+
[[package]]
|
|
19
|
+
name = "libc"
|
|
20
|
+
version = "0.2.186"
|
|
21
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
22
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
23
|
+
|
|
24
|
+
[[package]]
|
|
25
|
+
name = "once_cell"
|
|
26
|
+
version = "1.21.4"
|
|
27
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
28
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "portable-atomic"
|
|
32
|
+
version = "1.14.0"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3"
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "proc-macro2"
|
|
38
|
+
version = "1.0.107"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
41
|
+
dependencies = [
|
|
42
|
+
"unicode-ident",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[[package]]
|
|
46
|
+
name = "pyo3"
|
|
47
|
+
version = "0.29.0"
|
|
48
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
49
|
+
checksum = "cd274650b21d4bfc26a0a47587962c1edb425f69287324355cd040c3ea66071c"
|
|
50
|
+
dependencies = [
|
|
51
|
+
"libc",
|
|
52
|
+
"once_cell",
|
|
53
|
+
"portable-atomic",
|
|
54
|
+
"pyo3-build-config",
|
|
55
|
+
"pyo3-ffi",
|
|
56
|
+
"pyo3-macros",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "pyo3-build-config"
|
|
61
|
+
version = "0.29.0"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "c5e2a7d2f0d013342f295c048ad19237add5154a55b1c5a254c0ec93d4109078"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"target-lexicon",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "pyo3-ffi"
|
|
70
|
+
version = "0.29.0"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "ca85c467da1bbc8d866eea5deff9cf29ea5f7785054a17da36e65bda9c05845b"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"libc",
|
|
75
|
+
"pyo3-build-config",
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[[package]]
|
|
79
|
+
name = "pyo3-macros"
|
|
80
|
+
version = "0.29.0"
|
|
81
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
82
|
+
checksum = "9ac53762fd065daa3194dd09337a38bd793a188100fd1a9304c4ab312d901771"
|
|
83
|
+
dependencies = [
|
|
84
|
+
"proc-macro2",
|
|
85
|
+
"pyo3-macros-backend",
|
|
86
|
+
"quote",
|
|
87
|
+
"syn",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[[package]]
|
|
91
|
+
name = "pyo3-macros-backend"
|
|
92
|
+
version = "0.29.0"
|
|
93
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
94
|
+
checksum = "4ca3a1557399783172dc5bf39cfca835157732532cba56b71d2292161e53b362"
|
|
95
|
+
dependencies = [
|
|
96
|
+
"heck",
|
|
97
|
+
"proc-macro2",
|
|
98
|
+
"quote",
|
|
99
|
+
"syn",
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
[[package]]
|
|
103
|
+
name = "quote"
|
|
104
|
+
version = "1.0.47"
|
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
106
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
107
|
+
dependencies = [
|
|
108
|
+
"proc-macro2",
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
[[package]]
|
|
112
|
+
name = "syn"
|
|
113
|
+
version = "2.0.119"
|
|
114
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
115
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
116
|
+
dependencies = [
|
|
117
|
+
"proc-macro2",
|
|
118
|
+
"quote",
|
|
119
|
+
"unicode-ident",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
[[package]]
|
|
123
|
+
name = "target-lexicon"
|
|
124
|
+
version = "0.13.5"
|
|
125
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
127
|
+
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "unicode-ident"
|
|
130
|
+
version = "1.0.24"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "designkit"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
8
|
+
[lib]
|
|
9
|
+
name = "designkit"
|
|
10
|
+
path = "rust/lib.rs"
|
|
11
|
+
crate-type = ["cdylib"]
|
|
12
|
+
|
|
13
|
+
[dependencies]
|
|
14
|
+
pyo3 = "0.29.0"
|
designkit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 José Daniel Avalos Becerra ~ Sheñey.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
designkit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: designkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Intended Audience :: Developers
|
|
5
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
6
|
+
Classifier: Programming Language :: Rust
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
10
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
11
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Requires-Dist: designkit-utils>=0.6.1,<0.7
|
|
16
|
+
Requires-Dist: rich>=15.0.0,<16.0
|
|
17
|
+
Requires-Dist: pytest>=9.1.1,<10.0 ; extra == 'dev'
|
|
18
|
+
Requires-Dist: pytest-cov>=5.3.1,<6.0 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: mypy ; extra == 'dev'
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Summary: A modern Python toolkit for software architecture, featuring all 23 GoF + 6 original design patterns, original architectural patterns, and powerful developer utilities.
|
|
23
|
+
Keywords: patterns,design,kit,utils,framework,rust,pyo3
|
|
24
|
+
Author-email: Sheñey <sheneyby2010@gmail.com>
|
|
25
|
+
Requires-Python: >=3.14
|
|
26
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
27
|
+
Project-URL: Changelog, https://github.com/Sheniey/designkit/releases
|
|
28
|
+
Project-URL: Documentation, https://github.com/Sheniey/designkit
|
|
29
|
+
Project-URL: Homepage, https://github.com/Sheniey/designkit
|
|
30
|
+
Project-URL: Issues, https://github.com/Sheniey/designkit/issues
|
|
31
|
+
Project-URL: Repository, https://github.com/Sheniey/designkit
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## What is DesignKit?
|
|
35
|
+
DesignKit is a modern Python architecture toolkit that combines the 23 Gang of Four design patterns with original architectural abstractions, expressive APIs, and high-performance utilities to build cleaner, more maintainable software.
|
|
36
|
+
|
designkit-0.1.0/TODO.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
### Creational (5)
|
|
3
|
+
- [ ] Abstract Factory
|
|
4
|
+
- [ ] Builder
|
|
5
|
+
- [ ] Factory Method
|
|
6
|
+
- [X] Prototype
|
|
7
|
+
- [X] Singleton
|
|
8
|
+
|
|
9
|
+
### Structural (7)
|
|
10
|
+
- [ ] Adapter
|
|
11
|
+
- [ ] Bridge
|
|
12
|
+
- [ ] Composite
|
|
13
|
+
- [X] Decorator
|
|
14
|
+
- [ ] Facade
|
|
15
|
+
- [ ] Flyweight
|
|
16
|
+
- [ ] Proxy
|
|
17
|
+
|
|
18
|
+
### Behavioral (11)
|
|
19
|
+
- [X] Chain of Responsibility
|
|
20
|
+
- [X] Command
|
|
21
|
+
- [X] Interpreter
|
|
22
|
+
- [X] Iterator
|
|
23
|
+
- [X] Mediator
|
|
24
|
+
- [ ] Memento
|
|
25
|
+
- [ ] Observer
|
|
26
|
+
- [X] State
|
|
27
|
+
- [~] Strategy
|
|
28
|
+
- [X] Policy
|
|
29
|
+
- [X] Template Method
|
|
30
|
+
- [ ] Visitor
|
|
31
|
+
|
|
32
|
+
- [X] Control
|
|
33
|
+
- [X] Imperative
|
|
34
|
+
- [X] Matcher
|
|
35
|
+
- [X] Trie
|
|
36
|
+
- [X] Typing
|
|
37
|
+
- [X] Memorable
|
|
38
|
+
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
from functools import wraps
|
|
3
|
+
from typing import Callable
|
|
4
|
+
|
|
5
|
+
from .models import AbstractCache
|
|
6
|
+
from .lru_cache import LRUCache
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def cached[F: Callable[..., R], R](capacity: int, cache: AbstractCache[R] = LRUCache) -> Callable[[F], F]:
|
|
10
|
+
def decorator(func: F) -> F:
|
|
11
|
+
@wraps(func)
|
|
12
|
+
def wrapper(*args, **kwargs):
|
|
13
|
+
key: tuple[tuple, tuple[tuple[str, object]]] = (args, tuple(sorted(kwargs.items())))
|
|
14
|
+
if key in wrapper.cache:
|
|
15
|
+
return wrapper.cache.get(key)
|
|
16
|
+
|
|
17
|
+
result: R = func(*args, **kwargs)
|
|
18
|
+
wrapper.cache.put(key, result)
|
|
19
|
+
return result
|
|
20
|
+
|
|
21
|
+
wrapper.cache = cache[R](capacity)
|
|
22
|
+
return wrapper
|
|
23
|
+
return decorator
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
|
|
2
|
+
class Node[T]:
|
|
3
|
+
def __init__(self, key: str, value: T) -> None:
|
|
4
|
+
self.key: str = key
|
|
5
|
+
self.value: T = value
|
|
6
|
+
self.prev: Node[T] | None = None
|
|
7
|
+
self.next: Node[T] | None = None
|
|
8
|
+
|
|
9
|
+
class LRUCache[T]:
|
|
10
|
+
def __init__(self, capacity: int) -> None:
|
|
11
|
+
self.__capacity: int = capacity
|
|
12
|
+
self.__map: dict[str, Node[T]] = {}
|
|
13
|
+
self.__head: Node[T] = Node('', 0) # type: ignore
|
|
14
|
+
self.__tail: Node[T] = Node('', 0) # type: ignore
|
|
15
|
+
self.__head.next = self.__tail
|
|
16
|
+
self.__tail.prev = self.__head
|
|
17
|
+
|
|
18
|
+
def __repr__(self) -> str:
|
|
19
|
+
nodes: list[str] = []
|
|
20
|
+
current: Node[T] | None = self.__head.next
|
|
21
|
+
|
|
22
|
+
while current is not None and current != self.__tail:
|
|
23
|
+
nodes.append(f'({current.key}: {current.value})')
|
|
24
|
+
current = current.next
|
|
25
|
+
|
|
26
|
+
return ' <-> '.join(nodes)
|
|
27
|
+
|
|
28
|
+
def __str__(self) -> str:
|
|
29
|
+
return f'{self.__class__.__name__}( capacity={self.__capacity}, map={self.__map} )'
|
|
30
|
+
|
|
31
|
+
def __getitem__(self, key: str) -> T:
|
|
32
|
+
return self.get(key)
|
|
33
|
+
|
|
34
|
+
def __setitem__(self, key: str, value: T) -> None:
|
|
35
|
+
self.put(key, value)
|
|
36
|
+
|
|
37
|
+
def __contains__(self, key: str) -> bool:
|
|
38
|
+
return key in self.__map
|
|
39
|
+
|
|
40
|
+
def __len__(self) -> int:
|
|
41
|
+
return len(self.__map)
|
|
42
|
+
|
|
43
|
+
def _remove(self, node: Node[T]) -> None:
|
|
44
|
+
if node.prev is not None:
|
|
45
|
+
node.prev.next = node.next
|
|
46
|
+
|
|
47
|
+
if node.next is not None:
|
|
48
|
+
node.next.prev = node.prev
|
|
49
|
+
|
|
50
|
+
def _add_to_front(self, node: Node[T]) -> None:
|
|
51
|
+
node.next = self.__head.next
|
|
52
|
+
node.prev = self.__head
|
|
53
|
+
self.__head.next.prev = node
|
|
54
|
+
self.__head.next = node
|
|
55
|
+
|
|
56
|
+
def get(self, key: str) -> T:
|
|
57
|
+
node: Node[T] | None = self.__map.get(key)
|
|
58
|
+
|
|
59
|
+
if node is None:
|
|
60
|
+
return -1
|
|
61
|
+
|
|
62
|
+
self._remove(node)
|
|
63
|
+
self._add_to_front(node)
|
|
64
|
+
|
|
65
|
+
return node.value
|
|
66
|
+
|
|
67
|
+
def put(self, key: str, value: T) -> None:
|
|
68
|
+
existing: Node[T] | None = self.__map.get(key)
|
|
69
|
+
|
|
70
|
+
if existing is not None:
|
|
71
|
+
existing.value = value
|
|
72
|
+
self._remove(existing)
|
|
73
|
+
self._add_to_front(existing)
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
node: Node[T] = Node(key, value)
|
|
77
|
+
self.__map[key] = node
|
|
78
|
+
|
|
79
|
+
self._add_to_front(node)
|
|
80
|
+
|
|
81
|
+
if len(self.__map) > self.__capacity:
|
|
82
|
+
lru: Node[T] | None = self.__tail.prev
|
|
83
|
+
|
|
84
|
+
if lru is not None:
|
|
85
|
+
self._remove(lru)
|
|
86
|
+
del self.__map[lru.key]
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def capacity(self) -> int:
|
|
90
|
+
return self.__capacity
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def free_space(self) -> int:
|
|
94
|
+
return self.__capacity - len(self.__map)
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def is_full(self) -> bool:
|
|
98
|
+
return len(self.__map) >= self.__capacity
|