effectual 0.7.12__py3-none-any.whl → 0.8.1__py3-none-any.whl
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.
- effectual/build.py +4 -21
- effectual/config.py +5 -5
- effectual/lib.py +16 -0
- {effectual-0.7.12.dist-info → effectual-0.8.1.dist-info}/METADATA +1 -1
- effectual-0.8.1.dist-info/RECORD +12 -0
- effectual-0.7.12.dist-info/RECORD +0 -11
- {effectual-0.7.12.dist-info → effectual-0.8.1.dist-info}/WHEEL +0 -0
- {effectual-0.7.12.dist-info → effectual-0.8.1.dist-info}/entry_points.txt +0 -0
- {effectual-0.7.12.dist-info → effectual-0.8.1.dist-info}/licenses/LICENSE +0 -0
effectual/build.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import hashlib
|
2
1
|
import os
|
3
|
-
import shutil
|
4
2
|
import zipfile
|
5
3
|
from pathlib import Path
|
6
4
|
from time import perf_counter
|
@@ -8,6 +6,7 @@ from typing import Any
|
|
8
6
|
|
9
7
|
from .colors import completeColor, fileColor, folderColor, tagColor
|
10
8
|
from .config import dumpHashes, loadConfig, loadToml
|
9
|
+
from .lib import getHash
|
11
10
|
from .transformations import minifyFile, minifyToString
|
12
11
|
|
13
12
|
|
@@ -91,7 +90,7 @@ def dependencies() -> None:
|
|
91
90
|
argumentString: str = " ".join(arguments)
|
92
91
|
|
93
92
|
if Path(pathToInstallTo).exists():
|
94
|
-
shutil.rmtree(pathToInstallTo)
|
93
|
+
__import__("shutil").rmtree(pathToInstallTo)
|
95
94
|
|
96
95
|
for key in packages:
|
97
96
|
print(f"{tagColor('installing')} || {key}")
|
@@ -100,20 +99,6 @@ def dependencies() -> None:
|
|
100
99
|
)
|
101
100
|
|
102
101
|
|
103
|
-
def getHash(filePath: Path) -> str:
|
104
|
-
"""Gets the hash of a single file
|
105
|
-
|
106
|
-
Args:
|
107
|
-
filePath (Path): Path to the file
|
108
|
-
|
109
|
-
Returns:
|
110
|
-
str: String of the hash
|
111
|
-
"""
|
112
|
-
with open(filePath, "rb") as file:
|
113
|
-
fileHash = hashlib.sha1(file.read()).hexdigest()
|
114
|
-
return fileHash
|
115
|
-
|
116
|
-
|
117
102
|
def main() -> None:
|
118
103
|
"""Entrypoint
|
119
104
|
|
@@ -146,7 +131,7 @@ def main() -> None:
|
|
146
131
|
currentHash["hashes"]["pyproject"] = getHash(Path("./pyproject.toml"))
|
147
132
|
currentHash["hashes"]["lock"] = getHash(Path("./uv.lock"))
|
148
133
|
|
149
|
-
freshHash: bool =
|
134
|
+
freshHash: bool = True # Whether or not to re-optimize deps
|
150
135
|
|
151
136
|
if uvHashPath.exists():
|
152
137
|
lastHash: dict[str, Any] = loadToml(uvHashPath).get("hashes")
|
@@ -154,14 +139,12 @@ def main() -> None:
|
|
154
139
|
with open(uvHashPath, "w") as file:
|
155
140
|
dumpHashes(currentHash, file)
|
156
141
|
dependencies()
|
157
|
-
freshHash = True
|
158
142
|
else:
|
159
143
|
freshHash = False
|
160
144
|
else:
|
161
145
|
with open(uvHashPath, "x") as file:
|
162
146
|
dumpHashes(currentHash, file)
|
163
147
|
dependencies()
|
164
|
-
freshHash = True
|
165
148
|
|
166
149
|
bundleFiles(
|
167
150
|
sourceDirectory,
|
@@ -176,5 +159,5 @@ def main() -> None:
|
|
176
159
|
print(completeColor(f"Completed in {endTime - startTime:.4f}s"))
|
177
160
|
|
178
161
|
|
179
|
-
if "__main__"
|
162
|
+
if "__main__" == __name__:
|
180
163
|
main()
|
effectual/config.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
from io import TextIOWrapper
|
2
2
|
from pathlib import Path
|
3
3
|
from typing import Any
|
4
4
|
|
@@ -37,7 +37,9 @@ def loadConfig(configPath: str = "./pyproject.toml") -> dict[Any, Any]:
|
|
37
37
|
dict: Dictionary containing effectual config
|
38
38
|
"""
|
39
39
|
configData: dict[str, Any] = loadToml(configPath)
|
40
|
-
|
40
|
+
try:
|
41
|
+
configData = configData["tool"]["effectual"]
|
42
|
+
except KeyError:
|
41
43
|
configData = {
|
42
44
|
"sourceDirectory": "./src/",
|
43
45
|
"outputDirectory": "./dist/",
|
@@ -45,13 +47,11 @@ def loadConfig(configPath: str = "./pyproject.toml") -> dict[Any, Any]:
|
|
45
47
|
"minification": True,
|
46
48
|
"compressionLevel": 5,
|
47
49
|
}
|
48
|
-
else:
|
49
|
-
configData = configData.get("tool").get("effectual")
|
50
50
|
|
51
51
|
return configData
|
52
52
|
|
53
53
|
|
54
|
-
def dumpHashes(hashesToDump: dict[str, dict[str, str]], file:
|
54
|
+
def dumpHashes(hashesToDump: dict[str, dict[str, str]], file: TextIOWrapper) -> None:
|
55
55
|
"""Dumps hashes in a specific format to a toml file
|
56
56
|
|
57
57
|
Args:
|
effectual/lib.py
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
from hashlib import md5
|
2
|
+
from pathlib import Path
|
3
|
+
|
4
|
+
|
5
|
+
def getHash(filePath: Path) -> str:
|
6
|
+
"""Creates an MD5 Hash from a file
|
7
|
+
|
8
|
+
Args:
|
9
|
+
filePath (Path): Path to the file
|
10
|
+
|
11
|
+
Returns:
|
12
|
+
str: String of the hash
|
13
|
+
"""
|
14
|
+
with open(filePath, "rb") as file:
|
15
|
+
fileHash = md5(file.read()).hexdigest()
|
16
|
+
return fileHash
|
@@ -0,0 +1,12 @@
|
|
1
|
+
effectual/__init__.py,sha256=Hg_RSVgpLZvaeBUqt5uL_r5YIDsVdKPcFE2L5WJVYbM,482
|
2
|
+
effectual/build.py,sha256=RH3AqfNflj-vhHCszbGmVyP6FFSqTxkIkI96NoiaYNw,6027
|
3
|
+
effectual/colors.py,sha256=na7SEUSXM7aHvEKeIAn5shrZJtrBYq_ZUp121GRO_PQ,1411
|
4
|
+
effectual/config.py,sha256=3RvrlDY_W2YTGlpfcpWqkFGCFnui-vqigJuC-gQKMQs,1799
|
5
|
+
effectual/developer.py,sha256=sgh7p9iJXJd-R-Tx8nbeR3isS3ybXMtvhKIxzg3Kl9A,1988
|
6
|
+
effectual/lib.py,sha256=d8lgXD9Dv7WohFwHE_K1q9NjvfsdrTCRYmJBcDHmQY8,356
|
7
|
+
effectual/transformations.py,sha256=7GHgQWzin2J1W62yMReHXaYIChXc3f0rNJA-yY4LDEI,1313
|
8
|
+
effectual-0.8.1.dist-info/METADATA,sha256=-8q4jYsR2YmbNNPlXvEDSJ4WrzPdRjxvc511n3FF79k,3336
|
9
|
+
effectual-0.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
effectual-0.8.1.dist-info/entry_points.txt,sha256=1W7EjlLZkw_Wz8V1SgdzzDis-CRE5IINyg74upsB0zU,40
|
11
|
+
effectual-0.8.1.dist-info/licenses/LICENSE,sha256=RrVXS_K_FctToNx9BLuZm9vbcpTi3PHNzWMaz7QyVeg,1082
|
12
|
+
effectual-0.8.1.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
effectual/__init__.py,sha256=Hg_RSVgpLZvaeBUqt5uL_r5YIDsVdKPcFE2L5WJVYbM,482
|
2
|
-
effectual/build.py,sha256=0sYkASMQl7ImoqOS7UH2E-37IfxTydC103udg7UX608,6350
|
3
|
-
effectual/colors.py,sha256=na7SEUSXM7aHvEKeIAn5shrZJtrBYq_ZUp121GRO_PQ,1411
|
4
|
-
effectual/config.py,sha256=Z99V7AnJpSWuo-aEz10TDj5BAaT7tboGJUjggj-HQh4,1798
|
5
|
-
effectual/developer.py,sha256=sgh7p9iJXJd-R-Tx8nbeR3isS3ybXMtvhKIxzg3Kl9A,1988
|
6
|
-
effectual/transformations.py,sha256=7GHgQWzin2J1W62yMReHXaYIChXc3f0rNJA-yY4LDEI,1313
|
7
|
-
effectual-0.7.12.dist-info/METADATA,sha256=nlTVKnuD1trp6Go4I_loILK9ZPAV2NAmM-SDYDKM0Zc,3337
|
8
|
-
effectual-0.7.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
effectual-0.7.12.dist-info/entry_points.txt,sha256=1W7EjlLZkw_Wz8V1SgdzzDis-CRE5IINyg74upsB0zU,40
|
10
|
-
effectual-0.7.12.dist-info/licenses/LICENSE,sha256=RrVXS_K_FctToNx9BLuZm9vbcpTi3PHNzWMaz7QyVeg,1082
|
11
|
-
effectual-0.7.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|