effectual 0.5.4__tar.gz → 0.5.5__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {effectual-0.5.4 → effectual-0.5.5}/PKG-INFO +1 -1
- {effectual-0.5.4 → effectual-0.5.5}/pyproject.toml +1 -1
- {effectual-0.5.4 → effectual-0.5.5}/src/effectual/__init__.py +8 -2
- {effectual-0.5.4 → effectual-0.5.5}/src/effectual/build.py +41 -31
- {effectual-0.5.4 → effectual-0.5.5}/src/effectual/config.py +5 -4
- {effectual-0.5.4 → effectual-0.5.5}/src/effectual/developer.py +1 -1
- {effectual-0.5.4 → effectual-0.5.5}/uv.lock +20 -20
- {effectual-0.5.4 → effectual-0.5.5}/.gitignore +0 -0
- {effectual-0.5.4 → effectual-0.5.5}/.python-version +0 -0
- {effectual-0.5.4 → effectual-0.5.5}/LICENSE +0 -0
- {effectual-0.5.4 → effectual-0.5.5}/README.md +0 -0
- {effectual-0.5.4 → effectual-0.5.5}/src/effectual/colors.py +0 -0
- /effectual-0.5.4/src/effectual/minifier.py → /effectual-0.5.5/src/effectual/transformations.py +0 -0
- {effectual-0.5.4 → effectual-0.5.5}/taskfile.yml +0 -0
@@ -8,7 +8,10 @@ def main() -> None:
|
|
8
8
|
|
9
9
|
@click.command("dist")
|
10
10
|
def dist() -> None:
|
11
|
-
"""
|
11
|
+
"""
|
12
|
+
Bundles your source directory
|
13
|
+
into a production bundle
|
14
|
+
"""
|
12
15
|
from . import build
|
13
16
|
|
14
17
|
build.main()
|
@@ -16,7 +19,10 @@ def dist() -> None:
|
|
16
19
|
|
17
20
|
@click.command("dev")
|
18
21
|
def dev() -> None:
|
19
|
-
"""
|
22
|
+
"""
|
23
|
+
Bundles your source directory
|
24
|
+
into a developer bundle
|
25
|
+
"""
|
20
26
|
from . import developer
|
21
27
|
|
22
28
|
developer.main()
|
@@ -10,15 +10,15 @@ from watch_lite import getHash
|
|
10
10
|
|
11
11
|
from .colors import completeColor, fileColor, folderColor, tagColor
|
12
12
|
from .config import dumpHashes, loadConfig, loadToml
|
13
|
-
from .
|
13
|
+
from .transformations import minifyFile, minifyToString
|
14
14
|
|
15
15
|
|
16
16
|
def bundleFiles(
|
17
|
-
sourceDirectory: Path,
|
18
|
-
outputDirectory: Path,
|
19
|
-
outputFileName: str,
|
20
|
-
compressionLevel: int,
|
21
|
-
minification: bool,
|
17
|
+
sourceDirectory: Path = Path("./src/"),
|
18
|
+
outputDirectory: Path = Path("./out"),
|
19
|
+
outputFileName: str = "bundle.pyz",
|
20
|
+
compressionLevel: int = 5,
|
21
|
+
minification: bool = True,
|
22
22
|
) -> None:
|
23
23
|
"""Bundles dependencies and scripts into a single .pyz archive
|
24
24
|
|
@@ -42,16 +42,19 @@ def bundleFiles(
|
|
42
42
|
compression=zipfile.ZIP_DEFLATED,
|
43
43
|
) as bundler:
|
44
44
|
cachePath: Path = Path("./.effectual_cache/cachedPackages")
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
45
|
+
if cachePath.exists():
|
46
|
+
if os.listdir(cachePath):
|
47
|
+
totalSize: int = int(0)
|
48
|
+
for cachedFile in cachePath.rglob("*"):
|
49
|
+
if cachedFile.is_dir() and not any(cachedFile.iterdir()):
|
50
|
+
continue
|
51
|
+
totalSize += cachedFile.stat().st_size
|
52
|
+
arcName = cachedFile.relative_to(cachePath)
|
53
|
+
bundler.write(cachedFile, arcname=arcName)
|
54
|
+
|
55
|
+
print(
|
56
|
+
f"{tagColor('bundling')} || uv dependencies {folderColor(totalSize)}" # noqa: E501
|
57
|
+
)
|
55
58
|
|
56
59
|
for pyFile in sourceDirectory.rglob("*.py"):
|
57
60
|
print(f"{tagColor('bundling')} || {pyFile.name} {fileColor(pyFile)}")
|
@@ -67,26 +70,34 @@ def bundleFiles(
|
|
67
70
|
def dependencies(minify: bool) -> None:
|
68
71
|
packages: list[str] = (
|
69
72
|
loadToml("./pyproject.toml").get("project").get("dependencies")
|
70
|
-
)
|
73
|
+
)
|
71
74
|
|
72
|
-
|
75
|
+
if len(packages) != 0:
|
76
|
+
arguments: list[str] = [
|
77
|
+
"--no-compile",
|
78
|
+
"--quiet",
|
79
|
+
"--no-binary=none",
|
80
|
+
"--no-cache",
|
81
|
+
]
|
73
82
|
|
74
|
-
|
75
|
-
|
83
|
+
pathToInstallTo: str = "./.effectual_cache/cachedPackages"
|
84
|
+
argumentString: str = " ".join(arguments)
|
76
85
|
|
77
|
-
|
78
|
-
|
86
|
+
if Path(pathToInstallTo).exists():
|
87
|
+
shutil.rmtree(pathToInstallTo)
|
79
88
|
|
80
|
-
|
81
|
-
|
82
|
-
|
89
|
+
for key in packages:
|
90
|
+
print(f"{tagColor('installing')} || {key}")
|
91
|
+
os.system(
|
92
|
+
f'uv pip install "{key}" {argumentString} --target {pathToInstallTo}'
|
93
|
+
)
|
83
94
|
|
84
|
-
|
95
|
+
print(f"{tagColor('optimizing')} || {', '.join(packages)}")
|
85
96
|
|
86
|
-
|
97
|
+
multiprocessing = importlib.import_module("multiprocessing")
|
87
98
|
|
88
|
-
|
89
|
-
|
99
|
+
with multiprocessing.Pool(processes=multiprocessing.cpu_count()) as pool:
|
100
|
+
pool.map(optimizeDependencies, Path(pathToInstallTo).rglob("*"))
|
90
101
|
|
91
102
|
|
92
103
|
def optimizeDependencies(file: Path) -> None:
|
@@ -120,8 +131,7 @@ def main() -> None:
|
|
120
131
|
compressionLevel: int = max(
|
121
132
|
0, min(9, configData.get("compressionLevel", 5))
|
122
133
|
) # Default level if not set
|
123
|
-
|
124
|
-
minification = configData.get("minification", True)
|
134
|
+
minification: bool = configData.get("minification", True)
|
125
135
|
|
126
136
|
if not sourceDirectory.is_dir():
|
127
137
|
raise RuntimeError(
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import io
|
2
|
+
from pathlib import Path
|
2
3
|
from typing import Any
|
3
4
|
|
4
5
|
import rtoml
|
5
6
|
|
6
7
|
|
7
|
-
def loadToml(tomlFile: str) -> dict[str, Any]:
|
8
|
+
def loadToml(tomlFile: str | Path) -> dict[str, Any]:
|
8
9
|
"""Loads a toml file from a specific path to a dictionary
|
9
10
|
|
10
11
|
Args:
|
@@ -19,14 +20,14 @@ def loadToml(tomlFile: str) -> dict[str, Any]:
|
|
19
20
|
"""
|
20
21
|
try:
|
21
22
|
with open(tomlFile, "r", encoding="utf-8") as file:
|
22
|
-
return dict(rtoml.load(file))
|
23
|
+
return dict(rtoml.load(file))
|
23
24
|
except ValueError as e:
|
24
25
|
raise RuntimeError(f"Invalid TOML in {tomlFile}: {e}")
|
25
26
|
except FileNotFoundError:
|
26
27
|
raise RuntimeError(f"TOML file {tomlFile} not found.")
|
27
28
|
|
28
29
|
|
29
|
-
def loadConfig(configPath: str) -> dict[Any, Any]:
|
30
|
+
def loadConfig(configPath: str = "./pyproject.toml") -> dict[Any, Any]:
|
30
31
|
"""Loads effectual config from a file
|
31
32
|
|
32
33
|
Args:
|
@@ -57,4 +58,4 @@ def dumpHashes(hashesToDump: dict[str, dict[str, str]], file: io.TextIOWrapper)
|
|
57
58
|
hashesToDump (dict[str, dict[str, str]]): Dictionary of hashes to dump as toml
|
58
59
|
file (_type_): File object
|
59
60
|
"""
|
60
|
-
|
61
|
+
rtoml.dump(hashesToDump, file, pretty=False)
|
@@ -46,10 +46,10 @@ def main() -> None:
|
|
46
46
|
while True:
|
47
47
|
currentHashSet: set[str] = getAllHashes(str(sourceDirectory))
|
48
48
|
if currentHashSet != lastHashSet:
|
49
|
-
lastHashSet = currentHashSet
|
50
49
|
runCommand.kill()
|
51
50
|
runCommand.wait()
|
52
51
|
outputFile.unlink()
|
52
|
+
lastHashSet = currentHashSet
|
53
53
|
print(f"{tagColor('reloaded')} || file change detected")
|
54
54
|
bundle(sourceDirectory, outputFile)
|
55
55
|
runCommand = subprocess.Popen(["uv", "run", outputFile], shell=True)
|
@@ -24,7 +24,7 @@ wheels = [
|
|
24
24
|
|
25
25
|
[[package]]
|
26
26
|
name = "effectual"
|
27
|
-
version = "0.5.
|
27
|
+
version = "0.5.5"
|
28
28
|
source = { editable = "." }
|
29
29
|
dependencies = [
|
30
30
|
{ name = "click" },
|
@@ -214,27 +214,27 @@ wheels = [
|
|
214
214
|
|
215
215
|
[[package]]
|
216
216
|
name = "ruff"
|
217
|
-
version = "0.8.
|
217
|
+
version = "0.8.2"
|
218
218
|
source = { registry = "https://pypi.org/simple" }
|
219
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
219
|
+
sdist = { url = "https://files.pythonhosted.org/packages/5e/2b/01245f4f3a727d60bebeacd7ee6d22586c7f62380a2597ddb22c2f45d018/ruff-0.8.2.tar.gz", hash = "sha256:b84f4f414dda8ac7f75075c1fa0b905ac0ff25361f42e6d5da681a465e0f78e5", size = 3349020 }
|
220
220
|
wheels = [
|
221
|
-
{ url = "https://files.pythonhosted.org/packages/
|
222
|
-
{ url = "https://files.pythonhosted.org/packages/
|
223
|
-
{ url = "https://files.pythonhosted.org/packages/
|
224
|
-
{ url = "https://files.pythonhosted.org/packages/
|
225
|
-
{ url = "https://files.pythonhosted.org/packages/
|
226
|
-
{ url = "https://files.pythonhosted.org/packages/
|
227
|
-
{ url = "https://files.pythonhosted.org/packages/
|
228
|
-
{ url = "https://files.pythonhosted.org/packages/
|
229
|
-
{ url = "https://files.pythonhosted.org/packages/
|
230
|
-
{ url = "https://files.pythonhosted.org/packages/
|
231
|
-
{ url = "https://files.pythonhosted.org/packages/
|
232
|
-
{ url = "https://files.pythonhosted.org/packages/
|
233
|
-
{ url = "https://files.pythonhosted.org/packages/
|
234
|
-
{ url = "https://files.pythonhosted.org/packages/
|
235
|
-
{ url = "https://files.pythonhosted.org/packages/
|
236
|
-
{ url = "https://files.pythonhosted.org/packages/
|
237
|
-
{ url = "https://files.pythonhosted.org/packages/
|
221
|
+
{ url = "https://files.pythonhosted.org/packages/91/29/366be70216dba1731a00a41f2f030822b0c96c7c4f3b2c0cdce15cbace74/ruff-0.8.2-py3-none-linux_armv6l.whl", hash = "sha256:c49ab4da37e7c457105aadfd2725e24305ff9bc908487a9bf8d548c6dad8bb3d", size = 10530649 },
|
222
|
+
{ url = "https://files.pythonhosted.org/packages/63/82/a733956540bb388f00df5a3e6a02467b16c0e529132625fe44ce4c5fb9c7/ruff-0.8.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ec016beb69ac16be416c435828be702ee694c0d722505f9c1f35e1b9c0cc1bf5", size = 10274069 },
|
223
|
+
{ url = "https://files.pythonhosted.org/packages/3d/12/0b3aa14d1d71546c988a28e1b412981c1b80c8a1072e977a2f30c595cc4a/ruff-0.8.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f05cdf8d050b30e2ba55c9b09330b51f9f97d36d4673213679b965d25a785f3c", size = 9909400 },
|
224
|
+
{ url = "https://files.pythonhosted.org/packages/23/08/f9f08cefb7921784c891c4151cce6ed357ff49e84b84978440cffbc87408/ruff-0.8.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60f578c11feb1d3d257b2fb043ddb47501ab4816e7e221fbb0077f0d5d4e7b6f", size = 10766782 },
|
225
|
+
{ url = "https://files.pythonhosted.org/packages/e4/71/bf50c321ec179aa420c8ec40adac5ae9cc408d4d37283a485b19a2331ceb/ruff-0.8.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cbd5cf9b0ae8f30eebc7b360171bd50f59ab29d39f06a670b3e4501a36ba5897", size = 10286316 },
|
226
|
+
{ url = "https://files.pythonhosted.org/packages/f2/83/c82688a2a6117539aea0ce63fdf6c08e60fe0202779361223bcd7f40bd74/ruff-0.8.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b402ddee3d777683de60ff76da801fa7e5e8a71038f57ee53e903afbcefdaa58", size = 11338270 },
|
227
|
+
{ url = "https://files.pythonhosted.org/packages/7f/d7/bc6a45e5a22e627640388e703160afb1d77c572b1d0fda8b4349f334fc66/ruff-0.8.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:705832cd7d85605cb7858d8a13d75993c8f3ef1397b0831289109e953d833d29", size = 12058579 },
|
228
|
+
{ url = "https://files.pythonhosted.org/packages/da/3b/64150c93946ec851e6f1707ff586bb460ca671581380c919698d6a9267dc/ruff-0.8.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:32096b41aaf7a5cc095fa45b4167b890e4c8d3fd217603f3634c92a541de7248", size = 11615172 },
|
229
|
+
{ url = "https://files.pythonhosted.org/packages/e4/9e/cf12b697ea83cfe92ec4509ae414dc4c9b38179cc681a497031f0d0d9a8e/ruff-0.8.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e769083da9439508833cfc7c23e351e1809e67f47c50248250ce1ac52c21fb93", size = 12882398 },
|
230
|
+
{ url = "https://files.pythonhosted.org/packages/a9/27/96d10863accf76a9c97baceac30b0a52d917eb985a8ac058bd4636aeede0/ruff-0.8.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fe716592ae8a376c2673fdfc1f5c0c193a6d0411f90a496863c99cd9e2ae25d", size = 11176094 },
|
231
|
+
{ url = "https://files.pythonhosted.org/packages/eb/10/cd2fd77d4a4e7f03c29351be0f53278a393186b540b99df68beb5304fddd/ruff-0.8.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:81c148825277e737493242b44c5388a300584d73d5774defa9245aaef55448b0", size = 10771884 },
|
232
|
+
{ url = "https://files.pythonhosted.org/packages/71/5d/beabb2ff18870fc4add05fa3a69a4cb1b1d2d6f83f3cf3ae5ab0d52f455d/ruff-0.8.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d261d7850c8367704874847d95febc698a950bf061c9475d4a8b7689adc4f7fa", size = 10382535 },
|
233
|
+
{ url = "https://files.pythonhosted.org/packages/ae/29/6b3fdf3ad3e35b28d87c25a9ff4c8222ad72485ab783936b2b267250d7a7/ruff-0.8.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1ca4e3a87496dc07d2427b7dd7ffa88a1e597c28dad65ae6433ecb9f2e4f022f", size = 10886995 },
|
234
|
+
{ url = "https://files.pythonhosted.org/packages/e9/dc/859d889b4d9356a1a2cdbc1e4a0dda94052bc5b5300098647e51a58c430b/ruff-0.8.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:729850feed82ef2440aa27946ab39c18cb4a8889c1128a6d589ffa028ddcfc22", size = 11220750 },
|
235
|
+
{ url = "https://files.pythonhosted.org/packages/0b/08/e8f519f61f1d624264bfd6b8829e4c5f31c3c61193bc3cff1f19dbe7626a/ruff-0.8.2-py3-none-win32.whl", hash = "sha256:ac42caaa0411d6a7d9594363294416e0e48fc1279e1b0e948391695db2b3d5b1", size = 8729396 },
|
236
|
+
{ url = "https://files.pythonhosted.org/packages/f8/d4/ba1c7ab72aba37a2b71fe48ab95b80546dbad7a7f35ea28cf66fc5cea5f6/ruff-0.8.2-py3-none-win_amd64.whl", hash = "sha256:2aae99ec70abf43372612a838d97bfe77d45146254568d94926e8ed5bbb409ea", size = 9594729 },
|
237
|
+
{ url = "https://files.pythonhosted.org/packages/23/34/db20e12d3db11b8a2a8874258f0f6d96a9a4d631659d54575840557164c8/ruff-0.8.2-py3-none-win_arm64.whl", hash = "sha256:fb88e2a506b70cfbc2de6fae6681c4f944f7dd5f2fe87233a7233d888bad73e8", size = 9035131 },
|
238
238
|
]
|
239
239
|
|
240
240
|
[[package]]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/effectual-0.5.4/src/effectual/minifier.py → /effectual-0.5.5/src/effectual/transformations.py
RENAMED
File without changes
|
File without changes
|