effectual 0.3.5__py3-none-any.whl → 0.4.0__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 CHANGED
@@ -21,14 +21,14 @@ def bundleFiles(
21
21
  compressionLevel: int,
22
22
  minification: bool,
23
23
  ) -> None:
24
- """Bundles dependencies and scripts into a single .py archive
24
+ """Bundles dependencies and scripts into a single .pyz archive
25
25
 
26
26
  Args:
27
27
  sourceDirectory (Path): Source directory which must contain a __main__.py script
28
28
  outputDirectory (Path): Output directory for the bundle
29
29
  outputFileName (str): Name of the output bundle
30
30
  compressionLevel (int): Compression level for the bundle from 0-9
31
- minification (bool): If the dependencies and scripts should be minified
31
+ minification (bool): If the scripts should be minified
32
32
  """
33
33
  outputDirectory.mkdir(parents=True, exist_ok=True)
34
34
  outputPath: Path = outputDirectory / outputFileName
@@ -90,11 +90,12 @@ def dependencies(minify: bool) -> None:
90
90
 
91
91
 
92
92
  def optimizeDependencies(file: Path) -> None:
93
+ stringFile: str = str(file)
93
94
  if (
94
95
  file.suffix in (".pyc", ".pyd", ".exe", ".typed")
95
- or "__pycache__" in str(file)
96
- or ".dist-info" in str(file)
97
- or ".lock" in str(file)
96
+ or "__pycache__" in stringFile
97
+ or ".dist-info" in stringFile
98
+ or ".lock" in stringFile
98
99
  ):
99
100
  try:
100
101
  file.unlink()
@@ -128,7 +129,7 @@ def main() -> None:
128
129
  )
129
130
 
130
131
  uvHashPath: Path = Path("./.effectual_cache/pyprojectHash.toml")
131
- currentHash: dict[str, dict] = dict()
132
+ currentHash: dict[str, dict[str, str]] = dict()
132
133
 
133
134
  startTime = perf_counter()
134
135
 
@@ -139,7 +140,7 @@ def main() -> None:
139
140
 
140
141
  if uvHashPath.exists():
141
142
  with open(uvHashPath, "r") as file:
142
- lastHash: dict = dict(rtoml.load(file)).get("hashes")
143
+ lastHash: dict[Any, Any] = dict(rtoml.load(file)).get("hashes")
143
144
  if currentHash["hashes"] != lastHash:
144
145
  with open(uvHashPath, "w") as file:
145
146
  rtoml.dump(currentHash, file)
effectual/developer.py CHANGED
@@ -40,12 +40,12 @@ def main() -> None:
40
40
 
41
41
  runCommand = subprocess.Popen(["uv", "run", outputFile], shell=True)
42
42
 
43
- lastHashList: list[str] = getAllHashes(sourceDirectory)
43
+ lastHashSet: set[str] = getAllHashes(sourceDirectory, ".py")
44
44
 
45
45
  while True:
46
- currentHashList: list[str] = getAllHashes(sourceDirectory)
47
- if currentHashList != lastHashList:
48
- lastHashList = currentHashList
46
+ currentHashSet: set[str] = getAllHashes(sourceDirectory, ".py")
47
+ if currentHashSet != lastHashSet:
48
+ lastHashSet = currentHashSet
49
49
  runCommand.kill()
50
50
  runCommand.wait()
51
51
  outputFile.unlink()
effectual/fileHash.py CHANGED
@@ -7,26 +7,28 @@ def getFilehash(filePath: Path) -> str:
7
7
  """Gets the file hash of a single python script
8
8
 
9
9
  Args:
10
- filePath (Path): Path to the python script
10
+ filePath (Path): Path to a file
11
11
 
12
12
  Returns:
13
- str: Hash of the python script
13
+ str: Hash of the file
14
14
  """
15
15
  with open(filePath, "rb") as file:
16
- fileHash = hashlib.sha256(file.read()).hexdigest()
16
+ fileHash = hashlib.sha1(file.read()).hexdigest()
17
17
  return fileHash
18
18
 
19
19
 
20
- def getAllHashes(sourceDirectory: Path) -> list[str]:
20
+ def getAllHashes(sourceDirectory: Path, fileExtension: str) -> set[str]:
21
21
  """Gets all hashes in directory
22
22
 
23
23
  Args:
24
- sourceDirectory (Path): Path to the python scripts
24
+ sourceDirectory (Path): Path to a folder containing files
25
25
 
26
26
  Returns:
27
- dict[str]: Dictionary containing paths and hashes
27
+ set[str]: Set containing paths and hashes
28
28
  """
29
29
 
30
30
  with Pool() as pool:
31
- hashList: list[str] = pool.map(getFilehash, sourceDirectory.glob("*.py"))
31
+ hashList: set[str] = set(
32
+ pool.map(getFilehash, sourceDirectory.glob(f"*.{fileExtension}"))
33
+ )
32
34
  return hashList
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: effectual
3
- Version: 0.3.5
3
+ Version: 0.4.0
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=LjPsTegLoxf2Ta3VwOV2LcMITf7ZEdPOuIcAJ0RXq7M,5669
3
+ effectual/colors.py,sha256=na7SEUSXM7aHvEKeIAn5shrZJtrBYq_ZUp121GRO_PQ,1411
4
+ effectual/config.py,sha256=otTF0HIBwECrHpXsB-e_rlxDZg5uRwIIoUPC37TZl8Q,1165
5
+ effectual/developer.py,sha256=-S55Vllozoi-WlJKjD2SXiuLuOuGEHnsmz1I3S5vIUo,2053
6
+ effectual/fileHash.py,sha256=ftFDY0RY1RF-IQxgbS9HfJp9mzgc3I6Acl69CIKUL2o,848
7
+ effectual/minifier.py,sha256=7GHgQWzin2J1W62yMReHXaYIChXc3f0rNJA-yY4LDEI,1313
8
+ effectual-0.4.0.dist-info/METADATA,sha256=heiu95UEveT9SrhVpai8S_fLEToTc56u55kjSqWQTxo,2527
9
+ effectual-0.4.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
10
+ effectual-0.4.0.dist-info/entry_points.txt,sha256=1W7EjlLZkw_Wz8V1SgdzzDis-CRE5IINyg74upsB0zU,40
11
+ effectual-0.4.0.dist-info/licenses/LICENSE,sha256=RrVXS_K_FctToNx9BLuZm9vbcpTi3PHNzWMaz7QyVeg,1082
12
+ effectual-0.4.0.dist-info/RECORD,,
@@ -1,12 +0,0 @@
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,,