dtools.circular-array 3.9.1__tar.gz → 3.11.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.
@@ -0,0 +1,234 @@
1
+ # CHANGELOG
2
+
3
+ PyPI grscheller.circular-array project.
4
+
5
+ - first digit - major event, epoch, or paradigm shift
6
+ - second digit - breaking API changes, major changes
7
+ - third digit - bug fixes, API additions, breaking API in dev env
8
+ - forth digit - commit count changes/regressions (dev environment only)
9
+
10
+ ## Releases and Important Milestones
11
+
12
+ ### Version 3.11.0 - PyPI release date 2025-04-TBD
13
+
14
+ - Major API change
15
+ - swapped names `ca` and `CA`
16
+ - class name now `CA`
17
+ - factory function taking variable number of arguments is now `ca`
18
+ - class initializer still takes `1` or `0` iterables
19
+ - still want this class to behave like a builtin
20
+ - but got tired fighting linters
21
+ - maybe being "Pythonic" means
22
+ - that only builtins should break naming conventions
23
+ - naming conventions being
24
+ - snake_case for functions and method names
25
+ - CamelCase for class names
26
+ - perhaps a visual distinction is useful to tell when you
27
+ - are dealing with user/library Python code
28
+ - C code presenting itself as a Python class
29
+
30
+ ### Version 3.10.1 - PyPI release date 2025-04-03
31
+
32
+ - Major API changes
33
+ - class name still `ca`
34
+ - initializer takes 1 or 0 iterables
35
+ - like Python builtin types `list` or `tuple`
36
+ - factory function `CA` provided to create a `ca` from mult args
37
+ - like `[]` or `{}`
38
+ - otherwise, method names are all snake_case compatible
39
+ - examples
40
+ - popL -> popl
41
+ - pushR -> pushr
42
+ - fractionFilled -> fraction_filled
43
+ - updated pyproject.toml
44
+ - to better match other dtools namespace projects
45
+
46
+ ### Version 3.9.1 - PyPI release date 2025-02-16
47
+
48
+ - Fixed pdoc issues with new typing notation
49
+ - updated docstrings
50
+ - had to add TypeVars
51
+
52
+ ### Version 3.9.0 - PyPI release date 2025-01-16
53
+
54
+ - Final release as dtools.circular-array
55
+ - was previously grscheller.circular-array
56
+
57
+ ### Version 3.8.0 - PyPI release date 2025-01-03
58
+
59
+ - now circular-array indexing methods fully support slicing
60
+ - `__getitem__`
61
+ - `__setitem__`
62
+ - `__delitem__`
63
+ - added rotL(n) and rotR(n) methods
64
+
65
+ ### Version 3.7.1 - PyPI release date 2024-11-18
66
+
67
+ - for internal changes
68
+ - mostly for consistency across PyPI namespace projects
69
+
70
+ ### Version 3.7.0 - PyPI release date 2024-10-26
71
+
72
+ - regenerated docs for PyPI release
73
+
74
+ ### Version 3.6.3.2 - Commit date 2024-10-20
75
+
76
+ - preparing for a 3.7.0 PyPI release
77
+ - renamed class ca -> CA
78
+ - ca now takes 0 or 1 iterables
79
+ - created factory function for original constructor use case
80
+ - `CA[D](*ds: D) -> ca[D]`
81
+ - generated docs in docs repo - 2024-10-23
82
+
83
+ ### Version 3.6.2 - PyPI release date 2024-10-20
84
+
85
+ - removed docs from repo
86
+ - docs for all grscheller namespace projects located
87
+ [here](https://grscheller.github.io/grscheller-pypi-namespace-docs/).
88
+
89
+ ### Version 3.6.1 - PyPI release date 2024-10-18
90
+
91
+ - infrastructure and minor docstring changes
92
+ - should be compatible with version 3.6.0
93
+
94
+ ### Version 3.6.0 - PyPI release date 2024-09-21
95
+
96
+ - no future changes planned for the foreseeable future
97
+ - feature complete
98
+ - no external dependencies
99
+ - well tested with other grscheller namespace packages
100
+ - final API tweaks made
101
+ - several more pytest tests added
102
+ - made the `compact` method private
103
+ - now called `_compact_storage_capacity`
104
+
105
+ ### Version 3.5.0 - PyPI release date 2024-09-21
106
+
107
+ - made the `double` method private
108
+ - now called `_double_storage_capacity`
109
+ - major docstring improvements
110
+ - improved indentation and code alignment
111
+ - now much more Pythonic
112
+
113
+ ### Version 3.4.1 - PyPI release date 2024-08-17
114
+
115
+ - updated README.md to reflect name changes of CA methods
116
+ - docstring improvements
117
+
118
+ ### Version 3.4.0 - PyPI release date 2024-08-15
119
+
120
+ - updated `__eq__` comparisons
121
+ - first compare elements by identity before equality
122
+ - noticed that is what Python builtins do
123
+ - makes dealing with grscheller.fp.nada module easier
124
+ - standardizing docstrings across grscheller PyPI projects
125
+
126
+ ### Version 3.3.0.1 - commit date 2024-08-05
127
+
128
+ - made a paradigm "regression", preparing for a 3.4.0 release
129
+ - felt CA was becoming way too complicated
130
+ - grscheller.datastructures needed it to fully embrace type annotations
131
+ - but I was shifting too many features back into grscheller.circular-array
132
+ - want ca to be useful for non-functional applications
133
+ - changes made
134
+ - removed grscheller.fp dependency
135
+ - remove `_sentinel` and `_storable` slots from CA class
136
+ - remove copy method, just use `ca2 = CA(*ca1)` to make a shallow copy
137
+ - adjust `__repr__` and `__str__` methods
138
+ - experimenting with Spinx syntax in docstrings (still using pdoc3)
139
+ - changed nomenclature from "left/right" to "front/rear"
140
+ - unsafe and safe versions of pop & fold functionality
141
+ - left and right folds improvements
142
+ - consolidated `foldL, foldL1, foldR, foldR1` into `foldL` & `foldR`
143
+ - TODO: rename `foldL` to `fold_forward` & `foldR` to `fold_backward`
144
+ - tests working
145
+ - basically I changed pops to unsafe pops and added `try except` blocks
146
+ - safe versions tests needed
147
+ - safe pops return multiple values in tuples
148
+ - will take a `default` value to return
149
+ - if only asked to return 1 value and CA is empty
150
+ - seems to work properly from iPython
151
+
152
+ ### Version 3.2.0 - PyPI release date 2024-07-26
153
+
154
+ - class name changed CircularArray -> CA
155
+ - Now takes a "sentinel" or "fallback" value in its initializer
156
+ - formally used None for this
157
+
158
+ ### Version 3.1.0 - PyPI release date 2024-07-11
159
+
160
+ - generic typing now being used
161
+ - first PyPI release where mult values can be pushed on CircularArray
162
+
163
+ ### Version 3.0.0 - commit date 2024-06-28
164
+
165
+ - CircularArray class now using Generic Type Parameter
166
+
167
+ - new epoch in development, start of 3.0 series
168
+
169
+ - now using TypeVars
170
+
171
+ - API changes
172
+
173
+ - `foldL(self, f: Callable[[T, T], T]) -> T|None`
174
+ - `foldR(self, f: Callable[[T, T], T]) -> T|None`
175
+ - `foldL1(self, f: Callable[[S, T], S], initial: S) -> S`
176
+ - `foldR1(self, f: Callable[[T, S], S], initial: S) -> S`
177
+
178
+ ### Version 2.0.0 - PyPI release date 2024-03-08
179
+
180
+ - new epoch due to resizing bug fixed on previous commit
181
+ - much improved and cleaned up
182
+ - much better test suite
183
+ - method `_double()` made "public" and renamed `double()`
184
+ - method `resize(new_size)` now resizes to at least new_size
185
+
186
+ ### Version 1.1.0.0 - commit date 2024-03-08
187
+
188
+ - NEXT PyPI RELEASE WILL BE 2.0.0 !!!!!!!!!!!
189
+ - BUGFIX: Fixed a subtle resizing bug
190
+ - bug probably present in all previous versions
191
+ - not previously identified due to inadequate test coverage
192
+ - test coverage improved vastly
193
+ - made some major code API changes
194
+ - upon initialization minimizing size of the CircularArray
195
+ - have some ideas on how to to improve API for resizing CircularArrays
196
+ - need to test my other 2 PyPI projects
197
+ - both use circular-array as a dependency
198
+
199
+ ### Version 1.0.1 - PyPI release date 2024-03-01
200
+
201
+ - docstring updates to match other grscheller PyPI repos
202
+
203
+ ### Version 1.0.0 - PyPI release date 2024-02-10
204
+
205
+ - first stable release
206
+ - dropped minimum Python requirement to 3.10
207
+
208
+ ### Version 0.1.1 - PyPI release date 2024-01-30
209
+
210
+ - changed circular-array from a package to just a module
211
+ - actually breaking API change
212
+ - version number should have been 0.2.0
213
+ - gave CircularArray class `foldL` & `foldR` methods
214
+
215
+ ### Version 0.1.0 - PyPI release date 2024-01-28
216
+
217
+ - initial PyPI grscheller.circular-array release
218
+ - migrated Circulararray class from grscheller.datastructures
219
+ - update docstrings to reflect current nomenclature
220
+
221
+ ### Version 0.0.3 - commit date 2024-01-28
222
+
223
+ - got gh-pages working for the repo
224
+
225
+ ### Version 0.0.2 - commit date 2024-01-28
226
+
227
+ - pushed repo up to GitHub
228
+ - created README.md file for project
229
+
230
+ ### Version 0.0.1 - commit date 2024-01-28
231
+
232
+ - decided to split Circulararray class out of datastructures
233
+ - will make it its own PyPI project
234
+ - got working with datastructures locally
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: dtools.circular-array
3
+ Version: 3.11.0
4
+ Summary: ### Developer Tools - circular array data structure
5
+ Keywords: circular array,circle array,CA,dequeue,dqueue,FIFO,LIFO,pop,push,indexable,auto-resizing,auto resizing,resizing
6
+ Author-email: "Geoffrey R. Scheller" <geoffrey@scheller.com>
7
+ Requires-Python: >=3.12
8
+ Description-Content-Type: text/markdown
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Framework :: Pytest
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Typing :: Typed
16
+ License-File: LICENSE
17
+ Requires-Dist: pytest >=8.3.5 ; extra == "test"
18
+ Project-URL: Changelog, https://github.com/grscheller/dtools-circular-array/blob/main/CHANGELOG.md
19
+ Project-URL: Documentation, https://grscheller.github.io/dtools-docs/circular-array
20
+ Project-URL: Source, https://github.com/grscheller/dtools-circular-array
21
+ Provides-Extra: test
22
+
23
+ # Developer Tools - Circular Array
24
+
25
+ Python package containing a module implementing a circular array data
26
+ structure,
27
+
28
+ - **Repositories**
29
+ - [dtools.circular-array][1] project on *PyPI*
30
+ - [Source code][2] on *GitHub*
31
+ - **Detailed documentation**
32
+ - [Detailed API documentation][3] on *GH-Pages*
33
+
34
+ This project is part of the [Developer Tools for Python][4] **dtools.**
35
+ namespace project.
36
+
37
+ ## Overview
38
+
39
+ - O(1) amortized pushes and pops either end.
40
+ - O(1) indexing
41
+ - fully supports slicing
42
+ - safely mutates while iterating over copies of previous state
43
+
44
+ ### Module circular_array
45
+
46
+ A full featured, auto resizing circular array. Python package containing
47
+ a module implementing a full featured, indexable, sliceable, double
48
+ sided, auto-resizing circular array data structure.
49
+
50
+ Useful either if used directly as an improved version of a Python List
51
+ or in a "has-a" relationship when implementing other data structures.
52
+
53
+ - *module* dtools.circular_array
54
+ - *class* ca: circular array data structure
55
+ - *function* CA: factory function to produce a ca from data
56
+
57
+ Above nomenclature modeled after of a builtin data type like `list`, where
58
+ `ca` takes an optional iterator as an argument and CA is all caps to represent
59
+ syntactic sugar like `[]` or `{}`.
60
+
61
+ #### Usage
62
+
63
+ ```python
64
+ from dtools.circular_array.ca import CA
65
+
66
+ ca1 = ca(1, 2, 3)
67
+ assert ca1.popl() == 1
68
+ assert ca1.popr() == 3
69
+ ca1.pushr(42, 0)
70
+ ca1.pushl(0, 1)
71
+ assert repr(ca1) == 'ca(1, 0, 2, 42, 0)'
72
+ assert str(ca1) == '(|1, 0, 2, 42, 0|)'
73
+
74
+ ca2 = CA(range(1,11))
75
+ assert repr(ca2) == 'ca(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)'
76
+ assert str(ca2) == '(|1, 2, 3, 4, 5, 6, 7, 8, 9, 10|)'
77
+ assert len(ca2) == 10
78
+ tup3 = ca2.poplt(3)
79
+ tup4 = ca2.poprt(4)
80
+ assert tup3 == (1, 2, 3)
81
+ assert tup4 == (10, 9, 8, 7)
82
+ assert ca2 == CA(4, 5, 6)
83
+ four, *rest = ca.popft(1000)
84
+ assert four == 4
85
+ assert rest == [5, 6]
86
+ assert len(ca2) == 0
87
+
88
+ ca3 = CA([1, 2, 3])
89
+ assert ca3.popld(42) == 1
90
+ assert ca3.poprd(42) == 3
91
+ assert ca3.popld(42) == 2
92
+ assert ca3.poprd(42) == 42
93
+ assert ca3.popld(42) == 42
94
+ assert len(ca2) == 0
95
+ ```
96
+
97
+ ______________________________________________________________________
98
+
99
+ [1]: https://pypi.org/project/dtools.circular-array
100
+ [2]: https://github.com/grscheller/dtools-circular-array
101
+ [3]: https://grscheller.github.io/dtools-docs/circular-array
102
+ [4]: https://github.com/grscheller/dtools-docs
103
+
@@ -0,0 +1,80 @@
1
+ # Developer Tools - Circular Array
2
+
3
+ Python package containing a module implementing a circular array data
4
+ structure,
5
+
6
+ - **Repositories**
7
+ - [dtools.circular-array][1] project on *PyPI*
8
+ - [Source code][2] on *GitHub*
9
+ - **Detailed documentation**
10
+ - [Detailed API documentation][3] on *GH-Pages*
11
+
12
+ This project is part of the [Developer Tools for Python][4] **dtools.**
13
+ namespace project.
14
+
15
+ ## Overview
16
+
17
+ - O(1) amortized pushes and pops either end.
18
+ - O(1) indexing
19
+ - fully supports slicing
20
+ - safely mutates while iterating over copies of previous state
21
+
22
+ ### Module circular_array
23
+
24
+ A full featured, auto resizing circular array. Python package containing
25
+ a module implementing a full featured, indexable, sliceable, double
26
+ sided, auto-resizing circular array data structure.
27
+
28
+ Useful either if used directly as an improved version of a Python List
29
+ or in a "has-a" relationship when implementing other data structures.
30
+
31
+ - *module* dtools.circular_array
32
+ - *class* ca: circular array data structure
33
+ - *function* CA: factory function to produce a ca from data
34
+
35
+ Above nomenclature modeled after of a builtin data type like `list`, where
36
+ `ca` takes an optional iterator as an argument and CA is all caps to represent
37
+ syntactic sugar like `[]` or `{}`.
38
+
39
+ #### Usage
40
+
41
+ ```python
42
+ from dtools.circular_array.ca import CA
43
+
44
+ ca1 = ca(1, 2, 3)
45
+ assert ca1.popl() == 1
46
+ assert ca1.popr() == 3
47
+ ca1.pushr(42, 0)
48
+ ca1.pushl(0, 1)
49
+ assert repr(ca1) == 'ca(1, 0, 2, 42, 0)'
50
+ assert str(ca1) == '(|1, 0, 2, 42, 0|)'
51
+
52
+ ca2 = CA(range(1,11))
53
+ assert repr(ca2) == 'ca(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)'
54
+ assert str(ca2) == '(|1, 2, 3, 4, 5, 6, 7, 8, 9, 10|)'
55
+ assert len(ca2) == 10
56
+ tup3 = ca2.poplt(3)
57
+ tup4 = ca2.poprt(4)
58
+ assert tup3 == (1, 2, 3)
59
+ assert tup4 == (10, 9, 8, 7)
60
+ assert ca2 == CA(4, 5, 6)
61
+ four, *rest = ca.popft(1000)
62
+ assert four == 4
63
+ assert rest == [5, 6]
64
+ assert len(ca2) == 0
65
+
66
+ ca3 = CA([1, 2, 3])
67
+ assert ca3.popld(42) == 1
68
+ assert ca3.poprd(42) == 3
69
+ assert ca3.popld(42) == 2
70
+ assert ca3.poprd(42) == 42
71
+ assert ca3.popld(42) == 42
72
+ assert len(ca2) == 0
73
+ ```
74
+
75
+ ______________________________________________________________________
76
+
77
+ [1]: https://pypi.org/project/dtools.circular-array
78
+ [2]: https://github.com/grscheller/dtools-circular-array
79
+ [3]: https://grscheller.github.io/dtools-docs/circular-array
80
+ [4]: https://github.com/grscheller/dtools-docs
@@ -4,9 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "dtools.circular-array"
7
- authors = [
8
- { name = "Geoffrey R. Scheller", email = "geoffrey@scheller.com" },
9
- ]
7
+ authors = [{ name = "Geoffrey R. Scheller", email = "geoffrey@scheller.com" }]
10
8
  license = { file = "LICENSE" }
11
9
  readme = "README.md"
12
10
  requires-python = ">=3.12"
@@ -17,19 +15,28 @@ classifiers = [
17
15
  "License :: OSI Approved :: Apache Software License",
18
16
  "Operating System :: OS Independent",
19
17
  "Programming Language :: Python :: 3.13",
20
- "Typing :: Typed"
18
+ "Typing :: Typed",
21
19
  ]
22
20
  dependencies = []
23
21
  dynamic = ["version", "description"]
24
22
  keywords = [
25
- "circular array", "circle array", "CA",
26
- "double ended queue", "dequeue", "dqueue",
27
- "pop", "push", "popL", "popR", "pushL", "pushR", "indexable",
28
- "auto-resizing", "auto resizing", "resizing"
23
+ "circular array",
24
+ "circle array",
25
+ "CA",
26
+ "dequeue",
27
+ "dqueue",
28
+ "FIFO",
29
+ "LIFO",
30
+ "pop",
31
+ "push",
32
+ "indexable",
33
+ "auto-resizing",
34
+ "auto resizing",
35
+ "resizing",
29
36
  ]
30
37
 
31
38
  [project.optional-dependencies]
32
- test = ["pytest >=8.3.2"]
39
+ test = ["pytest >=8.3.5"]
33
40
 
34
41
  [project.urls]
35
42
  Source = "https://github.com/grscheller/dtools-circular-array"
@@ -37,7 +44,10 @@ Changelog = "https://github.com/grscheller/dtools-circular-array/blob/main/CHANG
37
44
  Documentation = "https://grscheller.github.io/dtools-docs/circular-array"
38
45
 
39
46
  [tool.flit.sdist]
40
- exclude = ["dist", "docs", ".gitignore", ".mypy_cache"]
47
+ exclude = ["dist", "tests", ".gitignore", ".mypy_cache", ".pytest_cache"]
48
+
49
+ [tool.pytest.ini_options]
50
+ consider_namespace_packages = true
41
51
 
42
52
  [tool.pylsp-mypy]
43
53
  enabled = true
@@ -47,10 +57,11 @@ report_progress = true
47
57
 
48
58
  [tool.mypy]
49
59
  enable_incomplete_feature = ["NewGenericSyntax"]
50
-
51
- [tool.pytest.ini_options]
52
- testpaths = ["tests"]
53
- consider_namespace_packages = true
60
+ implicit_reexport = false
61
+ local_partial_types = true
62
+ warn_redundant_casts = true
63
+ warn_return_any = true
64
+ warn_unused_configs = true
54
65
 
55
66
  [tool.ruff]
56
67
  target-version = "py313"
@@ -58,8 +69,9 @@ target-version = "py313"
58
69
  [tool.ruff.lint.per-file-ignores]
59
70
  "__init__.py" = ["F401"]
60
71
 
61
- [tool.ruff.format]
62
- quote-style = "single"
63
-
64
72
  [tool.ruff.lint.flake8-quotes]
65
73
  docstring-quotes = "double"
74
+
75
+ [tool.ruff.format]
76
+ quote-style = "single"
77
+ docstring-code-line-length = 72
@@ -0,0 +1,34 @@
1
+ # Copyright 2023-2025 Geoffrey R. Scheller
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """### Developer Tools - circular array data structure
16
+
17
+ Package for an indexable, sliceable, auto-resizing circular array
18
+ data structure with amortized O(1) pushes and pops either end.
19
+
20
+ #### Circular Array Data Structure
21
+
22
+ * *module* dtools.circular_array.ca
23
+ * circular array data structure
24
+ * *class* dtools.circular_array.ca.CA
25
+ * initializer takes 1 or 0 iterables
26
+ * *function* dtools.circular_array.ca.ca
27
+ * factory function taking a variable number of arguments
28
+
29
+ """
30
+
31
+ __version__ = '3.11.0'
32
+ __author__ = 'Geoffrey R. Scheller'
33
+ __copyright__ = 'Copyright (c) 2023-2025 Geoffrey R. Scheller'
34
+ __license__ = 'Apache License 2.0'