test-python-package-release 0.3.2__py3-none-any.whl → 0.5.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.
@@ -1,16 +1,37 @@
1
1
  """Test Python package release — template library."""
2
2
 
3
- __version__ = "0.3.2" # managed by release-please
3
+ __version__ = "0.5.0" # managed by release-please
4
4
 
5
- from test_python_package_release.calculator import add, divide, multiply, power, subtract
6
- from test_python_package_release.strings import reverse_string, snake_to_camel
5
+ from test_python_package_release.calculator import (
6
+ add,
7
+ divide,
8
+ is_divisible,
9
+ modulo,
10
+ multiply,
11
+ power,
12
+ sqrt,
13
+ subtract,
14
+ )
15
+ from test_python_package_release.strings import (
16
+ camel_to_snake,
17
+ count_words,
18
+ reverse_string,
19
+ snake_to_camel,
20
+ truncate,
21
+ )
7
22
 
8
23
  __all__ = [
9
24
  "add",
25
+ "camel_to_snake",
26
+ "count_words",
10
27
  "divide",
28
+ "is_divisible",
29
+ "modulo",
11
30
  "multiply",
12
31
  "power",
13
32
  "reverse_string",
14
33
  "snake_to_camel",
34
+ "sqrt",
15
35
  "subtract",
36
+ "truncate",
16
37
  ]
@@ -18,3 +18,21 @@ def divide(a: float, b: float) -> float:
18
18
 
19
19
  def power(base: float, exponent: float) -> float:
20
20
  return base**exponent
21
+
22
+
23
+ def modulo(a: float, b: float) -> float:
24
+ if b == 0:
25
+ raise ZeroDivisionError("Cannot modulo by zero")
26
+ return a % b
27
+
28
+
29
+ def sqrt(x: float) -> float:
30
+ if x < 0:
31
+ raise ValueError("Cannot take square root of a negative number")
32
+ return x**0.5
33
+
34
+
35
+ def is_divisible(a: float, b: float) -> bool:
36
+ if b == 0:
37
+ raise ZeroDivisionError("Cannot divide by zero")
38
+ return a % b == 0
@@ -5,3 +5,22 @@ def reverse_string(s: str) -> str:
5
5
  def snake_to_camel(s: str) -> str:
6
6
  parts = s.split("_")
7
7
  return parts[0] + "".join(p.title() for p in parts[1:])
8
+
9
+
10
+ def count_words(s: str) -> int:
11
+ return len(s.split()) if s.strip() else 0
12
+
13
+
14
+ def camel_to_snake(s: str) -> str:
15
+ result = []
16
+ for i, ch in enumerate(s):
17
+ if ch.isupper() and i > 0:
18
+ result.append("_")
19
+ result.append(ch.lower())
20
+ return "".join(result)
21
+
22
+
23
+ def truncate(s: str, max_length: int, suffix: str = "...") -> str:
24
+ if len(s) <= max_length:
25
+ return s
26
+ return s[: max_length - len(suffix)] + suffix
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: test-python-package-release
3
- Version: 0.3.2
3
+ Version: 0.5.0
4
4
  Summary: Template library demonstrating Python package release CI/CD
5
5
  Author-email: Dawid Wozniak <wozniakos10@gmail.com>
6
6
  License: MIT License
@@ -137,8 +137,28 @@ Release PR merged ──▶ release-please tags + creates GitHub Release
137
137
  └─ publish.yml ──▶ uv build
138
138
  ──▶ TestPyPI (OIDC)
139
139
  ──▶ PyPI (OIDC, gated env)
140
+ │
141
+ └─ docker-publish.yml ──▶ Docker Hub
142
+ (<version>, <major.minor>, sha-*)
143
+ ```
144
+
145
+ ## Docker image
146
+
147
+ Each GitHub Release also publishes a multi-arch image (amd64, arm64) to
148
+ Docker Hub. To try it locally:
149
+
150
+ ```bash
151
+ docker build -t test-python-package-release .
152
+ docker run --rm test-python-package-release
140
153
  ```
141
154
 
155
+ Required repo configuration (Settings → Secrets and variables → Actions):
156
+
157
+ - Variable `DOCKERHUB_USERNAME`: your Docker Hub username
158
+ - Secret `DOCKERHUB_TOKEN`: a Docker Hub
159
+ [personal access token](https://app.docker.com/settings/personal-access-tokens)
160
+ with Read & Write scope
161
+
142
162
  ## First-time setup after cloning the template
143
163
 
144
164
  1. **Rename the package**: update `name` in `pyproject.toml`, the directory
@@ -0,0 +1,7 @@
1
+ test_python_package_release/__init__.py,sha256=k0AMN3tPNRqhjz6_7uUgBHXeH32Pj3VaZdH6DOt1UbI,639
2
+ test_python_package_release/calculator.py,sha256=XTfDYYo7j4CJwqVsrgTTP3EggwvW5WvFHloi3Y3OU_U,799
3
+ test_python_package_release/strings.py,sha256=y92FYBlBjHi-NeK0NKUIudqKvjtedl9rFJJLaFFOVPc,632
4
+ test_python_package_release-0.5.0.dist-info/METADATA,sha256=gMeMx9dr9eSZIqfTyFPCsFjcnzzQGeZBvqXtByWlHx8,9496
5
+ test_python_package_release-0.5.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
6
+ test_python_package_release-0.5.0.dist-info/licenses/LICENSE,sha256=FK3qjfsYq7ZWgF5WWecz0lQFe6PoBbKyNYK2hBs0aN8,1070
7
+ test_python_package_release-0.5.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.29.0
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,7 +0,0 @@
1
- test_python_package_release/__init__.py,sha256=S4is54cjE3dNkHqDIlVVXFJMu1DUH-UjkZAedmRtO60,407
2
- test_python_package_release/calculator.py,sha256=sYwW1XekGBp1ZCkEqQ4mD9Y1TF1pm6uMW0L8VASVIW8,389
3
- test_python_package_release/strings.py,sha256=wfMdEde8gKrxVJ-HJMsYbgV8IjahgqIRPy5JjLpN1wY,176
4
- test_python_package_release-0.3.2.dist-info/METADATA,sha256=XN9i6z2Ngmge1RjhQJ6AeN3Ck8Ycy15suBK0w7LMFDo,8797
5
- test_python_package_release-0.3.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
6
- test_python_package_release-0.3.2.dist-info/licenses/LICENSE,sha256=FK3qjfsYq7ZWgF5WWecz0lQFe6PoBbKyNYK2hBs0aN8,1070
7
- test_python_package_release-0.3.2.dist-info/RECORD,,