effectual 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
effectual/build.py CHANGED
@@ -1,8 +1,10 @@
1
+ import importlib
1
2
  import os
2
3
  import shutil
3
4
  import zipfile
4
5
  from pathlib import Path
5
6
  from time import perf_counter
7
+ from typing import Any
6
8
 
7
9
  import rtoml
8
10
 
@@ -65,7 +67,7 @@ def bundleFiles(
65
67
 
66
68
  def dependencies(minify: bool) -> None:
67
69
  with open("./pyproject.toml", "r", encoding="utf-8") as file:
68
- packages: list[str] = dict(rtoml.load(file)).get("project").get("dependencies")
70
+ packages: list[str] = dict(rtoml.load(file)).get("project").get("dependencies") # type: ignore
69
71
 
70
72
  arguments: list[str] = ["--no-compile", "--quiet", "--no-binary=none", "--no-cache"]
71
73
 
@@ -81,7 +83,7 @@ def dependencies(minify: bool) -> None:
81
83
 
82
84
  print(f"{tagColor('optimizing')} || {', '.join(packages)}")
83
85
 
84
- import multiprocessing
86
+ multiprocessing = importlib.import_module("multiprocessing")
85
87
 
86
88
  with multiprocessing.Pool(processes=multiprocessing.cpu_count()) as pool:
87
89
  pool.map(optimizeDependencies, Path(pathToInstallTo).rglob("*"))
@@ -109,7 +111,7 @@ def main() -> None:
109
111
  RuntimeError: In the event there is no source directory
110
112
  """
111
113
 
112
- configData: dict = loadConfig("./pyproject.toml")
114
+ configData: dict[Any, Any] = loadConfig("./pyproject.toml")
113
115
 
114
116
  sourceDirectory: Path = Path(configData.get("sourceDirectory", "src/"))
115
117
  outputDirectory: Path = Path(configData.get("outputDirectory", "out/"))
@@ -126,14 +128,14 @@ def main() -> None:
126
128
  )
127
129
 
128
130
  uvHashPath: Path = Path("./.effectual_cache/pyprojectHash.toml")
129
- currentHash: dict[str] = dict()
131
+ currentHash: dict[str, dict] = dict()
130
132
 
131
133
  startTime = perf_counter()
132
134
 
133
135
  Path("./.effectual_cache/").mkdir(parents=True, exist_ok=True)
134
- currentHash["hashes"]: dict[dict] = dict()
135
- currentHash["hashes"]["pyproject"] = getFilehash("./pyproject.toml")
136
- currentHash["hashes"]["lock"] = getFilehash("./uv.lock")
136
+ currentHash["hashes"] = dict()
137
+ currentHash["hashes"]["pyproject"] = getFilehash(Path("./pyproject.toml"))
138
+ currentHash["hashes"]["lock"] = getFilehash(Path("./uv.lock"))
137
139
 
138
140
  if uvHashPath.exists():
139
141
  with open(uvHashPath, "r") as file:
effectual/config.py CHANGED
@@ -1,7 +1,9 @@
1
+ from typing import Any
2
+
1
3
  import rtoml
2
4
 
3
5
 
4
- def loadConfig(configPath: str) -> dict:
6
+ def loadConfig(configPath: str) -> dict[Any, Any]:
5
7
  """Loads effectual config from a file
6
8
 
7
9
  Args:
@@ -16,8 +18,17 @@ def loadConfig(configPath: str) -> dict:
16
18
  """
17
19
  try:
18
20
  with open(configPath, "r", encoding="utf-8") as file:
19
- tomlFile: dict = dict(rtoml.load(file))
20
- configData: dict = tomlFile.get("tool").get("effectual")
21
+ configData: dict[Any, Any] = dict(rtoml.load(file))
22
+ if configData is None:
23
+ configData = {
24
+ "sourceDirectory": "./src/",
25
+ "outputDirectory": "./dist/",
26
+ "outputFileName": "bundle.pyz",
27
+ "minification": True,
28
+ "compressionLevel": 5,
29
+ }
30
+ else:
31
+ configData = configData.get("tool").get("effectual") # type: ignore
21
32
 
22
33
  except ValueError as e:
23
34
  raise RuntimeError(f"Invalid TOML in {configPath}: {e}")
effectual/developer.py CHANGED
@@ -2,6 +2,7 @@ import subprocess
2
2
  import time
3
3
  import zipfile
4
4
  from pathlib import Path
5
+ from typing import Any
5
6
 
6
7
  from .colors import completeColor, fileColor, tagColor
7
8
  from .config import loadConfig
@@ -27,10 +28,9 @@ def bundle(sourceDirectory: Path, outputFile: Path) -> None:
27
28
 
28
29
  def main() -> None:
29
30
  """Super fast bundling for the 'task dev' command"""
30
-
31
- configData: dict = loadConfig("./pyproject.toml")
31
+ configData: dict[Any, Any] = loadConfig("./pyproject.toml")
32
32
  sourceDirectory: Path = Path(configData.get("sourceDirectory", "src/"))
33
- outputFileName: str = Path(configData.get("outputFileName", "bundle.pyz"))
33
+ outputFileName: Path = Path(configData.get("outputFileName", "bundle.pyz"))
34
34
  devBundlePath: Path = Path("./.effectual_cache/dev/")
35
35
  devBundlePath.mkdir(parents=True, exist_ok=True)
36
36
 
effectual/minifier.py CHANGED
@@ -38,7 +38,7 @@ def minifyToString(filePath: Path) -> str:
38
38
  Returns:
39
39
  str: Minified string
40
40
  """
41
- with filePath.open("r", encoding="utf-8") as fileR:
41
+ with filePath.open("r") as fileR:
42
42
  minifiedCode: str = str(
43
43
  minify(
44
44
  fileR.read(),
@@ -46,6 +46,6 @@ def minifyToString(filePath: Path) -> str:
46
46
  remove_literal_statements=True,
47
47
  remove_debug=True,
48
48
  )
49
- ).encode("utf-8")
49
+ )
50
50
 
51
51
  return minifiedCode
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: effectual
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: A python package/script bundler
5
5
  Project-URL: Homepage, https://github.com/effectualpy/effectual
6
6
  Author-email: jake <jakewdr@proton.me>
@@ -0,0 +1,12 @@
1
+ effectual/__init__.py,sha256=9hA5S-390BtY7m-NojGHioaBJJ8vEM3IXuMvmzWBv0E,407
2
+ effectual/build.py,sha256=jyLiuQXKl1pjG8gtgQDafqiFQXgGo8DLwVn9kdIzqdw,5629
3
+ effectual/colors.py,sha256=na7SEUSXM7aHvEKeIAn5shrZJtrBYq_ZUp121GRO_PQ,1411
4
+ effectual/config.py,sha256=otTF0HIBwECrHpXsB-e_rlxDZg5uRwIIoUPC37TZl8Q,1165
5
+ effectual/developer.py,sha256=l7olxXwsGbdd5uGkxXMaFabaQo8A8qzrFMCewKuzx9M,2047
6
+ effectual/fileHash.py,sha256=m2oPjhAcSH0Qc7J7aMkmjOlgDr5Lzilcfl1ppeoDxI8,810
7
+ effectual/minifier.py,sha256=7GHgQWzin2J1W62yMReHXaYIChXc3f0rNJA-yY4LDEI,1313
8
+ effectual-0.3.5.dist-info/METADATA,sha256=CtVXhoTgNE7vkUj-Y_yOm9wwporcS_rXE0cw6xIc6yw,2527
9
+ effectual-0.3.5.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
10
+ effectual-0.3.5.dist-info/entry_points.txt,sha256=1W7EjlLZkw_Wz8V1SgdzzDis-CRE5IINyg74upsB0zU,40
11
+ effectual-0.3.5.dist-info/licenses/LICENSE,sha256=RrVXS_K_FctToNx9BLuZm9vbcpTi3PHNzWMaz7QyVeg,1082
12
+ effectual-0.3.5.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- effectual/__init__.py,sha256=9hA5S-390BtY7m-NojGHioaBJJ8vEM3IXuMvmzWBv0E,407
2
- effectual/build.py,sha256=AfeQXckE2dhEpJAZg7T0dxYKudg7n7Ghy1BVc4f6L9A,5517
3
- effectual/colors.py,sha256=na7SEUSXM7aHvEKeIAn5shrZJtrBYq_ZUp121GRO_PQ,1411
4
- effectual/config.py,sha256=LzGT8e-zq7Rc-HOp3-r6g1XRiN9v0sCq5aeWL0bqFLY,754
5
- effectual/developer.py,sha256=Ia6LPvDbO5kkF9dRIw3H23sulmWT8pLis55-PRQIInI,2014
6
- effectual/fileHash.py,sha256=m2oPjhAcSH0Qc7J7aMkmjOlgDr5Lzilcfl1ppeoDxI8,810
7
- effectual/minifier.py,sha256=RlUD0mUNDi7YZ1P-dDL6Y4FlCkfiiJP8G4TpX2y45iI,1347
8
- effectual-0.3.4.dist-info/METADATA,sha256=E0sHvdgK8jKXY-B6pP5Cn8dWVDERD7h-kU3GfZ7eK8M,2527
9
- effectual-0.3.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
10
- effectual-0.3.4.dist-info/entry_points.txt,sha256=1W7EjlLZkw_Wz8V1SgdzzDis-CRE5IINyg74upsB0zU,40
11
- effectual-0.3.4.dist-info/licenses/LICENSE,sha256=RrVXS_K_FctToNx9BLuZm9vbcpTi3PHNzWMaz7QyVeg,1082
12
- effectual-0.3.4.dist-info/RECORD,,