python-base-toolkit 0.0.4__tar.gz → 0.0.5__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 (51) hide show
  1. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/CI/Tasks/default.yml +0 -5
  2. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/CI/Tasks/install.yml +16 -5
  3. python_base_toolkit-0.0.5/CI/Tasks/lint.yml +12 -0
  4. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/CI/Tasks/main.yml +1 -0
  5. python_base_toolkit-0.0.5/CI/Tasks/vars.yml +38 -0
  6. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/PKG-INFO +4 -1
  7. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/README.md +3 -0
  8. python_base_toolkit-0.0.5/Taskfile.yml +4 -0
  9. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/pyproject.toml +1 -1
  10. python_base_toolkit-0.0.5/python_base_toolkit/base_structures/base_enum.py +54 -0
  11. python_base_toolkit-0.0.5/python_base_toolkit/utils/__init__.py +0 -0
  12. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit.egg-info/PKG-INFO +4 -1
  13. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit.egg-info/SOURCES.txt +3 -0
  14. python_base_toolkit-0.0.4/CI/Tasks/lint.yml +0 -13
  15. python_base_toolkit-0.0.4/Taskfile.yml +0 -9
  16. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/CI/Tasks/dependencies.yml +0 -0
  17. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/CI/Tasks/deploy.yml +0 -0
  18. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/CI/Tasks/docker.yml +0 -0
  19. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/LICENSE +0 -0
  20. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/MANIFEST.in +0 -0
  21. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/__init__.py +0 -0
  22. {python_base_toolkit-0.0.4/python_base_toolkit/consts → python_base_toolkit-0.0.5/python_base_toolkit/base_structures}/__init__.py +0 -0
  23. {python_base_toolkit-0.0.4/python_base_toolkit/decorators → python_base_toolkit-0.0.5/python_base_toolkit/consts}/__init__.py +0 -0
  24. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/consts/operating_system.py +0 -0
  25. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/consts/units/__init__.py +0 -0
  26. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/consts/units/binary_units.py +0 -0
  27. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/consts/units/time_units.py +0 -0
  28. {python_base_toolkit-0.0.4/python_base_toolkit/instances → python_base_toolkit-0.0.5/python_base_toolkit/decorators}/__init__.py +0 -0
  29. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/decorators/telemetry.py +0 -0
  30. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/decorators/timer.py +0 -0
  31. {python_base_toolkit-0.0.4/python_base_toolkit/scripts → python_base_toolkit-0.0.5/python_base_toolkit/instances}/__init__.py +0 -0
  32. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/instances/instance_manager.py +0 -0
  33. {python_base_toolkit-0.0.4/python_base_toolkit/utils → python_base_toolkit-0.0.5/python_base_toolkit/scripts}/__init__.py +0 -0
  34. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/scripts/remove_build_files.py +0 -0
  35. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/data_serialization.py +0 -0
  36. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/date_time.py +0 -0
  37. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/execute.py +0 -0
  38. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/file_utils.py +0 -0
  39. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/generate_id.py +0 -0
  40. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/logo.py +0 -0
  41. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/network.py +0 -0
  42. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/path_utils.py +0 -0
  43. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/pretty_print.py +0 -0
  44. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/pycache.py +0 -0
  45. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/random_utils.py +0 -0
  46. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/shorten_url.py +0 -0
  47. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit/utils/venv_details.py +0 -0
  48. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit.egg-info/dependency_links.txt +0 -0
  49. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit.egg-info/requires.txt +0 -0
  50. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/python_base_toolkit.egg-info/top_level.txt +0 -0
  51. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.5}/setup.cfg +0 -0
@@ -1,10 +1,5 @@
1
1
  version: "3"
2
2
 
3
- vars:
4
- VENV_SITE_PACKAGES:
5
- sh: "python -c 'import os, site; print(os.path.abspath(site.getsitepackages()[0]))'"
6
-
7
-
8
3
  tasks:
9
4
  default:
10
5
  cmds:
@@ -1,6 +1,5 @@
1
1
  version: "3"
2
2
 
3
-
4
3
  tasks:
5
4
  uv_bin: # for CI ; command -v uv is the basic command to find uv if exists in PATH
6
5
  desc: "Find the path to UV"
@@ -21,11 +20,13 @@ tasks:
21
20
  desc: "Check if UV is installed"
22
21
  cmds:
23
22
  - |
24
- UV_PATH=$(task -s uv_bin)
23
+ UV_PATH=$(task -s main:install:uv_bin)
25
24
  if [ -n "$UV_PATH" ]; then
26
- echo "UV is installed at: $UV_PATH"
25
+ echo "UV is installed at: $UV_PATH"
26
+ exit 0 # success
27
27
  else
28
- echo "UV is not installed."
28
+ echo "UV is not installed."
29
+ exit 1 # failure
29
30
  fi
30
31
 
31
32
  install_uv:
@@ -33,7 +34,7 @@ tasks:
33
34
  cmds:
34
35
  - echo "Installing UV..."
35
36
  - |
36
- if ! command -v uv > /dev/null 2>&1; then
37
+ if [ -n "$(task -s main:install:uv_bin)" ]; then
37
38
  curl -sSfL https://astral.sh/uv/install.sh | sh
38
39
  else
39
40
  echo "UV is already installed at $(command -v uv)"
@@ -46,3 +47,13 @@ tasks:
46
47
  - echo "🔁 Reinstalling UV..."
47
48
  - curl -sSfL https://astral.sh/uv/install.sh | sh
48
49
  - echo "🎉 UV reinstalled!"
50
+
51
+ install_dependencies:
52
+ desc: Install all dependencies.
53
+ deps:
54
+ - install-uv
55
+ cmds:
56
+ - task: clean
57
+ - pwd
58
+ - rm uv.lock || true
59
+ - "{{.UV_BIN}} sync"
@@ -0,0 +1,12 @@
1
+ version: "3"
2
+
3
+ tasks:
4
+ pre_commit:
5
+ desc: Pre-commit all files.
6
+ cmds:
7
+ - |
8
+ echo "Running pre-commit hooks on all files..."
9
+ set -a
10
+ source .env
11
+ set +a
12
+ "{{.UV_BIN}}" run pre-commit run --all-files
@@ -6,6 +6,7 @@ vars:
6
6
 
7
7
 
8
8
  includes:
9
+ vars: vars.yml
9
10
  default: default.yml
10
11
  dependencies: dependencies.yml
11
12
  deploy: deploy.yml
@@ -0,0 +1,38 @@
1
+ version: "3"
2
+
3
+ vars:
4
+ OS:
5
+ sh: echo {{OS}}
6
+
7
+ UV_BIN: # Dynamically detect uv binary location
8
+ sh: |
9
+ if command -v uv >/dev/null 2>&1; then
10
+ command -v uv
11
+ elif [ -x "/root/.local/bin/uv" ]; then
12
+ echo "/root/.local/bin/uv"
13
+ elif [ -x "$HOME/.local/bin/uv" ]; then
14
+ echo "$HOME/.local/bin/uv"
15
+ else
16
+ echo "/root/.local/bin/uv"
17
+ fi
18
+
19
+ VENV_PYTHON_PATH:
20
+ sh: |
21
+ find "$VIRTUAL_ENV/lib" -maxdepth 1 -type d -name "python*" | head -n1
22
+ DOT_VENV_PYTHON_PATH:
23
+ sh: |
24
+ find "$VIRTUAL_ENV/lib" -maxdepth 1 -type d -name "python*" | head -n1 | sed 's|^.*/\.venv/|.venv/|'
25
+ VENV_SITE_PACKAGES:
26
+ sh: "python -c 'import os, site; print(os.path.abspath(site.getsitepackages()[0]))'"
27
+
28
+ GIT_BRANCH:
29
+ sh: git branch --show-current
30
+ GIT_COMMIT_HASH:
31
+ sh: git rev-parse --short HEAD
32
+
33
+ tasks:
34
+ print-vars:
35
+ desc: "Print all task variables - command: task print-vars --verbose"
36
+ cmds:
37
+ - |
38
+ echo {{.OS}}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-base-toolkit
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Author: Avi Zaguri
6
6
  License: MIT
@@ -72,6 +72,9 @@ pip install python-toolkit
72
72
  - shorten_url
73
73
  - venv_details
74
74
 
75
+ - Tasks Pack
76
+ - ...
77
+
75
78
  ---
76
79
 
77
80
  ## 🤝 Contributing
@@ -38,6 +38,9 @@ pip install python-toolkit
38
38
  - shorten_url
39
39
  - venv_details
40
40
 
41
+ - Tasks Pack
42
+ - ...
43
+
41
44
  ---
42
45
 
43
46
  ## 🤝 Contributing
@@ -0,0 +1,4 @@
1
+ version: "3"
2
+
3
+ includes:
4
+ main: CI/Tasks/main.yml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-base-toolkit"
7
- version = "0.0.4"
7
+ version = "0.0.5"
8
8
  description = "A Python package for managing pytest plugins."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,54 @@
1
+ import json
2
+ from enum import Enum, StrEnum
3
+ from typing import Any, TypeVar
4
+
5
+ E = TypeVar("E", bound=Enum)
6
+
7
+
8
+ class EnumMixin:
9
+ def __str__(self: E) -> str:
10
+ return str(self.value)
11
+
12
+ def __repr__(self: E) -> str:
13
+ return str(self.value)
14
+ # return f"<{self.__class__.__name__}.{self.name}: {self.value}>"
15
+
16
+ @classmethod
17
+ def to_list(cls: type[E]) -> list[Any]:
18
+ return [c.value for c in cls]
19
+
20
+ @classmethod
21
+ def to_dict(cls: type[E]) -> dict:
22
+ return {member.name: member.value for member in cls}
23
+
24
+ @classmethod
25
+ def names(cls: type[E]) -> list[str]:
26
+ return [c.name for c in cls]
27
+
28
+ @classmethod
29
+ def values(cls: type[E]) -> list[Any]:
30
+ return [c.value for c in cls]
31
+
32
+ @classmethod
33
+ def from_value(cls: type[E], value: Any) -> list[E]:
34
+ return [member for member in cls if value in member.value]
35
+
36
+ @classmethod
37
+ def has_name(cls: type[E], name: str) -> bool:
38
+ return any(member.name == name for member in cls)
39
+
40
+ @classmethod
41
+ def has_value(cls: type[E], value: Any) -> bool:
42
+ return any(member.value == value for member in cls)
43
+
44
+ @classmethod
45
+ def to_json(cls) -> str:
46
+ return json.dumps(cls.to_dict())
47
+
48
+
49
+ class BaseEnum(EnumMixin, Enum):
50
+ pass
51
+
52
+
53
+ class BaseStrEnum(EnumMixin, StrEnum):
54
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-base-toolkit
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Author: Avi Zaguri
6
6
  License: MIT
@@ -72,6 +72,9 @@ pip install python-toolkit
72
72
  - shorten_url
73
73
  - venv_details
74
74
 
75
+ - Tasks Pack
76
+ - ...
77
+
75
78
  ---
76
79
 
77
80
  ## 🤝 Contributing
@@ -10,12 +10,15 @@ CI/Tasks/docker.yml
10
10
  CI/Tasks/install.yml
11
11
  CI/Tasks/lint.yml
12
12
  CI/Tasks/main.yml
13
+ CI/Tasks/vars.yml
13
14
  python_base_toolkit/__init__.py
14
15
  python_base_toolkit.egg-info/PKG-INFO
15
16
  python_base_toolkit.egg-info/SOURCES.txt
16
17
  python_base_toolkit.egg-info/dependency_links.txt
17
18
  python_base_toolkit.egg-info/requires.txt
18
19
  python_base_toolkit.egg-info/top_level.txt
20
+ python_base_toolkit/base_structures/__init__.py
21
+ python_base_toolkit/base_structures/base_enum.py
19
22
  python_base_toolkit/consts/__init__.py
20
23
  python_base_toolkit/consts/operating_system.py
21
24
  python_base_toolkit/consts/units/__init__.py
@@ -1,13 +0,0 @@
1
- version: "3"
2
-
3
- tasks:
4
- lint:
5
- desc: "Run pre-commit hooks (linting & formatting)"
6
- cmds:
7
- - |
8
- if command -v pre-commit > /dev/null 2>&1; then
9
- echo "Running pre-commit hooks..."
10
- pre-commit run --all-files
11
- else
12
- echo "pre-commit is not installed. Please run 'pip install pre-commit'"
13
- fi
@@ -1,9 +0,0 @@
1
- version: "3"
2
-
3
- vars:
4
- VENV_SITE_PACKAGES:
5
- sh: "python -c 'import os, site; print(os.path.abspath(site.getsitepackages()[0]))'"
6
-
7
-
8
- includes:
9
- main: CI/Tasks/main.yml