python-base-toolkit 0.0.4__tar.gz → 0.0.6__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 (49) hide show
  1. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/PKG-INFO +4 -1
  2. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/README.md +3 -0
  3. python_base_toolkit-0.0.6/Taskfile.yml +4 -0
  4. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/pyproject.toml +1 -1
  5. python_base_toolkit-0.0.6/python_base_toolkit/base_structures/base_enum.py +54 -0
  6. python_base_toolkit-0.0.6/python_base_toolkit/utils/__init__.py +0 -0
  7. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit.egg-info/PKG-INFO +4 -1
  8. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit.egg-info/SOURCES.txt +2 -7
  9. python_base_toolkit-0.0.4/CI/Tasks/default.yml +0 -19
  10. python_base_toolkit-0.0.4/CI/Tasks/dependencies.yml +0 -31
  11. python_base_toolkit-0.0.4/CI/Tasks/deploy.yml +0 -28
  12. python_base_toolkit-0.0.4/CI/Tasks/docker.yml +0 -64
  13. python_base_toolkit-0.0.4/CI/Tasks/install.yml +0 -48
  14. python_base_toolkit-0.0.4/CI/Tasks/lint.yml +0 -13
  15. python_base_toolkit-0.0.4/CI/Tasks/main.yml +0 -27
  16. python_base_toolkit-0.0.4/Taskfile.yml +0 -9
  17. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/LICENSE +0 -0
  18. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/MANIFEST.in +0 -0
  19. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/__init__.py +0 -0
  20. {python_base_toolkit-0.0.4/python_base_toolkit/consts → python_base_toolkit-0.0.6/python_base_toolkit/base_structures}/__init__.py +0 -0
  21. {python_base_toolkit-0.0.4/python_base_toolkit/decorators → python_base_toolkit-0.0.6/python_base_toolkit/consts}/__init__.py +0 -0
  22. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/consts/operating_system.py +0 -0
  23. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/consts/units/__init__.py +0 -0
  24. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/consts/units/binary_units.py +0 -0
  25. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/consts/units/time_units.py +0 -0
  26. {python_base_toolkit-0.0.4/python_base_toolkit/instances → python_base_toolkit-0.0.6/python_base_toolkit/decorators}/__init__.py +0 -0
  27. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/decorators/telemetry.py +0 -0
  28. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/decorators/timer.py +0 -0
  29. {python_base_toolkit-0.0.4/python_base_toolkit/scripts → python_base_toolkit-0.0.6/python_base_toolkit/instances}/__init__.py +0 -0
  30. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/instances/instance_manager.py +0 -0
  31. {python_base_toolkit-0.0.4/python_base_toolkit/utils → python_base_toolkit-0.0.6/python_base_toolkit/scripts}/__init__.py +0 -0
  32. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/scripts/remove_build_files.py +0 -0
  33. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/data_serialization.py +0 -0
  34. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/date_time.py +0 -0
  35. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/execute.py +0 -0
  36. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/file_utils.py +0 -0
  37. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/generate_id.py +0 -0
  38. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/logo.py +0 -0
  39. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/network.py +0 -0
  40. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/path_utils.py +0 -0
  41. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/pretty_print.py +0 -0
  42. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/pycache.py +0 -0
  43. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/random_utils.py +0 -0
  44. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/shorten_url.py +0 -0
  45. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit/utils/venv_details.py +0 -0
  46. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit.egg-info/dependency_links.txt +0 -0
  47. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit.egg-info/requires.txt +0 -0
  48. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/python_base_toolkit.egg-info/top_level.txt +0 -0
  49. {python_base_toolkit-0.0.4 → python_base_toolkit-0.0.6}/setup.cfg +0 -0
@@ -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.6
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: python_base_toolkit/ci/task_files/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.6"
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.6
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
@@ -3,19 +3,14 @@ MANIFEST.in
3
3
  README.md
4
4
  Taskfile.yml
5
5
  pyproject.toml
6
- CI/Tasks/default.yml
7
- CI/Tasks/dependencies.yml
8
- CI/Tasks/deploy.yml
9
- CI/Tasks/docker.yml
10
- CI/Tasks/install.yml
11
- CI/Tasks/lint.yml
12
- CI/Tasks/main.yml
13
6
  python_base_toolkit/__init__.py
14
7
  python_base_toolkit.egg-info/PKG-INFO
15
8
  python_base_toolkit.egg-info/SOURCES.txt
16
9
  python_base_toolkit.egg-info/dependency_links.txt
17
10
  python_base_toolkit.egg-info/requires.txt
18
11
  python_base_toolkit.egg-info/top_level.txt
12
+ python_base_toolkit/base_structures/__init__.py
13
+ python_base_toolkit/base_structures/base_enum.py
19
14
  python_base_toolkit/consts/__init__.py
20
15
  python_base_toolkit/consts/operating_system.py
21
16
  python_base_toolkit/consts/units/__init__.py
@@ -1,19 +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
- tasks:
9
- default:
10
- cmds:
11
- - echo "VENV_SITE_PACKAGES is set to - {{.VENV_SITE_PACKAGES}}"
12
- - echo "Available tasks:"
13
- - task --list
14
-
15
- check_env:
16
- desc: "Print environment variables"
17
- cmds:
18
- - echo "Environment Variables:"
19
- - env | sort
@@ -1,31 +0,0 @@
1
- version: "3"
2
-
3
- tasks:
4
- pip_update:
5
- desc: "Update all Python dependencies"
6
- cmds:
7
- - echo "Updating Python dependencies..."
8
- - pip install --upgrade -r requirements.txt
9
- - echo "Dependencies updated."
10
-
11
- update_uv:
12
- desc: "Install or update UV binary"
13
- cmds:
14
- - |
15
- if command -v uv > /dev/null 2>&1; then
16
- echo "UV is already installed at $(command -v uv), updating..."
17
- uv update || echo "Automatic update failed. Please update manually."
18
- else
19
- echo "UV not found. Pleasing install UV."
20
- fi
21
-
22
- poetry_update:
23
- desc: "Update all Python dependencies using Poetry"
24
- cmds:
25
- - |
26
- if command -v poetry > /dev/null 2>&1; then
27
- echo "Updating dependencies via Poetry..."
28
- poetry update
29
- else
30
- echo "Poetry is not installed. Please install poetry'"
31
- fi
@@ -1,28 +0,0 @@
1
- version: "3"
2
-
3
- tasks:
4
- clean:
5
- desc: "Clean build artifacts"
6
- cmds:
7
- - echo "cleaning..."
8
- - rm -rf dist/
9
- - rm -rf build/
10
- - rm -rf *.egg-info
11
- - echo "cleaned."
12
-
13
- build:
14
- desc: "Build the package"
15
- cmds:
16
- - echo "building..."
17
- - task clean
18
- - twine build .
19
- - echo "built."
20
-
21
- deploy:
22
- desc: "Deploy the package to PyPI"
23
- cmds:
24
- - echo "deploying..."
25
- - task build
26
- - twine upload dist/*
27
- - echo "deployed."
28
- - task clean
@@ -1,64 +0,0 @@
1
- version: "3"
2
-
3
- tasks:
4
- docker_build:
5
- desc: "Build Docker image for the project"
6
- params:
7
- IMAGE_NAME:
8
- default: "myproject:latest"
9
- cmds:
10
- - echo "Building Docker image {{.IMAGE_NAME}}..."
11
- - docker build -t {{.IMAGE_NAME}} .
12
- - echo "Docker image built - {{.IMAGE_NAME}}"
13
-
14
- docker_run:
15
- desc: "Run Docker container"
16
- params:
17
- IMAGE_NAME:
18
- default: "myproject:latest"
19
- CONTAINER_NAME:
20
- default: "myproject_container"
21
- PORT:
22
- default: "8000"
23
- cmds:
24
- - echo "Running Docker container {{.CONTAINER_NAME}}..."
25
- - docker run -d --name {{.CONTAINER_NAME}} -p {{.PORT}}:{{.PORT}} {{.IMAGE_NAME}}
26
- - echo "Container {{.CONTAINER_NAME}} is running on port {{.PORT}}"
27
-
28
- docker_clean_all:
29
- desc: "Remove old Docker containers and images"
30
- cmds:
31
- - echo "Stopping all running containers..."
32
- - docker ps -q | xargs -r docker stop
33
- - echo "Removing all containers..."
34
- - docker ps -aq | xargs -r docker rm
35
- - echo "Removing all images..."
36
- - docker images -q | xargs -r docker rmi
37
- - echo "Docker cleanup completed."
38
-
39
- docker_clean_project:
40
- desc: "Clean Docker resources for a specific project"
41
- params:
42
- PROJECT_NAME:
43
- default: "myapp"
44
- cmds:
45
- - echo "Stopping and removing containers for project {{.PROJECT_NAME}}..."
46
- - docker ps -aq --filter "name={{.PROJECT_NAME}}" | xargs -r docker stop
47
- - docker ps -aq --filter "name={{.PROJECT_NAME}}" | xargs -r docker rm
48
- - echo "Removing images for project {{.PROJECT_NAME}}..."
49
- - docker images {{.PROJECT_NAME}}* -q | xargs -r docker rmi
50
- - echo "Removing volumes for project {{.PROJECT_NAME}}..."
51
- - docker volume ls -q --filter "name={{.PROJECT_NAME}}" | xargs -r docker volume rm
52
- - echo "Project cleanup completed."
53
-
54
- docker_clean_old:
55
- desc: "Clean old/inactive Docker containers and images"
56
- params:
57
- AGE_HOURS:
58
- default: "720"
59
- cmds:
60
- - echo "Cleaning containers inactive for more than {{.AGE_HOURS}} hours..."
61
- - docker ps -aq --filter "status=exited" --filter "until={{.AGE_HOURS}}h" | xargs -r docker rm
62
- - echo "Cleaning images older than {{.AGE_HOURS}} hours..."
63
- - docker images -q --filter "until={{.AGE_HOURS}}h" | xargs -r docker rmi
64
- - echo "Old resources cleanup completed."
@@ -1,48 +0,0 @@
1
- version: "3"
2
-
3
-
4
- tasks:
5
- uv_bin: # for CI ; command -v uv is the basic command to find uv if exists in PATH
6
- desc: "Find the path to UV"
7
- silent: true # do not print the command output unless needed
8
- cmds:
9
- - |
10
- if command -v uv > /dev/null 2>&1; then
11
- command -v uv
12
- elif [ -x "$HOME/.local/bin/uv" ]; then
13
- echo "$HOME/.local/bin/uv"
14
- elif [ -x "/usr/local/bin/uv" ]; then
15
- echo "/usr/local/bin/uv"
16
- else
17
- echo ""
18
- fi
19
-
20
- check_uv:
21
- desc: "Check if UV is installed"
22
- cmds:
23
- - |
24
- UV_PATH=$(task -s uv_bin)
25
- if [ -n "$UV_PATH" ]; then
26
- echo "UV is installed at: $UV_PATH"
27
- else
28
- echo "UV is not installed."
29
- fi
30
-
31
- install_uv:
32
- desc: "Install UV"
33
- cmds:
34
- - echo "Installing UV..."
35
- - |
36
- if ! command -v uv > /dev/null 2>&1; then
37
- curl -sSfL https://astral.sh/uv/install.sh | sh
38
- else
39
- echo "UV is already installed at $(command -v uv)"
40
- fi
41
- - echo "🎉 UV installed."
42
-
43
- reinstall_uv:
44
- desc: "Force reinstall UV"
45
- cmds:
46
- - echo "🔁 Reinstalling UV..."
47
- - curl -sSfL https://astral.sh/uv/install.sh | sh
48
- - echo "🎉 UV reinstalled!"
@@ -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,27 +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
- default: default.yml
10
- dependencies: dependencies.yml
11
- deploy: deploy.yml
12
- docker: docker.yml
13
- install: install.yml
14
- lint: lint.yml
15
-
16
- tasks:
17
- default:
18
- cmds:
19
- - echo "VENV_SITE_PACKAGES is set to - {{.VENV_SITE_PACKAGES}}"
20
- - echo "Available tasks:"
21
- - task --list
22
-
23
- env:
24
- desc: "Print environment variables"
25
- cmds:
26
- - echo "Environment Variables:"
27
- - env | sort
@@ -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