stouputils 1.0.24__tar.gz → 1.0.25__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.
Files changed (59) hide show
  1. {stouputils-1.0.24 → stouputils-1.0.25}/PKG-INFO +1 -1
  2. stouputils-1.0.25/assets/continuous_delivery/pypi_module.gif +0 -0
  3. stouputils-1.0.25/assets/continuous_delivery/pyproject_module.gif +0 -0
  4. stouputils-1.0.25/copy_in_local.py +22 -0
  5. stouputils-1.0.25/full_routine.py +18 -0
  6. {stouputils-1.0.24 → stouputils-1.0.25}/pyproject.toml +15 -4
  7. stouputils-1.0.25/scripts/github_release.py +28 -0
  8. stouputils-1.0.24/build_all_in_one.py → stouputils-1.0.25/scripts/pypi_full_routine.py +1 -1
  9. stouputils-1.0.25/scripts/upgrade.py +11 -0
  10. stouputils-1.0.25/src/stouputils/continuous_delivery/pyproject.py +121 -0
  11. stouputils-1.0.24/all_in_one.py +0 -13
  12. stouputils-1.0.24/copy_in_local.py +0 -12
  13. stouputils-1.0.24/github_release.py +0 -26
  14. stouputils-1.0.24/src/stouputils/continuous_delivery/pyproject.py +0 -69
  15. stouputils-1.0.24/upgrade.py +0 -16
  16. {stouputils-1.0.24 → stouputils-1.0.25}/.github/workflows/documentation.yml +0 -0
  17. {stouputils-1.0.24 → stouputils-1.0.25}/.gitignore +0 -0
  18. {stouputils-1.0.24 → stouputils-1.0.25}/.python-version +0 -0
  19. {stouputils-1.0.24 → stouputils-1.0.25}/LICENSE +0 -0
  20. {stouputils-1.0.24 → stouputils-1.0.25}/README.md +0 -0
  21. {stouputils-1.0.24 → stouputils-1.0.25}/assets/all_doctests_module.gif +0 -0
  22. {stouputils-1.0.24 → stouputils-1.0.25}/assets/archive_module.gif +0 -0
  23. {stouputils-1.0.24 → stouputils-1.0.25}/assets/backup_module.gif +0 -0
  24. {stouputils-1.0.24 → stouputils-1.0.25}/assets/collections_module.gif +0 -0
  25. {stouputils-1.0.24 → stouputils-1.0.25}/assets/continuous_delivery/github_module.gif +0 -0
  26. {stouputils-1.0.24 → stouputils-1.0.25}/assets/ctx_module.gif +0 -0
  27. {stouputils-1.0.24 → stouputils-1.0.25}/assets/decorators_module_1.gif +0 -0
  28. {stouputils-1.0.24 → stouputils-1.0.25}/assets/decorators_module_2.gif +0 -0
  29. {stouputils-1.0.24 → stouputils-1.0.25}/assets/io_module.gif +0 -0
  30. {stouputils-1.0.24 → stouputils-1.0.25}/assets/parallel_module.gif +0 -0
  31. {stouputils-1.0.24 → stouputils-1.0.25}/assets/print_module.gif +0 -0
  32. {stouputils-1.0.24 → stouputils-1.0.25}/examples/all_doctests.py +0 -0
  33. {stouputils-1.0.24 → stouputils-1.0.25}/examples/archive/corrupted.zip +0 -0
  34. {stouputils-1.0.24 → stouputils-1.0.25}/examples/archive.py +0 -0
  35. {stouputils-1.0.24 → stouputils-1.0.25}/examples/collections.py +0 -0
  36. {stouputils-1.0.24 → stouputils-1.0.25}/examples/ctx.py +0 -0
  37. {stouputils-1.0.24 → stouputils-1.0.25}/examples/decorators_1.py +0 -0
  38. {stouputils-1.0.24 → stouputils-1.0.25}/examples/decorators_2.py +0 -0
  39. {stouputils-1.0.24 → stouputils-1.0.25}/examples/delta_backup.py +0 -0
  40. {stouputils-1.0.24 → stouputils-1.0.25}/examples/io.py +0 -0
  41. {stouputils-1.0.24 → stouputils-1.0.25}/examples/parallel.py +0 -0
  42. {stouputils-1.0.24 → stouputils-1.0.25}/examples/print.py +0 -0
  43. {stouputils-1.0.24 → stouputils-1.0.25}/scripts/create_docs.py +0 -0
  44. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/__init__.py +0 -0
  45. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/all_doctests.py +0 -0
  46. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/archive.py +0 -0
  47. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/backup.py +0 -0
  48. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/collections.py +0 -0
  49. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/continuous_delivery/__init__.py +0 -0
  50. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/continuous_delivery/cd_utils.py +0 -0
  51. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/continuous_delivery/github.py +0 -0
  52. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/continuous_delivery/pypi.py +0 -0
  53. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/ctx.py +0 -0
  54. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/decorators.py +0 -0
  55. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/dont_look/zip_file_override.py +0 -0
  56. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/io.py +0 -0
  57. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/parallel.py +0 -0
  58. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/print.py +0 -0
  59. {stouputils-1.0.24 → stouputils-1.0.25}/src/stouputils/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: stouputils
3
- Version: 1.0.24
3
+ Version: 1.0.25
4
4
  Summary: Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more.
5
5
  Project-URL: Homepage, https://github.com/Stoupy51/stouputils
6
6
  Project-URL: Issues, https://github.com/Stoupy51/stouputils/issues
@@ -0,0 +1,22 @@
1
+
2
+ # Imports
3
+ import stouputils as stp
4
+ import shutil
5
+
6
+ # Constants
7
+ ROOT: str = stp.get_root_path(__file__)
8
+ SOURCE: str = f"{ROOT}/src/stouputils"
9
+ DESTINATION: str = "C:/Users/Alexandre-PC/AppData/Local/Programs/Python/Python310/Lib/site-packages/stouputils"
10
+
11
+ # Main
12
+ if __name__ == "__main__":
13
+
14
+ # Remove destination
15
+ shutil.rmtree(DESTINATION, ignore_errors=True)
16
+
17
+ # Copy source
18
+ shutil.copytree(SOURCE, DESTINATION)
19
+
20
+ # Info
21
+ stp.info("Copied stouputils to local Python's site-packages")
22
+
@@ -0,0 +1,18 @@
1
+
2
+ # Imports
3
+ import os
4
+ import sys
5
+ import stouputils as stp
6
+
7
+ # Constants
8
+ ROOT: str = stp.get_root_path(__file__)
9
+
10
+ # Main
11
+ if __name__ == "__main__":
12
+
13
+ # Increment version in pyproject.toml
14
+ stp.increment_version_from_pyproject(f"{ROOT}/pyproject.toml")
15
+
16
+ # PyPI full routine
17
+ os.system(f"{sys.executable} {ROOT}/scripts/pypi_full_routine.py")
18
+
@@ -1,15 +1,25 @@
1
+
1
2
  [build-system]
2
- requires = [ "hatchling",]
3
+ requires = ["hatchling"]
3
4
  build-backend = "hatchling.build"
4
5
 
5
6
  [project]
6
7
  name = "stouputils"
7
- version = "1.0.24"
8
+ version = "1.0.25"
8
9
  description = "Stouputils is a collection of utility modules designed to simplify and enhance the development process. It includes a range of tools for tasks such as execution of doctests, display utilities, decorators, as well as context managers, and many more."
9
10
  readme = "README.md"
10
11
  requires-python = ">=3.10"
11
- classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",]
12
- dependencies = [ "tqdm>=4.66.4", "requests>=2.31.0", "pyyaml", "toml",]
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "License :: OSI Approved :: MIT License",
15
+ "Operating System :: OS Independent",
16
+ ]
17
+ dependencies = [
18
+ "tqdm>=4.66.4",
19
+ "requests>=2.31.0",
20
+ "pyyaml",
21
+ "toml",
22
+ ]
13
23
  [[project.authors]]
14
24
  name = "Stoupy51"
15
25
  email = "stoupy51@gmail.com"
@@ -20,3 +30,4 @@ Issues = "https://github.com/Stoupy51/stouputils/issues"
20
30
 
21
31
  [tool.pyright]
22
32
  typeCheckingMode = "strict"
33
+
@@ -0,0 +1,28 @@
1
+
2
+ # Imports
3
+ import stouputils as stp
4
+ from typing import Any
5
+
6
+ # Constants
7
+ ROOT: str = stp.get_root_path(__file__, go_up=1)
8
+ CURRENT_VERSION: str = stp.get_version_from_pyproject(f"{ROOT}/pyproject.toml")
9
+ CREDENTIALS_PATH: str = "~/stouputils/credentials.yml"
10
+ GITHUB_CONFIG: dict[str, Any] = {
11
+ "project_name": "stouputils",
12
+ "version": CURRENT_VERSION,
13
+ "build_folder": f"{ROOT}/dist",
14
+ "endswith": [
15
+ f"{CURRENT_VERSION}.tar.gz",
16
+ f"{CURRENT_VERSION}-py3-none-any.whl",
17
+ ],
18
+ }
19
+
20
+ # Main
21
+ if __name__ == "__main__":
22
+
23
+ # Get credentials
24
+ credentials: dict[str, Any] = stp.load_credentials(CREDENTIALS_PATH)
25
+
26
+ # Upload to GitHub
27
+ changelog: str = stp.upload_to_github(credentials, GITHUB_CONFIG)
28
+
@@ -3,7 +3,7 @@
3
3
  import stouputils as stp
4
4
 
5
5
  # Constants
6
- ROOT: str = stp.get_root_path(__file__)
6
+ ROOT: str = stp.get_root_path(__file__, go_up=1)
7
7
  REPOSITORY: str = "stouputils"
8
8
  DIST_DIRECTORY: str = f"{ROOT}/dist"
9
9
  LAST_FILES: int = 1
@@ -0,0 +1,11 @@
1
+
2
+ # Imports
3
+ import stouputils as stp
4
+
5
+ # Main
6
+ if __name__ == "__main__":
7
+
8
+ # Increment version
9
+ ROOT: str = stp.get_root_path(__file__, go_up=1)
10
+ stp.increment_version_from_pyproject(f"{ROOT}/pyproject.toml")
11
+
@@ -0,0 +1,121 @@
1
+ """ Utilities for reading, writing and managing pyproject.toml files.
2
+
3
+ This module provides functions to handle pyproject.toml files, including reading,
4
+ writing, version management and TOML formatting capabilities.
5
+
6
+ - read_pyproject: Read the pyproject.toml file.
7
+ - write_pyproject: Write to the pyproject.toml file.
8
+ - format_toml_lists: Format TOML lists with proper indentation.
9
+ - increment_version_from_input: Increment the patch version number.
10
+ - increment_version_from_pyproject: Increment version in pyproject.toml.
11
+ - get_version_from_pyproject: Get version from pyproject.toml.
12
+
13
+ .. image:: https://raw.githubusercontent.com/Stoupy51/stouputils/refs/heads/main/assets/continuous_delivery/pyproject_module.gif
14
+ :alt: stouputils pyproject examples
15
+ """
16
+
17
+ # Imports
18
+ from ..io import super_open
19
+ from typing import Any
20
+ import toml
21
+
22
+ def read_pyproject(pyproject_path: str) -> dict[str, Any]:
23
+ """ Read the pyproject.toml file.
24
+
25
+ Args:
26
+ pyproject_path: Path to the pyproject.toml file.
27
+
28
+ Returns:
29
+ dict[str, Any]: The content of the pyproject.toml file.
30
+ """
31
+ return toml.load(pyproject_path)
32
+
33
+
34
+ def format_toml_lists(content: str) -> str:
35
+ """ Format TOML lists with indentation.
36
+
37
+ Args:
38
+ content (str): The content of the pyproject.toml file.
39
+
40
+ Returns:
41
+ str: The formatted content with properly indented lists.
42
+ """
43
+ # Split the content into individual lines for processing
44
+ lines: list[str] = content.split("\n")
45
+ formatted_lines: list[str] = []
46
+
47
+ for line in lines:
48
+ # Check if line contains a list definition (has both [ ] and = characters)
49
+ if "[" in line and "]" in line and "=" in line:
50
+ # Only process simple lists that have one opening and closing bracket
51
+ if line.count("[") == 1 and line.count("]") == 1:
52
+ # Split into key and values parts
53
+ key, values = line.split("=", 1)
54
+ values = values.strip()
55
+
56
+ # Check if values portion is a list
57
+ if values.startswith("[") and values.endswith("]"):
58
+ # Parse list values, removing empty entries
59
+ values = [v.strip() for v in values[1:-1].split(",") if v.strip()]
60
+
61
+ # For lists with multiple items, format across multiple lines
62
+ if len(values) > 1:
63
+ formatted_lines.append(f"{key}= [")
64
+ for value in values:
65
+ formatted_lines.append(f"\t{value},")
66
+ formatted_lines.append("]")
67
+ # For single item lists, keep on one line
68
+ else:
69
+ formatted_lines.append(f"{key}= [{values[0]}]")
70
+ continue
71
+
72
+ # Keep non-list lines unchanged
73
+ formatted_lines.append(line)
74
+
75
+ # Rejoin all lines with newlines
76
+ return "\n".join(formatted_lines)
77
+
78
+
79
+ def write_pyproject(pyproject_path: str, pyproject_content: dict[str, Any]) -> None:
80
+ """ Write to the pyproject.toml file with properly indented lists. """
81
+ content: str = "\n" + toml.dumps(pyproject_content) + "\n"
82
+ content = format_toml_lists(content) # Apply formatting
83
+
84
+ with super_open(pyproject_path, "w") as file:
85
+ file.write(content)
86
+
87
+
88
+ def increment_version_from_input(version: str) -> str:
89
+ """ Increment the version.
90
+
91
+ Args:
92
+ version: The version to increment. (ex: "0.1.0")
93
+
94
+ Returns:
95
+ str: The incremented version. (ex: "0.1.1")
96
+ """
97
+ version_parts: list[str] = version.split(".")
98
+ version_parts[-1] = str(int(version_parts[-1]) + 1)
99
+ return ".".join(version_parts)
100
+
101
+ def increment_version_from_pyproject(pyproject_path: str) -> None:
102
+ """ Increment the version in the pyproject.toml file.
103
+
104
+ Args:
105
+ pyproject_path: Path to the pyproject.toml file.
106
+ """
107
+ pyproject_content: dict[str, Any] = read_pyproject(pyproject_path)
108
+ pyproject_content["project"]["version"] = increment_version_from_input(pyproject_content["project"]["version"])
109
+ write_pyproject(pyproject_path, pyproject_content)
110
+
111
+ def get_version_from_pyproject(pyproject_path: str) -> str:
112
+ """ Get the version from the pyproject.toml file.
113
+
114
+ Args:
115
+ pyproject_path: Path to the pyproject.toml file.
116
+
117
+ Returns:
118
+ str: The version. (ex: "0.1.0")
119
+ """
120
+ return read_pyproject(pyproject_path)["project"]["version"]
121
+
@@ -1,13 +0,0 @@
1
-
2
- import os
3
- import sys
4
- commands = [
5
- f"{sys.executable} upgrade.py", # Upgrade the version in pyproject.toml
6
- f"{sys.executable} build_all_in_one.py", # Build the package and upload it
7
- ]
8
-
9
- for command in commands:
10
- if os.system(command) != 0:
11
- print(f"Error while executing '{command}'")
12
- exit(1)
13
-
@@ -1,12 +0,0 @@
1
-
2
- import shutil
3
- import os
4
-
5
- source = os.path.dirname(os.path.realpath(__file__)).replace("\\","/") + "/src/stouputils"
6
- destination = "C:/Users/Alexandre-PC/AppData/Local/Programs/Python/Python310/Lib/site-packages/stouputils"
7
-
8
- shutil.rmtree(destination, ignore_errors=True)
9
- shutil.copytree(source, destination)
10
- os.system("clear")
11
- print("\nCopied stouputils to local Python's site-packages\n")
12
-
@@ -1,26 +0,0 @@
1
-
2
- # Imports
3
- from stouputils import load_credentials, upload_to_github, clean_path
4
- from typing import Any
5
- from upgrade import current_version
6
- import os
7
-
8
- # Constants
9
- ROOT: str = clean_path(os.path.dirname(os.path.abspath(__file__)))
10
- CREDENTIALS_PATH: str = "~/stouputils/credentials.yml"
11
- GITHUB_CONFIG: dict[str, Any] = {
12
- "project_name": "stouputils",
13
- "version": current_version,
14
- "build_folder": f"{ROOT}/dist",
15
- "endswith": [
16
- f"{current_version}.tar.gz",
17
- f"{current_version}-py3-none-any.whl",
18
- ],
19
- }
20
-
21
- # Get credentials
22
- credentials: dict[str, Any] = load_credentials(CREDENTIALS_PATH)
23
-
24
- # Upload to GitHub
25
- changelog: str = upload_to_github(credentials, GITHUB_CONFIG)
26
-
@@ -1,69 +0,0 @@
1
- """ This module contains utilities for reading and writing pyproject.toml files.
2
-
3
- - read_pyproject: Read the pyproject.toml file.
4
- - write_pyproject: Write to the pyproject.toml file.
5
-
6
- .. image:: https://raw.githubusercontent.com/Stoupy51/stouputils/refs/heads/main/assets/continuous_delivery/pyproject_module.gif
7
- :alt: stouputils pyproject examples
8
- """
9
-
10
- # Imports
11
- from ..io import super_open
12
- from typing import Any
13
- import toml
14
-
15
- def read_pyproject(pyproject_path: str) -> dict[str, Any]:
16
- """ Read the pyproject.toml file.
17
-
18
- Args:
19
- pyproject_path: Path to the pyproject.toml file.
20
-
21
- Returns:
22
- dict[str, Any]: The content of the pyproject.toml file.
23
- """
24
- return toml.load(pyproject_path)
25
-
26
- def write_pyproject(pyproject_path: str, pyproject_content: dict[str, Any]) -> None:
27
- """ Write to the pyproject.toml file.
28
-
29
- Args:
30
- pyproject_path: Path to the pyproject.toml file.
31
- pyproject_content: The content to write to the pyproject.toml file.
32
- """
33
- with super_open(pyproject_path, "w") as file:
34
- toml.dump(pyproject_content, file)
35
-
36
- def increment_version(version: str) -> str:
37
- """ Increment the version.
38
-
39
- Args:
40
- version: The version to increment. (ex: "0.1.0")
41
-
42
- Returns:
43
- str: The incremented version. (ex: "0.1.1")
44
- """
45
- version_parts: list[str] = version.split(".")
46
- version_parts[-1] = str(int(version_parts[-1]) + 1)
47
- return ".".join(version_parts)
48
-
49
- def increment_version_from_pyproject(pyproject_path: str) -> None:
50
- """ Increment the version in the pyproject.toml file.
51
-
52
- Args:
53
- pyproject_path: Path to the pyproject.toml file.
54
- """
55
- pyproject_content = read_pyproject(pyproject_path)
56
- pyproject_content["project"]["version"] = increment_version(pyproject_content["project"]["version"])
57
- write_pyproject(pyproject_path, pyproject_content)
58
-
59
- def get_version_from_pyproject(pyproject_path: str) -> str:
60
- """ Get the version from the pyproject.toml file.
61
-
62
- Args:
63
- pyproject_path: Path to the pyproject.toml file.
64
-
65
- Returns:
66
- str: The version. (ex: "0.1.0")
67
- """
68
- return read_pyproject(pyproject_path)["project"]["version"]
69
-
@@ -1,16 +0,0 @@
1
-
2
- ## Python script that modifies the pyproject.toml to go to the next version
3
- # Imports
4
- import stouputils as stp
5
-
6
- # Constants
7
- ROOT: str = stp.get_root_path(__file__)
8
- PYPROJECT_PATH = f"{ROOT}/pyproject.toml"
9
- CURRENT_VERSION: str = stp.get_version_from_pyproject(PYPROJECT_PATH)
10
-
11
- # Main
12
- if __name__ == "__main__":
13
-
14
- # Increment version
15
- stp.increment_version_from_pyproject(PYPROJECT_PATH)
16
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes