crackerjack 0.1.10__tar.gz → 0.1.12__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.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- {crackerjack-0.1.10 → crackerjack-0.1.12}/PKG-INFO +23 -8
- {crackerjack-0.1.10 → crackerjack-0.1.12}/README.md +22 -7
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/.pre-commit-config.yaml +3 -3
- {crackerjack-0.1.10 → crackerjack-0.1.12/crackerjack}/pyproject.toml +4 -3
- {crackerjack-0.1.10/crackerjack → crackerjack-0.1.12}/pyproject.toml +4 -4
- crackerjack-0.1.10/crackerjack/test1.py +0 -249
- {crackerjack-0.1.10 → crackerjack-0.1.12}/LICENSE +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/.crackerjack-config.yaml +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/.gitignore +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/.ruff_cache/.gitignore +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/.ruff_cache/CACHEDIR.TAG +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/__init__.py +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/__main__.py +0 -0
- {crackerjack-0.1.10 → crackerjack-0.1.12}/crackerjack/crackerjack.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: crackerjack
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: Crackerjack code formatting style.
|
|
5
5
|
Keywords: black ruff mypy creosote refurb
|
|
6
6
|
Home-page: https://github.com/lesleslie/crackerjack
|
|
@@ -33,10 +33,13 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
|
|
34
34
|
Crackerjack is a python coding style which uses a minimalist approach to produce elegant, easy to read, code.
|
|
35
35
|
|
|
36
|
+
crack·er·jack ˈkra-kər-ˌjak
|
|
37
|
+
: a person or thing of marked excellence
|
|
38
|
+
|
|
36
39
|
### **Why Crackerjack?**
|
|
37
40
|
|
|
38
|
-
Crackerjack works on the theory that with static typing and explicit
|
|
39
|
-
|
|
41
|
+
Crackerjack works on the theory that with static typing and explicit class,
|
|
42
|
+
function, variable, and other object names - the code should be
|
|
40
43
|
straight forward to read and the documentation should pretty much be able to write
|
|
41
44
|
itself. Crackerjack provides a set of guidelines and utilities to keep the codebase clean, elegant, standardized, and
|
|
42
45
|
easily readable.
|
|
@@ -57,15 +60,17 @@ This package:
|
|
|
57
60
|
|
|
58
61
|
- streamlines code with refurb
|
|
59
62
|
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
- installs, or updates, a projects pre-commit tools and gitignore
|
|
63
|
+
- installs, or updates, a project's pre-commit tools and gitignore
|
|
63
64
|
to comply with evolving crackerjack standards
|
|
64
65
|
|
|
65
66
|
- removes pipenv, poetry, and hatch build, dependency management, and virtual environment
|
|
66
|
-
management packages and
|
|
67
|
+
management packages and replaces them with PDM using PEP 582
|
|
68
|
+
|
|
69
|
+
- converts/creates documentation in Markdown (md) - Coming Soon!
|
|
67
70
|
|
|
68
|
-
- generates pytest mock stubs if needed
|
|
71
|
+
- runs tests and generates pytest mock stubs if needed - Coming Soon!
|
|
72
|
+
|
|
73
|
+
- bumps the project version and publishes it to PyPI
|
|
69
74
|
|
|
70
75
|
### **What are the rules?**
|
|
71
76
|
|
|
@@ -112,9 +117,19 @@ From your projects root directory:
|
|
|
112
117
|
|
|
113
118
|
Cracker jack will take care of the rest.
|
|
114
119
|
|
|
120
|
+
For a full list of options:
|
|
121
|
+
|
|
122
|
+
```python -m crackerjack -h```
|
|
123
|
+
|
|
115
124
|
When you ready to publish your project:
|
|
116
125
|
|
|
117
126
|
``python -m crackerjack -p micro``
|
|
118
127
|
|
|
119
128
|
The -p option not only publishes your project but will bump your
|
|
120
129
|
project version for you. The options are 'micro', 'minor', and 'major'.
|
|
130
|
+
|
|
131
|
+
## Acknowledgements
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
BSD-3-Clause
|
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
Crackerjack is a python coding style which uses a minimalist approach to produce elegant, easy to read, code.
|
|
8
8
|
|
|
9
|
+
crack·er·jack ˈkra-kər-ˌjak
|
|
10
|
+
: a person or thing of marked excellence
|
|
11
|
+
|
|
9
12
|
### **Why Crackerjack?**
|
|
10
13
|
|
|
11
|
-
Crackerjack works on the theory that with static typing and explicit
|
|
12
|
-
|
|
14
|
+
Crackerjack works on the theory that with static typing and explicit class,
|
|
15
|
+
function, variable, and other object names - the code should be
|
|
13
16
|
straight forward to read and the documentation should pretty much be able to write
|
|
14
17
|
itself. Crackerjack provides a set of guidelines and utilities to keep the codebase clean, elegant, standardized, and
|
|
15
18
|
easily readable.
|
|
@@ -30,15 +33,17 @@ This package:
|
|
|
30
33
|
|
|
31
34
|
- streamlines code with refurb
|
|
32
35
|
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
- installs, or updates, a projects pre-commit tools and gitignore
|
|
36
|
+
- installs, or updates, a project's pre-commit tools and gitignore
|
|
36
37
|
to comply with evolving crackerjack standards
|
|
37
38
|
|
|
38
39
|
- removes pipenv, poetry, and hatch build, dependency management, and virtual environment
|
|
39
|
-
management packages and
|
|
40
|
+
management packages and replaces them with PDM using PEP 582
|
|
41
|
+
|
|
42
|
+
- converts/creates documentation in Markdown (md) - Coming Soon!
|
|
40
43
|
|
|
41
|
-
- generates pytest mock stubs if needed
|
|
44
|
+
- runs tests and generates pytest mock stubs if needed - Coming Soon!
|
|
45
|
+
|
|
46
|
+
- bumps the project version and publishes it to PyPI
|
|
42
47
|
|
|
43
48
|
### **What are the rules?**
|
|
44
49
|
|
|
@@ -85,9 +90,19 @@ From your projects root directory:
|
|
|
85
90
|
|
|
86
91
|
Cracker jack will take care of the rest.
|
|
87
92
|
|
|
93
|
+
For a full list of options:
|
|
94
|
+
|
|
95
|
+
```python -m crackerjack -h```
|
|
96
|
+
|
|
88
97
|
When you ready to publish your project:
|
|
89
98
|
|
|
90
99
|
``python -m crackerjack -p micro``
|
|
91
100
|
|
|
92
101
|
The -p option not only publishes your project but will bump your
|
|
93
102
|
project version for you. The options are 'micro', 'minor', and 'major'.
|
|
103
|
+
|
|
104
|
+
## Acknowledgements
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
BSD-3-Clause
|
|
@@ -18,7 +18,7 @@ repos:
|
|
|
18
18
|
- id: black
|
|
19
19
|
language_version: python3.11
|
|
20
20
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
21
|
-
rev: v0.0.
|
|
21
|
+
rev: v0.0.270
|
|
22
22
|
hooks:
|
|
23
23
|
- id: ruff
|
|
24
24
|
- repo: https://github.com/fredrikaverpil/creosote
|
|
@@ -50,7 +50,7 @@ repos:
|
|
|
50
50
|
- autotyping==23.3.0
|
|
51
51
|
- libcst==0.4.9
|
|
52
52
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
53
|
-
rev: v1.
|
|
53
|
+
rev: v1.3.0
|
|
54
54
|
hooks:
|
|
55
55
|
- id: mypy
|
|
56
56
|
# - repo: https://github.com/pdoc3/pdoc
|
|
@@ -64,7 +64,7 @@ repos:
|
|
|
64
64
|
# types: [ python ]
|
|
65
65
|
# always_run: true
|
|
66
66
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
|
67
|
-
rev: v0.0.
|
|
67
|
+
rev: v0.0.270
|
|
68
68
|
hooks:
|
|
69
69
|
- id: ruff
|
|
70
70
|
- repo: https://github.com/psf/black
|
|
@@ -30,6 +30,9 @@ target-version = [
|
|
|
30
30
|
strict = false
|
|
31
31
|
pretty = true
|
|
32
32
|
ignore_missing_imports = false
|
|
33
|
+
plugins = [
|
|
34
|
+
"pydantic.mypy"
|
|
35
|
+
]
|
|
33
36
|
|
|
34
37
|
[tool.refurb]
|
|
35
38
|
enable_all = true
|
|
@@ -41,7 +44,7 @@ inputs = [
|
|
|
41
44
|
|
|
42
45
|
[project]
|
|
43
46
|
name = "Crackerjack"
|
|
44
|
-
version = "0.1.
|
|
47
|
+
version = "0.1.6"
|
|
45
48
|
description = "Crackerjack code formatting style."
|
|
46
49
|
requires-python = ">=3.11"
|
|
47
50
|
readme = "README.md"
|
|
@@ -53,8 +56,6 @@ keywords = [
|
|
|
53
56
|
"refurb",
|
|
54
57
|
]
|
|
55
58
|
classifiers = [
|
|
56
|
-
"Environment :: Console",
|
|
57
|
-
"Operating System :: OS Independent",
|
|
58
59
|
"Programming Language :: Python",
|
|
59
60
|
"Programming Language :: Python :: 3.11",
|
|
60
61
|
]
|
|
@@ -30,13 +30,13 @@ target-version = [
|
|
|
30
30
|
strict = false
|
|
31
31
|
pretty = true
|
|
32
32
|
ignore_missing_imports = false
|
|
33
|
-
|
|
33
|
+
plugins = [
|
|
34
|
+
"pydantic.mypy",
|
|
35
|
+
]
|
|
34
36
|
|
|
35
37
|
[tool.refurb]
|
|
36
38
|
enable_all = true
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
40
|
[tool.pytype]
|
|
41
41
|
inputs = [
|
|
42
42
|
"package_name",
|
|
@@ -44,7 +44,7 @@ inputs = [
|
|
|
44
44
|
|
|
45
45
|
[project]
|
|
46
46
|
name = "Crackerjack"
|
|
47
|
-
version = "0.1.
|
|
47
|
+
version = "0.1.12"
|
|
48
48
|
description = "Crackerjack code formatting style."
|
|
49
49
|
requires-python = ">=3.11"
|
|
50
50
|
readme = "README.md"
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
This is the "example" module.
|
|
3
|
-
|
|
4
|
-
The example module supplies one function, factorial(). For example,
|
|
5
|
-
|
|
6
|
-
120
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def factorial(n):
|
|
11
|
-
"""Return the factorial of n, an exact integer >= 0.
|
|
12
|
-
|
|
13
|
-
[1, 1, 2, 6, 24, 120]
|
|
14
|
-
265252859812191058636308480000000
|
|
15
|
-
Traceback (most recent call last):
|
|
16
|
-
...
|
|
17
|
-
ValueError: n must be >= 0
|
|
18
|
-
|
|
19
|
-
Factorials of floats are OK, but the float must be an exact integer:
|
|
20
|
-
Traceback (most recent call last):
|
|
21
|
-
...
|
|
22
|
-
ValueError: n must be exact integer
|
|
23
|
-
265252859812191058636308480000000
|
|
24
|
-
|
|
25
|
-
It must also not be ridiculously large:
|
|
26
|
-
Traceback (most recent call last):
|
|
27
|
-
...
|
|
28
|
-
OverflowError: n too large
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
import math
|
|
32
|
-
|
|
33
|
-
if not n >= 0:
|
|
34
|
-
raise ValueError("n must be >= 0")
|
|
35
|
-
if math.floor(n) != n:
|
|
36
|
-
raise ValueError("n must be exact integer")
|
|
37
|
-
if n + 1 == n: # catch a value like 1e300
|
|
38
|
-
raise OverflowError("n too large")
|
|
39
|
-
result = 1
|
|
40
|
-
factor = 2
|
|
41
|
-
while factor <= n:
|
|
42
|
-
result *= factor
|
|
43
|
-
factor += 1
|
|
44
|
-
return result
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# Fibonacci numbers module
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def fib(n) -> None: # write Fibonacci series up to n
|
|
51
|
-
a, b = 0, 1
|
|
52
|
-
while a < n:
|
|
53
|
-
print(a, end=" ")
|
|
54
|
-
a, b = b, a + b
|
|
55
|
-
print()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def fib2(n): # return Fibonacci series up to n
|
|
59
|
-
result = []
|
|
60
|
-
a, b = 0, 1
|
|
61
|
-
while a < n:
|
|
62
|
-
result.append(a)
|
|
63
|
-
a, b = b, a + b
|
|
64
|
-
return result
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def func1(param1: str, param2: str = "default val") -> None:
|
|
68
|
-
"""Description of func with docstring javadoc style.
|
|
69
|
-
@param param1: descr of param
|
|
70
|
-
@type param1: type
|
|
71
|
-
@return: some value
|
|
72
|
-
@raise KeyError: raises a key exception
|
|
73
|
-
"""
|
|
74
|
-
pass
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def func2(param1, param2: str = "default val2") -> list:
|
|
78
|
-
"""Description of func with docstring reST style.
|
|
79
|
-
:param param1: descr of param
|
|
80
|
-
:type param1: type
|
|
81
|
-
:returns: some value
|
|
82
|
-
:raises keyError: raises exception
|
|
83
|
-
"""
|
|
84
|
-
pass
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def func3(param1, param2: str = "default val") -> None:
|
|
88
|
-
"""Description of func with docstring groups style.
|
|
89
|
-
Params:
|
|
90
|
-
param1 - descr of param
|
|
91
|
-
Returns:
|
|
92
|
-
some value
|
|
93
|
-
Raises:
|
|
94
|
-
keyError: raises key exception
|
|
95
|
-
TypeError: raises type exception
|
|
96
|
-
"""
|
|
97
|
-
pass
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class SomeClass(object):
|
|
101
|
-
"""My class."""
|
|
102
|
-
|
|
103
|
-
def method(self, prm) -> None:
|
|
104
|
-
"""description"""
|
|
105
|
-
pass
|
|
106
|
-
|
|
107
|
-
def method2(self, prm1, prm2: str = "defaultprm") -> None:
|
|
108
|
-
pass
|
|
109
|
-
|
|
110
|
-
def method_numpy(self) -> None:
|
|
111
|
-
"""
|
|
112
|
-
My numpydoc description of a kind
|
|
113
|
-
of very exhautive numpydoc format docstring.
|
|
114
|
-
Parameters
|
|
115
|
-
----------
|
|
116
|
-
first : array_like
|
|
117
|
-
the 1st param name `first`
|
|
118
|
-
second :
|
|
119
|
-
the 2nd param
|
|
120
|
-
third : {'value', 'other'}, optional
|
|
121
|
-
the 3rd param, by default 'value'
|
|
122
|
-
Returns
|
|
123
|
-
-------
|
|
124
|
-
string
|
|
125
|
-
a value in a string
|
|
126
|
-
Raises
|
|
127
|
-
------
|
|
128
|
-
KeyError
|
|
129
|
-
when a key error
|
|
130
|
-
OtherError
|
|
131
|
-
when an other error
|
|
132
|
-
See Also
|
|
133
|
-
--------
|
|
134
|
-
a_func : linked (optional), with things to say
|
|
135
|
-
on several lines
|
|
136
|
-
some blabla
|
|
137
|
-
Note
|
|
138
|
-
----
|
|
139
|
-
Some informations.
|
|
140
|
-
Some maths also:
|
|
141
|
-
.. math:: f(x) = e^{- x}
|
|
142
|
-
References
|
|
143
|
-
----------
|
|
144
|
-
Biblio with cited ref [1]_. The ref can be cited in Note section.
|
|
145
|
-
.. [1] Adel Daouzli, Sylvain Saïghi, Michelle Rudolph, Alain Destexhe,
|
|
146
|
-
Sylvie Renaud: Convergence in an Adaptive Neural Network:
|
|
147
|
-
The Influence of Noise Inputs Correlation. IWANN (1) 2009: 140-148
|
|
148
|
-
Examples
|
|
149
|
-
--------
|
|
150
|
-
This is example of use
|
|
151
|
-
a
|
|
152
|
-
"""
|
|
153
|
-
pass
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"I am a single-line comment"
|
|
157
|
-
|
|
158
|
-
"""
|
|
159
|
-
I am a
|
|
160
|
-
multi-line comment!
|
|
161
|
-
"""
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
def square(n):
|
|
165
|
-
"""Takes in a number n, returns the square of n"""
|
|
166
|
-
return n**2
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def add_binary(a, b):
|
|
170
|
-
"""
|
|
171
|
-
Returns the sum of two decimal numbers in binary digits.
|
|
172
|
-
|
|
173
|
-
Parameters:
|
|
174
|
-
a (int): A decimal integer
|
|
175
|
-
b (int): Another decimal integer
|
|
176
|
-
|
|
177
|
-
Returns:
|
|
178
|
-
binary_sum (str): Binary string of the sum of a and b
|
|
179
|
-
"""
|
|
180
|
-
binary_sum = bin(a + b)[2:]
|
|
181
|
-
return binary_sum
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
class Person:
|
|
185
|
-
"""
|
|
186
|
-
A class to represent a person.
|
|
187
|
-
|
|
188
|
-
...
|
|
189
|
-
|
|
190
|
-
Attributes
|
|
191
|
-
----------
|
|
192
|
-
name : str
|
|
193
|
-
first name of the person
|
|
194
|
-
surname : str
|
|
195
|
-
family name of the person
|
|
196
|
-
age : int
|
|
197
|
-
age of the person
|
|
198
|
-
|
|
199
|
-
Methods
|
|
200
|
-
-------
|
|
201
|
-
info(additional=""):
|
|
202
|
-
Prints the person's name and age.
|
|
203
|
-
"""
|
|
204
|
-
|
|
205
|
-
def __init__(self, name: str, surname: str, age) -> None:
|
|
206
|
-
"""
|
|
207
|
-
Constructs all the necessary attributes for the person object.
|
|
208
|
-
|
|
209
|
-
Parameters
|
|
210
|
-
----------
|
|
211
|
-
name : str
|
|
212
|
-
first name of the person
|
|
213
|
-
surname : str
|
|
214
|
-
family name of the person
|
|
215
|
-
age : int
|
|
216
|
-
age of the person
|
|
217
|
-
"""
|
|
218
|
-
|
|
219
|
-
self.name = name
|
|
220
|
-
self.surname = surname
|
|
221
|
-
self.age = age
|
|
222
|
-
|
|
223
|
-
def info(self, additional: str = "") -> None:
|
|
224
|
-
"""
|
|
225
|
-
Prints the person's name and age.
|
|
226
|
-
|
|
227
|
-
If the argument 'additional' is passed, then it is appended after the main info.
|
|
228
|
-
|
|
229
|
-
Parameters
|
|
230
|
-
----------
|
|
231
|
-
additional : str, optional
|
|
232
|
-
More info to be displayed (default is None)
|
|
233
|
-
|
|
234
|
-
Returns
|
|
235
|
-
-------
|
|
236
|
-
None
|
|
237
|
-
"""
|
|
238
|
-
|
|
239
|
-
print(
|
|
240
|
-
f"My name is {self.name} {self.surname}. I am {self.age} years old."
|
|
241
|
-
+ additional
|
|
242
|
-
)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
# if __name__ == "__main__":
|
|
248
|
-
# import doctest
|
|
249
|
-
# doctest.testmod()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|