python-base-toolkit 1.1.3__tar.gz → 1.2.1__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 (55) hide show
  1. {python_base_toolkit-1.1.3/python_base_toolkit.egg-info → python_base_toolkit-1.2.1}/PKG-INFO +2 -10
  2. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/pyproject.toml +9 -9
  3. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/base_structures/base_pydantic_model.py +4 -5
  4. python_base_toolkit-1.2.1/python_base_toolkit/ci/task_files/lint.yml +9 -0
  5. python_base_toolkit-1.2.1/python_base_toolkit/consts/units/__init__.py +6 -0
  6. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/data_serialization.py +16 -17
  7. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1/python_base_toolkit.egg-info}/PKG-INFO +2 -10
  8. python_base_toolkit-1.2.1/python_base_toolkit.egg-info/requires.txt +7 -0
  9. python_base_toolkit-1.1.3/python_base_toolkit/ci/task_files/lint.yml +0 -14
  10. python_base_toolkit-1.1.3/python_base_toolkit/consts/units/__init__.py +0 -7
  11. python_base_toolkit-1.1.3/python_base_toolkit.egg-info/requires.txt +0 -15
  12. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/LICENSE +0 -0
  13. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/MANIFEST.in +0 -0
  14. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/README.md +0 -0
  15. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/Taskfile.yml +0 -0
  16. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/__init__.py +0 -0
  17. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/base_structures/__init__.py +0 -0
  18. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/base_structures/base_enum.py +0 -0
  19. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/default.yml +0 -0
  20. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/dependencies.yml +0 -0
  21. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/deploy.yml +0 -0
  22. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/docker.yml +0 -0
  23. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/includes.yml +0 -0
  24. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/install.yml +0 -0
  25. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/ci/task_files/vars.yml +0 -0
  26. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/consts/__init__.py +0 -0
  27. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/consts/general.py +0 -0
  28. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/consts/operating_system.py +0 -0
  29. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/consts/units/binary_units.py +0 -0
  30. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/consts/units/time_units.py +0 -0
  31. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/decorators/__init__.py +0 -0
  32. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/decorators/telemetry.py +0 -0
  33. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/decorators/timer.py +0 -0
  34. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/instances/__init__.py +0 -0
  35. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/instances/instance_manager.py +0 -0
  36. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/scripts/__init__.py +0 -0
  37. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/scripts/remove_build_files.py +0 -0
  38. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/__init__.py +0 -0
  39. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/date_time.py +0 -0
  40. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/execute.py +0 -0
  41. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/file_utils.py +0 -0
  42. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/generate_id.py +0 -0
  43. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/logo.py +0 -0
  44. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/network.py +0 -0
  45. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/path_utils.py +0 -0
  46. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/pretty_print.py +0 -0
  47. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/pycache.py +0 -0
  48. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/random_utils.py +0 -0
  49. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/shorten_url.py +0 -0
  50. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit/utils/venv_details.py +0 -0
  51. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit.egg-info/SOURCES.txt +0 -0
  52. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit.egg-info/dependency_links.txt +0 -0
  53. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit.egg-info/not-zip-safe +0 -0
  54. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/python_base_toolkit.egg-info/top_level.txt +0 -0
  55. {python_base_toolkit-1.1.3 → python_base_toolkit-1.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-base-toolkit
3
- Version: 1.1.3
3
+ Version: 1.2.1
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Author: Avi Zaguri
6
6
  License: MIT
@@ -16,21 +16,13 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
16
  Requires-Python: >=3.12
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: build>=1.3.0
20
- Requires-Dist: colorlog>=6.10.1
21
- Requires-Dist: custom-python-logger>=4.0.0
19
+ Requires-Dist: custom-python-logger>=4.2.0
22
20
  Requires-Dist: pandas>=2.3.3
23
- Requires-Dist: pathlib>=1.0.1
24
- Requires-Dist: pre-commit>=4.5.0
25
21
  Requires-Dist: pydantic>=2.12.5
26
22
  Requires-Dist: pyfiglet>=1.0.4
27
- Requires-Dist: python-dotenv>=1.2.1
28
23
  Requires-Dist: pyyaml>=6.0.3
29
24
  Requires-Dist: requests>=2.32.5
30
- Requires-Dist: setuptools>=80.9.0
31
25
  Requires-Dist: tqdm>=4.67.1
32
- Requires-Dist: twine>=6.2.0
33
- Requires-Dist: wheel>=0.45.1
34
26
  Dynamic: license-file
35
27
 
36
28
  ![PyPI version](https://img.shields.io/pypi/v/python-base-toolkit)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-base-toolkit"
7
- version = "1.1.3"
7
+ version = "1.2.1"
8
8
  description = "A Python package for managing pytest plugins."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -21,21 +21,21 @@ classifiers = [
21
21
  ]
22
22
 
23
23
  dependencies = [
24
- "build>=1.3.0",
25
- "colorlog>=6.10.1",
26
- "custom-python-logger>=4.0.0",
24
+ "custom-python-logger>=4.2.0",
27
25
  "pandas>=2.3.3",
28
- "pathlib>=1.0.1",
29
- "pre-commit>=4.5.0",
30
26
  "pydantic>=2.12.5",
31
27
  "pyfiglet>=1.0.4",
32
- "python-dotenv>=1.2.1",
33
28
  "pyyaml>=6.0.3",
34
29
  "requests>=2.32.5",
35
- "setuptools>=80.9.0",
36
30
  "tqdm>=4.67.1",
31
+ ]
32
+
33
+ [dependency-groups]
34
+ dev = [
35
+ "build>=1.3.0",
36
+ "pre-commit>=4.5.0",
37
+ "pytest>=9.2.0",
37
38
  "twine>=6.2.0",
38
- "wheel>=0.45.1",
39
39
  ]
40
40
 
41
41
  [project.urls]
@@ -1,7 +1,6 @@
1
- from typing import Any, TypeVar
2
- from pydantic import BaseModel
1
+ from typing import Any
3
2
 
4
- T = TypeVar("T", bound="PydanticMixin")
3
+ from pydantic import BaseModel
5
4
 
6
5
 
7
6
  class BasePydanticModel(BaseModel):
@@ -10,11 +9,11 @@ class BasePydanticModel(BaseModel):
10
9
  def __str__(self) -> str:
11
10
  return f"{self.__class__.__name__}({self.model_dump()})"
12
11
 
13
- def to_dict(self, **kwargs) -> dict[str, Any]:
12
+ def to_dict(self, **kwargs: Any) -> dict[str, Any]:
14
13
  """Wrapper for model_dump."""
15
14
  return self.model_dump(**kwargs)
16
15
 
17
- def to_json(self, **kwargs) -> str:
16
+ def to_json(self, **kwargs: Any) -> str:
18
17
  """Wrapper for model_dump_json."""
19
18
  return self.model_dump_json(**kwargs)
20
19
 
@@ -0,0 +1,9 @@
1
+ version: "3"
2
+
3
+ tasks:
4
+ pre-commit:
5
+ desc: Pre-commit all files.
6
+ cmds:
7
+ - echo "Running pre-commit hooks on all files..."
8
+ - '"{{.UV_BIN}}" run pre-commit run --all-files'
9
+ - defer: { task: ":infra:deploy:clean" }
@@ -0,0 +1,6 @@
1
+ from python_base_toolkit.consts.units import binary_units, time_units
2
+
3
+ __all__ = [
4
+ "binary_units",
5
+ "time_units",
6
+ ]
@@ -1,4 +1,5 @@
1
1
  import json
2
+ from collections.abc import Callable
2
3
  from dataclasses import is_dataclass
3
4
  from datetime import date, datetime, time
4
5
  from decimal import Decimal
@@ -15,25 +16,23 @@ from python_base_toolkit.consts.general import LOGGER_NAME
15
16
  logger = get_logger(LOGGER_NAME)
16
17
 
17
18
 
19
+ _TYPE_SERIALIZERS: tuple[tuple[type | tuple[type, ...], Callable[[Any], object]], ...] = (
20
+ (BaseModel, lambda obj: obj.model_dump()),
21
+ (type, lambda obj: obj.__name__),
22
+ (Enum, lambda obj: obj.value),
23
+ ((set, tuple), list),
24
+ ((datetime, date, time), lambda obj: obj.isoformat()),
25
+ (Decimal, float),
26
+ (Path, str),
27
+ )
28
+
29
+
18
30
  def default_serialize(obj: object) -> object:
19
- if isinstance(obj, BaseModel):
20
- return obj.model_dump()
21
- if isinstance(obj, type):
22
- return obj.__name__
23
- if is_dataclass(obj) and not isinstance(obj, type):
31
+ if is_dataclass(obj) and not isinstance(obj, type | BaseModel):
24
32
  return obj.__dict__
25
- if isinstance(obj, Enum):
26
- return obj.value
27
- if isinstance(obj, set):
28
- return list(obj)
29
- if isinstance(obj, tuple):
30
- return list(obj)
31
- if isinstance(obj, datetime | date | time):
32
- return obj.isoformat()
33
- if isinstance(obj, Decimal):
34
- return float(obj)
35
- if isinstance(obj, Path):
36
- return str(obj)
33
+ for types, serializer in _TYPE_SERIALIZERS:
34
+ if isinstance(obj, types):
35
+ return serializer(obj)
37
36
  if obj is pd.NA:
38
37
  return None
39
38
  logger.error(f"Object is not serializable: {obj}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-base-toolkit
3
- Version: 1.1.3
3
+ Version: 1.2.1
4
4
  Summary: A Python package for managing pytest plugins.
5
5
  Author: Avi Zaguri
6
6
  License: MIT
@@ -16,21 +16,13 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
16
  Requires-Python: >=3.12
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
- Requires-Dist: build>=1.3.0
20
- Requires-Dist: colorlog>=6.10.1
21
- Requires-Dist: custom-python-logger>=4.0.0
19
+ Requires-Dist: custom-python-logger>=4.2.0
22
20
  Requires-Dist: pandas>=2.3.3
23
- Requires-Dist: pathlib>=1.0.1
24
- Requires-Dist: pre-commit>=4.5.0
25
21
  Requires-Dist: pydantic>=2.12.5
26
22
  Requires-Dist: pyfiglet>=1.0.4
27
- Requires-Dist: python-dotenv>=1.2.1
28
23
  Requires-Dist: pyyaml>=6.0.3
29
24
  Requires-Dist: requests>=2.32.5
30
- Requires-Dist: setuptools>=80.9.0
31
25
  Requires-Dist: tqdm>=4.67.1
32
- Requires-Dist: twine>=6.2.0
33
- Requires-Dist: wheel>=0.45.1
34
26
  Dynamic: license-file
35
27
 
36
28
  ![PyPI version](https://img.shields.io/pypi/v/python-base-toolkit)
@@ -0,0 +1,7 @@
1
+ custom-python-logger>=4.2.0
2
+ pandas>=2.3.3
3
+ pydantic>=2.12.5
4
+ pyfiglet>=1.0.4
5
+ pyyaml>=6.0.3
6
+ requests>=2.32.5
7
+ tqdm>=4.67.1
@@ -1,14 +0,0 @@
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
- set +a
11
- "{{.UV_BIN}}" run pre-commit run --all-files
12
- - |
13
- echo "Cleaning up..."
14
- task: infra:deploy:clean
@@ -1,7 +0,0 @@
1
- import python_base_toolkit.consts.units.binary_units
2
- import python_base_toolkit.consts.units.time_units
3
-
4
- __all__ = [
5
- "binary_units",
6
- "time_units",
7
- ]
@@ -1,15 +0,0 @@
1
- build>=1.3.0
2
- colorlog>=6.10.1
3
- custom-python-logger>=4.0.0
4
- pandas>=2.3.3
5
- pathlib>=1.0.1
6
- pre-commit>=4.5.0
7
- pydantic>=2.12.5
8
- pyfiglet>=1.0.4
9
- python-dotenv>=1.2.1
10
- pyyaml>=6.0.3
11
- requests>=2.32.5
12
- setuptools>=80.9.0
13
- tqdm>=4.67.1
14
- twine>=6.2.0
15
- wheel>=0.45.1